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] All workspaces require script during npm run * --workspaces #3043

Closed
krpeacock opened this issue Apr 7, 2021 · 1 comment
Closed
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

@krpeacock
Copy link

Current Behavior:

I have a package with three workspaces - 2 packages, and a directory with end-to-end tests depending on them.

Currently, if my packages have a build script, I would like to run npm run build --workspaces. If my e2e workspace doesn't have a build script, the command fails. My workaround is that I have to add a blank "build": "" script to enable that, and to do the same for any other command I'd like to run in multiple but not all workspaces.

Expected Behavior:

npm run * --workspaces will run the command in every package that has that script, and will ignore packages without that script.

Steps To Reproduce:

Environment:

OS: Mac 10.15.7
npm: 7.8.0
node: v14.15.5

@krpeacock krpeacock 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 7, 2021
@wraithgar
Copy link
Member

wraithgar commented Apr 20, 2021

The --if-present flag is what you want to enable if a given script is potentially going to be missing, and you don't want run-script to error out in that situation.

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

2 participants