Skip to content

corepack cleanup cache #114

@styfle

Description

@styfle

If the local project is configured for the package manager you're using, Corepack will silently download and cache the latest compatible version.

Does corepack provide any way to delete the cache?

The use case I'm thinking of is CI/CD where you want to set COREPACK_HOME to a cached directory. However, unlike node_modules, it doesn't seem like this directory is ever pruned or cleaned up since its shared between many projects.

On a local machine, its probably fine to just periodically delete it. But for CI/CD, the project is only ever using one version of a package manager so its safe to prune old or unused versions.

For perspective, pnpm versions released in the last 30 days (>=7.0.0) amount to 180 MB. I imagine this will reach GB very quickly.

I'm thinking this can be solved with a new command:

 # delete all except current version defined in package.json
corepack cache clean

# delete all versions that have not been invoked for 30 days
corepack cache clean --before 30d

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions