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

add cache commands "ls" and "rm" #3592

Merged
merged 1 commit into from
Aug 18, 2021

Conversation

fritzy
Copy link
Contributor

@fritzy fritzy commented Jul 29, 2021

This adds the ability to list and delete cached package downloads.

ls [<package>@<version query>]
Lists all cache keys, or keys related to certain package specs. Filtered results are best effort based on both existing packuments in cache (further resolving package keys) as well as a fallback to filtering tgz packages based on URL.
Any number of packages can be specified.
Packuments cache keys match on any version spec.

rm [<key>] (alias of clean)
Removes any number of keys

I extended clean to accept any number of cacache keys. Zero arguments still removes everything and requires --force.

@fritzy fritzy requested a review from a team as a code owner July 29, 2021 05:49
lib/cache.js Outdated Show resolved Hide resolved
lib/cache.js Outdated Show resolved Hide resolved
lib/cache.js Outdated Show resolved Hide resolved
@fritzy fritzy marked this pull request as draft July 29, 2021 17:02
@darcyclarke darcyclarke added Release 7.x work is associated with a specific npm 7 release semver:minor new backwards-compatible feature labels Aug 5, 2021
@darcyclarke darcyclarke added this to the OSS - Sprint 35 milestone Aug 9, 2021
@fritzy
Copy link
Contributor Author

fritzy commented Aug 11, 2021

Additionally I fixed unscoped packages from matching scoped packages in npm cache ls --package name

@fritzy
Copy link
Contributor Author

fritzy commented Aug 12, 2021

I've finished the test coverage, so this is now ready for review.

@fritzy fritzy marked this pull request as ready for review August 12, 2021 04:03
@fritzy fritzy changed the title add cache commands "ls" and "delete" add cache commands "ls" and "rm" Aug 12, 2021
lib/cache.js Outdated Show resolved Hide resolved
@wraithgar wraithgar changed the base branch from latest to release-next August 12, 2021 15:45
@darcyclarke darcyclarke requested a review from nlf August 12, 2021 16:42
test/lib/cache.js Outdated Show resolved Hide resolved
lib/cache.js Outdated Show resolved Hide resolved
Copy link
Contributor

@nlf nlf left a comment

Choose a reason for hiding this comment

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

in addition to the comments above, one last thing:

the params static getter should have 'package' added to it, that'll make sure that when docs are generated it will list the --package flag as one in use by this command

lib/cache.js Outdated Show resolved Hide resolved
lib/cache.js Outdated Show resolved Hide resolved
lib/cache.js Outdated Show resolved Hide resolved
lib/cache.js Show resolved Hide resolved
Copy link
Contributor

@nlf nlf left a comment

Choose a reason for hiding this comment

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

looks great!

@fritzy fritzy force-pushed the fritzy/cache-ls-delete branch from 957c5ac to 03bb4c5 Compare August 18, 2021 20:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Release 7.x work is associated with a specific npm 7 release semver:minor new backwards-compatible feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants