mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
fix: preinstall should run after dependencies are installed (#3395)
This commit is contained in:
6
.changeset/sixty-pillows-brush.md
Normal file
6
.changeset/sixty-pillows-brush.md
Normal file
@@ -0,0 +1,6 @@
|
||||
---
|
||||
"@pnpm/headless": patch
|
||||
"supi": patch
|
||||
---
|
||||
|
||||
`preinstall` scripts should run after installing the dependencies (this is how it works with npm).
|
||||
@@ -164,15 +164,6 @@ export default async (opts: HeadlessOptions) => {
|
||||
unsafePerm: opts.unsafePerm || false,
|
||||
}
|
||||
|
||||
if (!opts.ignoreScripts && !opts.ignorePackageManifest) {
|
||||
await runLifecycleHooksConcurrently(
|
||||
['preinstall'],
|
||||
opts.projects,
|
||||
opts.childConcurrency ?? 5,
|
||||
scriptsOpts
|
||||
)
|
||||
}
|
||||
|
||||
const skipped = opts.skipped || new Set<string>()
|
||||
if (currentLockfile != null && !opts.ignorePackageManifest) {
|
||||
await prune(
|
||||
@@ -434,7 +425,7 @@ export default async (opts: HeadlessOptions) => {
|
||||
|
||||
if (!opts.ignoreScripts && !opts.ignorePackageManifest) {
|
||||
await runLifecycleHooksConcurrently(
|
||||
['install', 'postinstall', 'prepublish', 'prepare'],
|
||||
['preinstall', 'install', 'postinstall', 'prepublish', 'prepare'],
|
||||
opts.projects,
|
||||
opts.childConcurrency ?? 5,
|
||||
scriptsOpts
|
||||
|
||||
@@ -304,14 +304,6 @@ export async function mutateModules (
|
||||
stdio: opts.ownLifecycleHooksStdio,
|
||||
unsafePerm: opts.unsafePerm || false,
|
||||
}
|
||||
if (!opts.ignoreScripts) {
|
||||
await runLifecycleHooksConcurrently(
|
||||
['preinstall'],
|
||||
projectsToBeInstalled,
|
||||
opts.childConcurrency,
|
||||
scriptsOpts
|
||||
)
|
||||
}
|
||||
|
||||
// TODO: make it concurrent
|
||||
for (const project of ctx.projects) {
|
||||
@@ -467,7 +459,7 @@ export async function mutateModules (
|
||||
if (opts.enablePnp) {
|
||||
scriptsOpts.extraEnv = makeNodeRequireOption(path.join(opts.lockfileDir, '.pnp.cjs'))
|
||||
}
|
||||
await runLifecycleHooksConcurrently(['install', 'postinstall', 'prepare'],
|
||||
await runLifecycleHooksConcurrently(['preinstall', 'install', 'postinstall', 'prepare'],
|
||||
projectsToBeInstalled,
|
||||
opts.childConcurrency,
|
||||
scriptsOpts
|
||||
|
||||
Reference in New Issue
Block a user