mirror of
https://github.com/pnpm/pnpm.git
synced 2026-04-10 18:18:56 -04:00
feat!: do not execute prepublish during installation (#3306)
* feat!: do not execute `prepublish` during installation * test: fix
This commit is contained in:
5
.changeset/three-dodos-fail.md
Normal file
5
.changeset/three-dodos-fail.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"supi": minor
|
||||
---
|
||||
|
||||
Do not execute prepublish during installation.
|
||||
@@ -633,11 +633,9 @@ test('recursive install with shared-workspace-lockfile builds workspace projects
|
||||
expect(outputs1).toStrictEqual([
|
||||
'project-999-install',
|
||||
'project-999-postinstall',
|
||||
'project-999-prepublish',
|
||||
'project-999-prepare',
|
||||
'project-1-install',
|
||||
'project-1-postinstall',
|
||||
'project-1-prepublish',
|
||||
'project-1-prepare',
|
||||
])
|
||||
|
||||
@@ -645,11 +643,9 @@ test('recursive install with shared-workspace-lockfile builds workspace projects
|
||||
expect(outputs2).toStrictEqual([
|
||||
'project-999-install',
|
||||
'project-999-postinstall',
|
||||
'project-999-prepublish',
|
||||
'project-999-prepare',
|
||||
'project-2-install',
|
||||
'project-2-postinstall',
|
||||
'project-2-prepublish',
|
||||
'project-2-prepare',
|
||||
])
|
||||
}
|
||||
@@ -666,11 +662,9 @@ test('recursive install with shared-workspace-lockfile builds workspace projects
|
||||
expect(outputs1).toStrictEqual([
|
||||
'project-999-install',
|
||||
'project-999-postinstall',
|
||||
'project-999-prepublish',
|
||||
'project-999-prepare',
|
||||
'project-1-install',
|
||||
'project-1-postinstall',
|
||||
'project-1-prepublish',
|
||||
'project-1-prepare',
|
||||
])
|
||||
|
||||
@@ -678,11 +672,9 @@ test('recursive install with shared-workspace-lockfile builds workspace projects
|
||||
expect(outputs2).toStrictEqual([
|
||||
'project-999-install',
|
||||
'project-999-postinstall',
|
||||
'project-999-prepublish',
|
||||
'project-999-prepare',
|
||||
'project-2-install',
|
||||
'project-2-postinstall',
|
||||
'project-2-prepublish',
|
||||
'project-2-prepare',
|
||||
])
|
||||
}
|
||||
|
||||
@@ -408,9 +408,8 @@ export async function mutateModules (
|
||||
if (ctx.wantedLockfile?.importers) {
|
||||
forgetResolutionsOfPrevWantedDeps(ctx.wantedLockfile.importers[project.id], wantedDependencies)
|
||||
}
|
||||
const scripts = opts.ignoreScripts ? {} : (project.manifest?.scripts ?? {})
|
||||
if (opts.ignoreScripts && project.manifest?.scripts &&
|
||||
(project.manifest.scripts.preinstall || project.manifest.scripts.prepublish ||
|
||||
(project.manifest.scripts.preinstall ||
|
||||
project.manifest.scripts.install ||
|
||||
project.manifest.scripts.postinstall ||
|
||||
project.manifest.scripts.prepare)
|
||||
@@ -418,12 +417,6 @@ export async function mutateModules (
|
||||
ctx.pendingBuilds.push(project.id)
|
||||
}
|
||||
|
||||
if (scripts['prepublish']) { // eslint-disable-line @typescript-eslint/dot-notation
|
||||
logger.warn({
|
||||
message: '`prepublish` scripts are deprecated. Use `prepare` for build steps and `prepublishOnly` for upload-only.',
|
||||
prefix: project.rootDir,
|
||||
})
|
||||
}
|
||||
projectsToInstall.push({
|
||||
pruneDirectDependencies: false,
|
||||
...project,
|
||||
@@ -474,7 +467,7 @@ export async function mutateModules (
|
||||
if (opts.enablePnp) {
|
||||
scriptsOpts.extraEnv = makeNodeRequireOption(path.join(opts.lockfileDir, '.pnp.cjs'))
|
||||
}
|
||||
await runLifecycleHooksConcurrently(['install', 'postinstall', 'prepublish', 'prepare'],
|
||||
await runLifecycleHooksConcurrently(['install', 'postinstall', 'prepare'],
|
||||
projectsToBeInstalled,
|
||||
opts.childConcurrency,
|
||||
scriptsOpts
|
||||
|
||||
Reference in New Issue
Block a user