Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Install script should allow passing only major.minor as a version parameter #1147

Open
mgolebiowski opened this issue Jan 22, 2022 · 2 comments

Comments

@mgolebiowski
Copy link

Having to specify the PATCH part of the version shouldn't be necessary, Both yarn set version and npm install -g yarn@1 properly resolve to the newest version based on the part user specified (1.22 -> 1.22.17 etc.) and having the same feature in the install script would be really nice.

curl -o- -L https://yarnpkg.com/install.sh | bash -s -- --version 1.22

Should install 1.22.$latest

@Haroenv
Copy link
Member

Haroenv commented Jan 24, 2022

The install file is here: https://github.com/yarnpkg/website/blob/master/install.sh

@mgolebiowski
Copy link
Author

The easiest way would be to resolve the version using npm, something like

npm view yarn@$1 version | tail -n1 | grep -o "'.*'" | cut -d "'" -f2

Here you can check how the npm solution could look like: mgolebiowski@b8d64d5

If we don't want to use npm, we could follow yarn set version that is using GitHub API[0], this would require parsing the JSON output as well as finding the correct tag to generate the URL.

[0] https://github.com/yarnpkg/yarn/blob/3119382885ea373d3c13d6a846de743eca8c914b/src/cli/commands/policies.js#L52-L55

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

No branches or pull requests

2 participants