Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/workflows/build_reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -300,16 +300,6 @@ jobs:
- run: ANALYZE=1 pnpm build
if: ${{ inputs.skipInstallBuild != 'yes' }}

# Some packages e.g. `devlow-bench` depend on `pnpm build` to generate
# their `dist` directory. The first run of `pnpm install` will generate
# warnings because these don't exist yet.
#
# We need to run `pnpm install` a _second_ time to fix this. Fortunately,
# this second run is very fast and cheap.
- name: Re-run pnpm install to link built packages into node_modules/.bin
run: pnpm install
if: ${{ inputs.skipInstallBuild != 'yes' }}

- run: pnpm playwright install --with-deps ${{ inputs.browser }}
if: ${{ inputs.skipInstallBuild != 'yes' }}

Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"clean-trace-jaeger": "node scripts/rm.mjs test/integration/basic/.next && TRACE_TARGET=JAEGER pnpm next build test/integration/basic",
"debug": "cross-env NEXT_PRIVATE_LOCAL_DEV=1 NEXT_TELEMETRY_DISABLED=1 node --inspect --trace-deprecation --enable-source-maps packages/next/dist/bin/next",
"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",
Expand Down
42 changes: 42 additions & 0 deletions scripts/create-next-bin-placeholder.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import fs from 'node:fs'
import path from 'node:path'
import { fileURLToPath } from 'node:url'

const scriptDir = path.dirname(fileURLToPath(import.meta.url))
const repoRoot = path.join(scriptDir, '..')

const placeholders = [
path.join(repoRoot, 'packages', 'next', 'dist', 'bin', 'next'),
path.join(repoRoot, 'packages', 'create-next-app', 'dist', 'index.js'),
path.join(
repoRoot,
'turbopack',
'packages',
'devlow-bench',
'dist',
'cli.js'
),
]

for (const binPath of placeholders) {
if (fs.existsSync(binPath)) {
continue
}

fs.mkdirSync(path.dirname(binPath), { recursive: true })

fs.writeFileSync(
binPath,
`#!/usr/bin/env node
console.error(
"Local workspace has not been built yet. Run 'pnpm build' first."
)
process.exit(1)
`,
'utf8'
)

if (process.platform !== 'win32') {
fs.chmodSync(binPath, 0o755)
}
}
7 changes: 6 additions & 1 deletion scripts/install-native.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,12 @@ import fsp from 'fs/promises'
fs.writeFileSync(path.join(tmpdir, 'package.json'), JSON.stringify(pkgJson))
fs.writeFileSync(path.join(tmpdir, '.npmrc'), 'node-linker=hoisted')

const args = ['add', `next@${nextVersion}`]
const args = [
'add',
`next@${nextVersion}`,
'--lockfile=false',
'--ignore-workspace',
Comment on lines +66 to +67
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why, and codex wasn't able to figure it out either, but when I was running pnpm i inside of a fresh ubuntu VM, it was trying to modify the pnpm-lock.yaml unless these flags were set due to some sort of workspace isolation issue.

But either way, these flags seem like a small improvement here.

]
if (preferOffline) {
args.push('--prefer-offline')
}
Expand Down
Loading