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
2 changes: 2 additions & 0 deletions pnpm-workspace.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ ignoredBuiltDependencies:
- ssh2
- unrs-resolver
- wasm-pack
# Keep security related settings in sync with pnpm-workspace.yaml written to
# temporary fixture dirs in file://./scripts/install-native.mjs
blockExoticSubdeps: true
minimumReleaseAge: 2880 # 48 hrs
minimumReleaseAgeExclude:
Expand Down
35 changes: 29 additions & 6 deletions scripts/install-native.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import path from 'path'
import execa from 'execa'
import fs from 'fs'
import fsp from 'fs/promises'
import { outdent } from 'outdent'
;(async function () {
if (process.env.NEXT_SKIP_NATIVE_POSTINSTALL) {
console.log(
Expand Down Expand Up @@ -58,20 +59,43 @@ import fsp from 'fs/promises'
packageManager,
}
fs.writeFileSync(path.join(tmpdir, 'package.json'), JSON.stringify(pkgJson))
fs.writeFileSync(path.join(tmpdir, '.npmrc'), 'node-linker=hoisted')
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Moved into pnpm-workspace.yaml

fs.writeFileSync(
path.join(tmpdir, 'pnpm-workspace.yaml'),
'' +
outdent`
nodeLinker: hoisted
` +
'\n' +
// Propagate security related settings from file://./../../pnpm-workspace.yaml
outdent`
blockExoticSubdeps: true
minimumReleaseAge: 2880 # 48 hrs
minimumReleaseAgeExclude:
- '@next/*'
- '@turbo/*'
- '@vercel/*'
- '@workflow/*'
- babel-plugin-react-compiler
- next
- react
- react-dom
- react-is
- react-server-dom-*
- scheduler
- turbo
`
)

const args = [
'add',
`next@${nextVersion}`,
'--lockfile=false',
'--ignore-workspace',
'--ignore-scripts',
]
if (preferOffline) {
args.push('--prefer-offline')
}
let { stdout } = await execa('pnpm', args, { cwd: tmpdir })
console.log(stdout)
await execa('pnpm', args, { cwd: tmpdir })

let pkgs = fs.readdirSync(path.join(tmpdir, 'node_modules/@next'))
fs.mkdirSync(path.join(cwd, 'node_modules/@next'), { recursive: true })
Expand All @@ -91,7 +115,6 @@ import fsp from 'fs/promises'
fs.rmSync(tmpdir, { recursive: true, force: true })
console.log('Installed the following binary packages:', pkgs)
} catch (e) {
console.error(e)
console.error('Failed to load @next/swc binary packages')
throw new Error('Failed to install @next/swc binary packages', { cause: e })
}
})()
Loading