[cd] Use pnpm to manage the version (#99041)
lerna's last job was bumping the version, and it needed a dependency
graph of exact pins to do it. Internal dependencies now use the
`workspace:*` protocol instead, which pnpm substitutes for the concrete
version when packing, so published manifests are unchanged.
`workspace:*` resolves to the same bare exact version that was pinned
before.
That leaves the bump itself, which `scripts/version-bump.js` now does:
write one version field per package, commit, tag. It stays small because
every package is versioned in lockstep and releases always bumped all of
them (`--force-publish`), so there is no changed-detection to
reimplement.
`packages/next/package.json` replaces `lerna.json` as the version source
of truth.
The release branch gate moves to `scripts/release-branches.json`.
Three things fall out:
- `normalize-version-bump.js` no longer has to normalize internal
dependency specs, since `workspace:*` carries no version. Those specs
also stop contributing to turbo input hashes.
- `set-preview-version.js` no longer needs to check out a branch first.
That only existed because `lerna version` refused to run on a detached
HEAD.
- no more lockfile regeneration after a release which means we can reuse
n_m caches
`create-preview-tarballs.js` keeps `npm pack`: it rewrites internal
dependencies
to tarball URLs rather than versions, because that is what preview
installs need, so pnpm's substitution would be the wrong transform. It
now throws if any `workspace:` specifier survives that rewrite.
## test plan
```
$ git switch -c scratch/release-dry-run sebbie/remove-lerna
$ node scripts/start-release.js --release-type canary --dry-run
Dry run: keeping commits locally, skipping git push and GitHub release creation
Running release-canary...
Bumping 16.4.0-canary.39 -> 16.4.0-canary.40
Updated 20 packages
[...]
Creating GitHub release v16.4.0-canary.40 (changelog range v16.4.0-canary.39..v16.4.0-canary.40, 30 commits)
[dry-run] GitHub API POST /repos/vercel/next.js/releases {"tag_name":"v16.4.0-canary.40","name":"v16.4.0-canary.40","body":"### Misc Changes\n\n- Remove lerna\n- [PPF] Implement `unstable_ensureStatic = \"shell\" | \"prefetch\"` (#98191)\n- [PPF] Valid… (1939 chars)","prerelease":true,"draft":true}
Created draft prerelease v16.4.0-canary.40
Release process is finished
$ git show HEAD --oneline
c198fa45fae (HEAD -> scratch/release-dry-run, tag: v16.4.0-canary.40) v16.4.0-canary.40
$ node scripts/publish-release.js --dry-run
$ git diff
diff --git a/packages/next/package.json b/packages/next/package.json
[...]
"optionalDependencies": {
- "sharp": "^0.35.4"
+ "sharp": "^0.35.4",
+ "@next/swc-darwin-arm64": "16.4.0-canary.40",
+ "@next/swc-darwin-x64": "16.4.0-canary.40",
+ "@next/swc-linux-arm64-gnu": "16.4.0-canary.40",
+ "@next/swc-linux-arm64-musl": "16.4.0-canary.40",
+ "@next/swc-linux-x64-gnu": "16.4.0-canary.40",
+ "@next/swc-linux-x64-musl": "16.4.0-canary.40",
+ "@next/swc-win32-arm64-msvc": "16.4.0-canary.40",
+ "@next/swc-win32-x64-msvc": "16.4.0-canary.40"
},
[...]
diff --git a/packages/third-parties/package.json b/packages/third-parties/package
.json
index 7a7fab8790..8cbf23b9cd 100644
--- a/packages/third-parties/package.json
+++ b/packages/third-parties/package.json
@@ -32,7 +32,7 @@
"typescript": "6.0.2"
},
"peerDependencies": {
- "next": "^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0",
+ "next": "^13.0.0 || ^14.0.0 || ^15.0.0 || ^16.0.0 || 16.4.0-canary.40",
"react": "^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0"
}
```
Showing
lerna.json
deleted
100644 → 0
| ... | ... | @@ -88,7 +88,6 @@ |
| "debug-brk": "cross-env NEXT_PRIVATE_LOCAL_DEV=1 NEXT_TELEMETRY_DISABLED=1 node --inspect-brk --trace-deprecation --enable-source-maps packages/next/dist/bin/next", | ||
| "pnpm:devPreinstall": "node scripts/create-next-bin-placeholder.mjs", | ||
| "postinstall": "node scripts/git-configure.mjs && node scripts/install-native.mjs", | ||
| "version": "pnpm install --no-frozen-lockfile && git add .", | ||
| "prepare": "husky", | ||
| "sync-react": "node ./scripts/sync-react.js", | ||
| "update-google-fonts": "node ./scripts/update-google-fonts.js", | ||
| ... | ... | @@ -233,7 +232,6 @@ |
| "kleur": "^4.1.0", | ||
| "ky": "0.19.1", | ||
| "ky-universal": "0.6.0", | ||
| "lerna": "9.0.3", | ||
| "lint-staged": "15.2.2", | ||
| "lodash": "4.18.1", | ||
| "lost": "8.3.1", | ||
| ... | ... |
This source diff could not be displayed because it is too large.
You can
view the blob
instead.
scripts/release-version.js
0 → 100644
scripts/version-bump.js
0 → 100644
Please
register
or
sign in
to comment