Skip to content

chore: Replace Lerna 2.x with npm workspaces#170

Merged
andykog merged 4 commits into
masterfrom
chore/replace-lerna-with-npm-workspaces
Jun 16, 2026
Merged

chore: Replace Lerna 2.x with npm workspaces#170
andykog merged 4 commits into
masterfrom
chore/replace-lerna-with-npm-workspaces

Conversation

@andykog

@andykog andykog commented Jun 16, 2026

Copy link
Copy Markdown
Member

Summary

  • Remove Lerna 2.x (^2.4.0, from 2017) and lerna.json in favor of npm workspaces, which is built into npm 7+ and requires zero additional dependencies.
  • Add "workspaces": ["packages/*"] to the root package.json so npm automatically links the three workspace packages (mobx-devtools, mobx-devtools-mst, playground).
  • Move the monorepo version (0.9.32) from lerna.json into the root package.json version field.
  • Update bootstrap script from npm install && lerna bootstrap to just npm install --legacy-peer-deps (npm workspaces handles hoisting and linking).
  • Update build script from lerna run build to npm run build --workspaces --if-present.
  • Update scripts/bump-version.js and scripts/webextension/prepare.js to read version from package.json instead of lerna.json.
  • Update .github/workflows/release.yml to read version from package.json instead of lerna.json.

Motivation

Lerna 2.4.0 is from 2017 and is no longer maintained. npm workspaces (available since npm 7, included with Node 14+) provides the same monorepo capabilities -- package linking, hoisted dependencies, and cross-workspace script execution -- with zero extra dependencies. This project already requires Node 20 (per .nvmrc), so npm workspaces is available out of the box.

andykog added 4 commits June 16, 2026 19:07
npm workspaces hoists dependencies to the root node_modules/, so
hardcoded paths like packages/playground/node_modules/mobx no longer
exist. Use require.resolve to find packages wherever they are installed.
…ances

With npm workspaces, mobx-react is hoisted to root node_modules/ and
resolves react from there (React 15), while the playground source
resolves its own React 16. Two React instances break the app.

Pin react and react-dom aliases to the playground's local copies so all
code in the bundle shares a single React instance.
@andykog andykog marked this pull request as ready for review June 16, 2026 18:00
@andykog andykog merged commit 2578756 into master Jun 16, 2026
1 check passed
@andykog andykog deleted the chore/replace-lerna-with-npm-workspaces branch June 16, 2026 18:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant