Skip to content
This repository has been archived by the owner on Aug 13, 2022. It is now read-only.

Yarn v2 Support #10

Closed
br0p0p opened this issue Jun 11, 2021 · 5 comments · Fixed by #11
Closed

Yarn v2 Support #10

br0p0p opened this issue Jun 11, 2021 · 5 comments · Fixed by #11

Comments

@br0p0p
Copy link
Contributor

br0p0p commented Jun 11, 2021

Hi, I forked this to add Yarn v2 support.

I think the best solution would be to merge that here and either create a new branch with Yarn v2 support or determine the Yarn version in the code and call either yarn cache dir or yarn config get cacheFolder whether Yarn v1 or v2 is detected, respectively.

What are your thoughts?

@thisismydesign
Copy link
Member

Thanks!

Linking the fork for reference: https://github.com/br0p0p/gha-yarn-cache

What does Yarn v2 respond to yarn cache dir? Maybe if this part returns empty then we could try the v2 syntax?

@br0p0p
Copy link
Contributor Author

br0p0p commented Jun 13, 2021

Running yarn cache dir with Yarn v2 errors:

Unknown Syntax Error: Command not found; did you mean:

$ yarn cache clean [--mirror] [--all]
While running cache dir

However running yarn config get cacheFolder with v1 results in

undefined

@br0p0p
Copy link
Contributor Author

br0p0p commented Jun 14, 2021

so, the v2 command (yarn config get cacheFolder) could be the default and the v1 command (yarn cache dir) could be the fallback if the first result is undefined

@thisismydesign
Copy link
Member

Yes! If you're up for submitting a PR I'd be happy to release a v2 with this functionality.

@thisismydesign
Copy link
Member

@br0p0p v2 released: https://github.com/c-hive/gha-yarn-cache/releases/tag/v2 Let me know if it works for you.

Thanks for your help!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants