Unverified Commit e09ac7d2 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

Replace lerna task-runner usage with pnpm (#99040)

pnpm solves all the remaining usages of Lerna so we're switching to pnpm
instead. The goal is to get rid of Lerna.
parent 2884eb21
...@@ -9,10 +9,9 @@ ...@@ -9,10 +9,9 @@
"new-error": "turbo gen error", "new-error": "turbo gen error",
"new-test": "turbo gen test", "new-test": "turbo gen test",
"pr-adopt": "node scripts/adopt-pr.js", "pr-adopt": "node scripts/adopt-pr.js",
"clean": "lerna clean -y && lerna run clean && lerna exec 'node ../../scripts/rm.mjs dist'", "clean": "pnpm --filter \"./packages/**\" run clean && pnpm --filter \"./packages/**\" exec node ../../scripts/rm.mjs dist node_modules",
"build": "turbo run build --remote-cache-timeout 60 --summarize true", "build": "turbo run build --remote-cache-timeout 60 --summarize true",
"build-all": "turbo run build build-native-auto --remote-cache-timeout 60 --summarize true", "build-all": "turbo run build build-native-auto --remote-cache-timeout 60 --summarize true",
"lerna": "lerna",
"dev": "turbo run dev --parallel --filter=\"!@next/bundle-analyzer-ui\"", "dev": "turbo run dev --parallel --filter=\"!@next/bundle-analyzer-ui\"",
"bench:render-pipeline": "tsx bench/render-pipeline/benchmark.ts", "bench:render-pipeline": "tsx bench/render-pipeline/benchmark.ts",
"bench:render-pipeline:analyze": "tsx bench/render-pipeline/analyze-profiles.ts", "bench:render-pipeline:analyze": "tsx bench/render-pipeline/analyze-profiles.ts",
...@@ -78,7 +77,7 @@ ...@@ -78,7 +77,7 @@
"check-examples": "./scripts/check-examples.sh", "check-examples": "./scripts/check-examples.sh",
"get-test-timings": "node run-tests.js --timings --write-timings -g 1/1", "get-test-timings": "node run-tests.js --timings --write-timings -g 1/1",
"prettier-fix": "prettier --write .", "prettier-fix": "prettier --write .",
"types": "lerna run types --stream", "types": "pnpm --filter \"./packages/**\" --stream run types",
"types:test-lib": "tsc --project test/lib/tsconfig.json", "types:test-lib": "tsc --project test/lib/tsconfig.json",
"check-precompiled": "./scripts/check-pre-compiled.sh", "check-precompiled": "./scripts/check-pre-compiled.sh",
"lint-staged": "lint-staged", "lint-staged": "lint-staged",
......
...@@ -76,13 +76,27 @@ async function main() { ...@@ -76,13 +76,27 @@ async function main() {
}) })
) )
const lernaListJson = await execa('pnpm', [ // `--depth -1` limits the output to the workspace projects themselves,
// without their dependency trees. The filter matches the `packages/*` glob
// the release only ever publishes from.
const pnpmListJson = await execa('pnpm', [
'--silent', '--silent',
'lerna',
'list', 'list',
'--recursive',
'--depth',
'-1',
'--json', '--json',
'--filter',
'./packages/**',
]) ])
const packages = JSON.parse(lernaListJson.stdout) const packages = JSON.parse(pnpmListJson.stdout)
for (const packageInfo of packages) {
if (!packageInfo.path) {
throw new Error(
`Unexpected \`pnpm list\` output: no \`path\` for ${packageInfo.name}`
)
}
}
const packagesByVersion = new Map() const packagesByVersion = new Map()
// vercel-packages finds GH artifacts via the head SHA because that's the only // vercel-packages finds GH artifacts via the head SHA because that's the only
// API GitHub offers. // API GitHub offers.
...@@ -101,14 +115,16 @@ async function main() { ...@@ -101,14 +115,16 @@ async function main() {
console.info(`Creating tarballs for regular packages`) console.info(`Creating tarballs for regular packages`)
for (const packageInfo of packages) { for (const packageInfo of packages) {
if (packageInfo.private) { const packageJsonPath = path.join(packageInfo.path, 'package.json')
continue
}
const packageJsonPath = path.join(packageInfo.location, 'package.json')
const packageJson = await fs.readFile(packageJsonPath, 'utf8') const packageJson = await fs.readFile(packageJsonPath, 'utf8')
const manifest = JSON.parse(packageJson) const manifest = JSON.parse(packageJson)
// Read `private` from the manifest rather than from the `pnpm list` entry,
// so this does not depend on pnpm surfacing that field.
if (manifest.private) {
continue
}
manifest.version = version manifest.version = version
if (packageInfo.name === 'next') { if (packageInfo.name === 'next') {
...@@ -149,7 +165,7 @@ async function main() { ...@@ -149,7 +165,7 @@ async function main() {
'npm', 'npm',
['pack', '--pack-destination', packDestination], ['pack', '--pack-destination', packDestination],
{ {
cwd: packageInfo.location, cwd: packageInfo.path,
} }
) )
// tarball name is printed as the last line of npm-pack // tarball name is printed as the last line of npm-pack
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment