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

[BUG] on npm install npm does not run the prepublish scripts in workspace packages. #3065

Closed
michalczaplinski opened this issue Apr 12, 2021 · 3 comments
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release

Comments

@michalczaplinski
Copy link

Current Behavior:

Repo has workspace packages like:

├── package.json
└── packages
    └── a
        └── package.json

Workspaces are defined like:

// root package.json
"workspaces": [
  "packages/*"
]

Package a has a prepublish script:

"scripts": {
  "prepublish": "touch a-prepublish"
},

then when running npm install at root, the prepublish script does not run.

Expected Behavior:

The prepublish script should run on npm install in all of the packages that are specified as workspace packages.

Steps To Reproduce:

https://github.com/michalczaplinski/npm-bug-repro

run npm install at root of the repo.

You can verify that the file a-prepublish file was not created in the package a.

Environment:

> npm -v
7.9.0
> node -v
v15.11.0
@michalczaplinski michalczaplinski added Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release labels Apr 12, 2021
@timoxley
Copy link
Contributor

I think the prepublish script might be going/gone away, but it's currently the only way to make package build scripts actually work with workspaces.

See #3034 for a similar issue I was experiencing.

@wraithgar
Copy link
Member

npm install does not currently support workspaces. It is being worked on right now, and script ordering will be something that is handled correctly when it does ship.

@wraithgar
Copy link
Member

You can follow the progress of adding workspace support to all of arborist's reify commands in the cli here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 7.x work is associated with a specific npm 7 release
Projects
None yet
Development

No branches or pull requests

3 participants