Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pnpm:devPreinstall is not run when shared-workspace-lockfile is false #4503

Open
yseymour opened this issue Mar 30, 2022 · 1 comment · May be fixed by #8030
Open

pnpm:devPreinstall is not run when shared-workspace-lockfile is false #4503

yseymour opened this issue Mar 30, 2022 · 1 comment · May be fixed by #8030

Comments

@yseymour
Copy link

pnpm version:

6.32.3

Code to reproduce the issue:

.npmrc:

shared-workspace-lockfile=false

package.json:

{
  "scripts": { "pnpm:devPreinstall": "./my-command" }
}

pnpm-workspace.yaml:

projects:
  - my-project

Expected behavior:

pnpm i runs ./my-command

Actual behavior:

pnpm i does not run ./my-command. But if shared-workspace-lockfile is enabled, it does. I would have expected it to work in both cases, and there doesn't seem to be anything in the docs to suggest otherwise.

Additional information:

  • node -v prints: v16.14.0
  • Windows, macOS, or Linux?: Linux
@alvis
Copy link
Contributor

alvis commented Apr 28, 2024

It turns out the issue caused by this line setting ignoreScripts to true by default


in shared-workspace-lockfile=false setting, which in turn disabled pnpm:devPreinstall in this line
if (!opts.ignoreScripts && !opts.ignorePackageManifest && rootProjectManifest?.scripts?.[DEV_PREINSTALL]) {

alvis added a commit to alvis/pnpm that referenced this issue Apr 29, 2024
When `shared-workspace-lockfile` is false,
opts.ignoreScripts is set to true since packages
are rebuild after recursive install.
However, it will cause `pnpm:devPreinstall` to be
skipped as well since it's not part of the rebuild
process.

This fix fixes the issue by checking whether the
--ignore-scripts flag is set from the source
instead

fix pnpm#4503
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants