Corepack Support
See original GitHub issueDescription: Support using https://github.com/nodejs/corepack to manage non-NPM package managers.
Ideally in between installing node and bootstrapping the package manager cache, this action:
- enables corepack (could be a no-op depending on the node version)
- caches/restores the corepack root
- runs
corepack prepare --active
(after some research, that last one may not necessary but instead makes an implicit step explicit)
This behavior could either be trigged by the presence of the packageManager
field in the root package.json
(might be suprising), cache: 'auto'
as possibly envisioned in #306, or corepack: true
Justification:
Both pnpm and yarn support corepack, and yarn recommendeds corepack for package manager versioning. Currently using corepack with this action will break when using the cache
key as this action assumes the appropriate version manager has already been installed. However, you don’t necessarily want to bootstrap with corepack until the appropriate node version has been installed and configured.
Are you willing to submit a PR? Yes
Issue Analytics
- State:
- Created a year ago
- Reactions:32
- Comments:21 (5 by maintainers)
Top GitHub Comments
@tisonkun you’re not even using setup-node…
Ideally, setup-node optionally supports corepack, since Node optionally supports it. For example:
This would install Node 16, run
corepack enable
, read the packageManager field, set up the cache for that, and then call the package manager in the correct way for CI (npm ci
,pnpm i
etc).I am surprised that this is actually an issue, corepack is still in the experimental stage and of course needs to be manually enabled. I myself have been using
corepack enable && corepack prepare pnpm@7.11.0 --activate
.This issue should actually be closed and wait for nodejs to enable corepack by default.