Repository navigation
feature request: cache: 'auto' #306
Description
Activity
Hello @privatenumber , we have discussed it in past but looks like we can't determine package manager unequivocally.
For example,yarn.lockcan be generated and used for both Yarn and NPM 7.IMO that's an extra option we get to choose from rather than a blocking problem:
package-lock.json=> npm
pnpm-lock.yaml=> pnpm
yarn.lock=> yarn or npm, but yarn is likely the safer optionConsider using Stack Overflow, or at least a separate Issue, for help.
If the target is a project that uses corepack, it can be uniquely identified.
- addedfeature requestNew feature or request to improve the current logicNew feature or request to improve the current logic
on Dec 10, 2021 I suggest using the
preferred-pmpackage (with corepack preferably). It's already used by pnpm and Astro, so adopting it would make the action's behavior more consistent with other JavaScript tools. It also inspects what files exist innode_modules, which in some cases can clear up ambiguity when different lockfiles are used. That being said, I don't think it's good practice to have multiple lockfiles committed to one repository anyway.Hello everyone. For now I'm going to close the issue because as it was described some dependency files can be used for both package managers. Besides, for some customers it can be inconvenient about which package manager is used.
Reacted by Nicky McCurdyBut the
preferred-pmpackage would solve this problem, as I explained. And what's inconvenient?The reason for closing is very vague and weak.
I agree
preferred-pmsolves this issue. The logic is straightforward: https://github.com/zkochan/packages/blob/master/preferred-pm/index.jsThe
packageManagerproperty inpackage.json(from Corepack) also indicates which package manager should be used.There are plenty of signals already used by the community.
Please re-open.Reacted by Nicky McCurdy, ChrisPage-AT, Daniel Bayley, Guy Carmeli and Christian BewernitzIf we can't have this in this action officially, I'm going to fork it. However if the maintainers are willing to reopen this, it would be nice to not cause further fragmentation.
I would like to request that "automatic detection" mode be supported for the
cacheoption.The option would check whether the following files exists to determine which caching option (or package manager) to use:
package-lock.json=> npmyarn.lock=> yarnpnpm-lock.yaml=> pnpm