-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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] npm i
in workspace runs prepare script concurrently
#4100
Comments
If anyone is able to provide a workaround to this I'd really appreciate it. |
It's been over a week since I've posted this. Can I please get a reply here? This is a major blocker for me. |
@ljharb Sorry to tag you randomly here. I notice you've been pretty active in replying to other issues. Is there any chance you could point me in the right direction here? Who on the npm team would be best to assist here? This is a major blocker for my project currently. Thanks in advance!! |
I'm not sure who's owning workspaces atm, sorry. |
Hey @fishcharlie thanks for your patience. Had to coordinate between a couple people being out of office to get an answer The docs you linked are referring to running commands in workspaces, not the internal lifecycle scripts that happen during reification. So for instance if you were to run As far as deterministically ordering |
@MylesBorins Thanks for the reply!
Got it. I think the documentation can be improved in this regard to make that more clear.
I guess this leads to a question about how I should be doing this instead? I don't think my use case and what I'm trying to achieve is that out there (with having a workspace, with a primary project and dependencies, all in TypeScript). If you look at the npm documentation for prepare, once of the use cases listed is: However, because my primary package in my workspace has a dependency on the build step from the utilities package being complete first, that leads to the issues mentioned here. So is there something I should change in my workspace settings to do this correctly?
Although I understand the deadlocking situation presented in #3034, it's just as valid to not have circular dependencies, and require the It sounds like a workaround would be to use Although everything you said makes sense, I'm still super confused about how to handle this for dynamoose. I understand that this is getting out of the scope of "it's a bug" and getting into more of "how should I handle this", which might be out of scope for GitHub Issues. But I do think my situation is a common/valid use case that npm needs to support or consider. |
@MylesBorins Following up on this. Is there anything I can clarify in my previous message? |
Running I'm removing the bug label but keeping this open with the following action items:
|
Are you clear on how big of a damper this is on the usefulness of workspaces? In TypeScript setups, or sets of modules that use
{"workspaces": ["b", "a"]}
{
"name": "test-a",
"version": "1.0.0",
"scripts": {
"prepare": "echo prep A"
}
}
{
"name": "test-b",
"version": "1.0.0",
"scripts": {
"prepare": "echo prep B"
}
} If I run |
Is there an existing issue for this?
This issue exists in the latest npm version
Current Behavior
npm i
runs Prepare script concurrently across all workspaces.This causes major problems when using TypeScript and having one workspace dependent on another, since the build (prepare script) runs concurrently, there is no way to ensure the prepare command is done on one workspace before running on the next.
Expected Behavior
It to actually follow what the documentation says (https://docs.npmjs.com/cli/v7/using-npm/workspaces#running-commands-in-the-context-of-workspaces):
Nothing in there says anything about commands being run concurrently, or at the same time.
Steps To Reproduce
npm i
Environment
The text was updated successfully, but these errors were encountered: