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

fix(ci): rm workspace node_modules #7490

Merged
merged 18 commits into from
May 23, 2024
Merged

fix(ci): rm workspace node_modules #7490

merged 18 commits into from
May 23, 2024

Conversation

reggi
Copy link
Contributor

@reggi reggi commented May 8, 2024

Fixes #7226, an issue where the npm ci needs to remove node_modules within workspace directories.

lib/base-cmd.js Outdated Show resolved Hide resolved
@npm-cli-bot
Copy link
Collaborator

npm-cli-bot commented May 13, 2024

no statistically significant performance changes detected

timing results
app-large clean lock-only cache-only modules-only no-lock no-cache no-modules no-clean show-version run-script cache-only
peer-deps
no-clean
audit
npm@latest 31.277 ±0.66 10.773 ±0.03 11.725 ±0.07 1.533 ±0.02 1.543 ±0.00 1.271 ±0.01 8.303 ±0.01 1.261 ±0.01 0.137 ±0.00 0.169 ±0.01 14.928 ±0.17 2.096 ±0.00
#7490 33.998 ±2.64 10.665 ±0.03 12.338 ±0.37 1.604 ±0.05 1.549 ±0.01 1.294 ±0.01 8.403 ±0.01 1.276 ±0.01 0.137 ±0.00 0.164 ±0.00 14.636 ±0.20 2.116 ±0.04
app-medium clean lock-only cache-only modules-only no-lock no-cache no-modules no-clean show-version run-script cache-only
peer-deps
no-clean
audit
npm@latest 24.931 ±0.50 8.021 ±0.01 8.891 ±0.04 1.493 ±0.01 1.490 ±0.01 1.395 ±0.01 5.771 ±0.05 1.295 ±0.01 0.137 ±0.00 0.164 ±0.00 9.952 ±0.02 1.993 ±0.08
#7490 25.700 ±2.44 8.172 ±0.13 8.972 ±0.06 1.524 ±0.00 1.540 ±0.03 1.403 ±0.01 5.843 ±0.02 1.291 ±0.01 0.138 ±0.00 0.164 ±0.00 9.932 ±0.05 2.053 ±0.10

lib/commands/ci.js Outdated Show resolved Hide resolved
lib/commands/ci.js Outdated Show resolved Hide resolved
lib/commands/ci.js Outdated Show resolved Hide resolved
lib/commands/ci.js Outdated Show resolved Hide resolved
@reggi reggi changed the title fix(ci): rm workspace node_modules fix(ci): rm workspace node_modules May 14, 2024
@reggi reggi marked this pull request as ready for review May 14, 2024 17:03
@reggi reggi requested a review from a team as a code owner May 14, 2024 17:03
Copy link
Contributor

@lukekarrys lukekarrys left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CI extends ArboristWorkspaceCmd which will call this.setWorkspaces() and then this.exec(). So we can check if this.workspacePaths is set and use that instead of calling getWorkspaces directly. Also ArboristWorkspaceCmd will always set includeWorkspaceRoot: false so we need to explicitly include where.

We need to do this because you can run npm ci -w workspace-a and have it only install the deps for workspace-a but you can't guarantee that the root node_modules won't end up populated. So in fixing this bug we want to make sure that we only rm -rf the node_modules specified by the workspace config, plus the root.

lib/commands/ci.js Show resolved Hide resolved
lib/commands/ci.js Outdated Show resolved Hide resolved
lib/commands/ci.js Outdated Show resolved Hide resolved
lib/commands/ci.js Outdated Show resolved Hide resolved
lib/commands/ci.js Outdated Show resolved Hide resolved
@reggi reggi merged commit 7d89b55 into latest May 23, 2024
39 checks passed
@reggi reggi deleted the reggi/ci-rm-ws-modules branch May 23, 2024 17:33
@github-actions github-actions bot mentioned this pull request May 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[BUG] npm ci does not remove/recreate existing node_modules inside workspaces
5 participants