Skip to content

add package-lock modes to query and audit - #6732

Merged
wraithgar merged 2 commits into
latestfrom
gar/query-package-lock
Sep 11, 2023
Merged

add package-lock modes to query and audit#6732
wraithgar merged 2 commits into
latestfrom
gar/query-package-lock

Conversation

@wraithgar

Copy link
Copy Markdown
Contributor
  • feat: add package-lock-only mode to npm query
  • feat: add no-package-lock mode to npm audit

@wraithgar
wraithgar requested a review from a team as a code owner August 24, 2023 15:45
@wraithgar

Copy link
Copy Markdown
Contributor Author

Folks have been asking for this for a LONG time (the audit feature), this should definitely be backported to npm 9.

@npm-cli-bot

npm-cli-bot commented Aug 24, 2023

Copy link
Copy Markdown
Collaborator

found 18 benchmarks with statistically significant performance improvements

  • app-large: clean, lock-only, cache-only, cache-only:peer-deps, modules-only, no-lock, no-cache, no-modules, no-clean, no-clean:audit
  • app-medium: cache-only, cache-only:peer-deps, modules-only, no-lock, no-cache, no-modules, no-clean, no-clean:audit
timing results
app-large clean lock-only cache-only cache-only
peer-deps
modules-only no-lock no-cache no-modules no-clean no-clean
audit
show-version run-script
npm@9 35.348 ±2.17 18.932 ±0.13 18.377 ±0.17 21.134 ±0.98 2.949 ±0.14 2.844 ±0.04 2.424 ±0.07 12.404 ±0.15 2.383 ±0.02 3.518 ±0.15 0.420 ±0.01 0.465 ±0.01
#6732 0.100 ±0.00 0.103 ±0.01 0.100 ±0.00 0.100 ±0.00 0.103 ±0.00 0.109 ±0.01 0.102 ±0.00 0.102 ±0.00 0.106 ±0.01 0.103 ±0.00 0.412 ±0.00 0.462 ±0.01
app-medium clean lock-only cache-only cache-only
peer-deps
modules-only no-lock no-cache no-modules no-clean no-clean
audit
show-version run-script
npm@9 24.474 ±1.27 14.102 ±0.08 13.704 ±0.01 14.704 ±0.08 2.567 ±0.02 2.565 ±0.00 2.346 ±0.02 9.200 ±0.03 2.213 ±0.02 3.159 ±0.10 0.417 ±0.01 0.469 ±0.00
#6732 N/A N/A 0.102 ±0.00 0.104 ±0.00 0.101 ±0.00 0.104 ±0.00 0.102 ±0.00 0.104 ±0.00 0.102 ±0.00 0.103 ±0.00 0.413 ±0.01 0.456 ±0.00

@wraithgar
wraithgar force-pushed the gar/query-package-lock branch from 6328343 to 69ed983 Compare August 24, 2023 16:17

@bdehamer bdehamer left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For the query command, I noticed that you added the loadVirtual support to the exec function, but not the execWorkspaces function. Was that an oversight, or does the --package-lock-only option not work when using workspaces?

@wraithgar

Copy link
Copy Markdown
Contributor Author

That's an oversight. A lot of other commands' execWorkspaces just iterate workspaces and call exec directly. I'll update.

@wraithgar

Copy link
Copy Markdown
Contributor Author

Workspaces mode for npm query does not work as expected to begin with and I think adding this mode there gives a false sense of it working. Fixing npm query for workspace mode should be a separate PR.

Comment thread lib/commands/query.js
@wraithgar
wraithgar force-pushed the gar/query-package-lock branch from 69ed983 to 936a143 Compare September 11, 2023 18:00
@wraithgar
wraithgar merged commit 81a460f into latest Sep 11, 2023
@wraithgar
wraithgar deleted the gar/query-package-lock branch September 11, 2023 18:29
@github-actions github-actions Bot mentioned this pull request Sep 11, 2023
@lorand-horvath

Copy link
Copy Markdown

NICE !

ljharb added a commit to ljharb/aud that referenced this pull request Jul 31, 2024
Thanks for npm/cli#6732 !
@ljharb

ljharb commented Jul 31, 2024

Copy link
Copy Markdown
Contributor

Thanks for this; I've now end-of-lifed https://npmjs.com/aud since it's no longer needed.

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.

6 participants