Description
Description:
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
Activity
dmitry-shibanov commentedon Jun 28, 2022
Hello @RichiCoder1. Thank you for your feature request. Actually we had similar proposal to enable corepack by default. I think we should reinvestigate adding corepack support. We'll ping you about its results.
RichiCoder1 commentedon Jun 28, 2022
@dmitry-shibanov apologies for not seeing that closed ticket! I very much hope ya'll do. While technically experimental, it's being officially recommended and there's no (current) way to use both this action and corepack without some awkward contortions. Looking forward to the outcome!
tisonkun commentedon Aug 16, 2022
I use corepack locally and hope we can integrate it with GitHub Actions :)
brcrista commentedon Aug 16, 2022
If I'm understanding correctly, right now you can run
setup-node
, set up Corepack, and then run the standalonecache
action. So is the benefit of this just to be able to do it all inside thesetup-node
action?tisonkun commentedon Aug 16, 2022
Thank @brcrista ! Could you share a minimal config to achieve this? I may not understand how to set up corepack manually here.
brcrista commentedon Aug 16, 2022
I don't know either, I was just summarizing my understanding from the issue description.
RichiCoder1 commentedon Aug 16, 2022
The semi-simple way w/ caching and something like pnpm would be:
I think that may be faintly fragile as
corepack enable
operates on the built in node and not the potentially installed one. It does however fix an issue wheresetup-node
will look for apnpm
exe/cache that doesn't exist yet when setting up cache I think.RichiCoder1 commentedon Aug 16, 2022
@brcrista and your understanding is correct. Ideally with some extra smarts enabled by knowing exactly which packageManager is in use.
dsame commentedon Aug 17, 2022
@RichiCoder1 thanks for you notification, it was a good point to review, but we should not go ahead of nodejs team and turn on corepack by default while it is not default for the nodejs itself.
The consequences of having corepack enabled are risky for some builds and adding new input is not necessary complication of the action and its documentation.
In the current state of the corepack to have an explicit simple step enabling the feature seems to be optimal solution.
I have to reject the feature request and close the issue, but please feel free to reopen it or create new one in case you still have some problems.
81 remaining items