mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
fix: install dependencies execute preprepare and postprepare scripts (#8989)
* fix: install dependencies execute preprepare script * chore: remove unnecessary code * fix: postprepare should run --------- Co-authored-by: Zoltan Kochan <z@kochan.io>
This commit is contained in:
7
.changeset/eighty-lemons-rule.md
Normal file
7
.changeset/eighty-lemons-rule.md
Normal file
@@ -0,0 +1,7 @@
|
||||
---
|
||||
"@pnpm/headless": patch
|
||||
"@pnpm/core": patch
|
||||
pnpm: patch
|
||||
---
|
||||
|
||||
When running `pnpm install`, the `preprepare` and `postprepare` scripts of the project should be executed [#8989](https://github.com/pnpm/pnpm/pull/8989).
|
||||
@@ -179,6 +179,7 @@
|
||||
"postbuild",
|
||||
"postfoo",
|
||||
"postpack",
|
||||
"postprepare",
|
||||
"postpublish",
|
||||
"postrestart",
|
||||
"postshrinkwrap",
|
||||
|
||||
@@ -1268,7 +1268,7 @@ const _installInContext: InstallFunction = async (projects, ctx, opts) => {
|
||||
}
|
||||
}
|
||||
const projectsToBeBuilt = projectsWithTargetDirs.filter(({ mutation }) => mutation === 'install') as ProjectToBeInstalled[]
|
||||
await runLifecycleHooksConcurrently(['preinstall', 'install', 'postinstall', 'prepare'],
|
||||
await runLifecycleHooksConcurrently(['preinstall', 'install', 'postinstall', 'preprepare', 'prepare', 'postprepare'],
|
||||
projectsToBeBuilt,
|
||||
opts.childConcurrency,
|
||||
opts.scriptsOpts
|
||||
|
||||
@@ -134,11 +134,13 @@ test('run install scripts in the current project', async () => {
|
||||
install: `node -e "console.log('install-' + process.cwd())" | ${server.generateSendStdinScript()}`,
|
||||
postinstall: `node -e "console.log('postinstall-' + process.cwd())" | ${server.generateSendStdinScript()}`,
|
||||
preinstall: `node -e "console.log('preinstall-' + process.cwd())" | ${server.generateSendStdinScript()}`,
|
||||
preprepare: `node -e "console.log('preprepare-' + process.cwd())" | ${server.generateSendStdinScript()}`,
|
||||
postprepare: `node -e "console.log('postprepare-' + process.cwd())" | ${server.generateSendStdinScript()}`,
|
||||
},
|
||||
}, [], testDefaults({ fastUnpack: false }))
|
||||
await install(manifest, testDefaults({ fastUnpack: false }))
|
||||
|
||||
expect(server.getLines()).toStrictEqual([`preinstall-${process.cwd()}`, `install-${process.cwd()}`, `postinstall-${process.cwd()}`])
|
||||
expect(server.getLines()).toStrictEqual([`preinstall-${process.cwd()}`, `install-${process.cwd()}`, `postinstall-${process.cwd()}`, `preprepare-${process.cwd()}`, `postprepare-${process.cwd()}`])
|
||||
expect(serverForDevPreinstall.getLines()).toStrictEqual([
|
||||
// The pnpm:devPreinstall script runs twice in this test. Once for the
|
||||
// initial "addDependenciesToPackage" test setup stage and again for the
|
||||
|
||||
@@ -651,7 +651,7 @@ export async function headlessInstall (opts: HeadlessOptions): Promise<Installat
|
||||
|
||||
if (!opts.ignoreScripts && !opts.ignorePackageManifest) {
|
||||
await runLifecycleHooksConcurrently(
|
||||
['preinstall', 'install', 'postinstall', 'prepare'],
|
||||
['preinstall', 'install', 'postinstall', 'preprepare', 'prepare', 'postprepare'],
|
||||
projectsToBeBuilt,
|
||||
opts.childConcurrency ?? 5,
|
||||
scriptsOpts
|
||||
|
||||
Reference in New Issue
Block a user