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

Add --version flag to install script #1928

Merged
merged 3 commits into from
Nov 18, 2016
Merged

Conversation

naganowl
Copy link
Contributor

Summary

Adds a --version flag to the installation script, expanding on the nightly flag added in #1554. When provided, the script will download the specified build of Yarn, rather than the stable released version. It grabs them from the downloads directory as specified in #1724 (comment) and updates the version check to reflect if the user has installed the same version (regardless of flags provided) in the user's home directory. The speed of this script is ~1 minute faster compared to using npm and provides an alternative to switching versions to help with #1724 as well.

Test plan

./install-latest.sh gets latest release version (0.16.1), ./install-latest.sh --nightly gets latest nightly build (0.18.0-20161117.1624 right now), ./install-latest.sh --version 0.17.4 installs 0.17.4.

@naganowl
Copy link
Contributor Author

I'm open to renaming the install script (since it no longer installs the latest), but didn't want to make such a sweeping change yet.

@@ -107,16 +109,24 @@ yarn_install() {

if [ -d "$HOME/.yarn" ]; then
if [ -n `which yarn` ]; then
local SPECIFIED_VERSION
local VERSION_TYPE
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you use local for these but latest_url doesn't use it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Totally forgot about it, good catch!

if [ "$1" = '--nightly' ]; then
latest_url=https://nightly.yarnpkg.com/latest-tar-version
SPECIFIED_VERSION=`curl $latest_url`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use lowercase for variables (I know, I messed this up in some files, I need to fix it 😛 ). Apparently uppercase is generally only used for environment variables.

@Daniel15
Copy link
Member

This is awesome! Thank you!

naganowl added a commit to naganowl/website that referenced this pull request Nov 18, 2016
@Daniel15 Daniel15 merged commit 5be113b into yarnpkg:master Nov 18, 2016
Daniel15 pushed a commit to yarnpkg/website that referenced this pull request Nov 18, 2016
…273)

* Add docs for using the `--version` flag with the installation script

Document how to use the changes per yarnpkg/yarn#1928

* Actually pass arguments to the script rather than curl
lovelypuppy0607 added a commit to lovelypuppy0607/website that referenced this pull request May 11, 2023
…(#273)

* Add docs for using the `--version` flag with the installation script

Document how to use the changes per yarnpkg/yarn#1928

* Actually pass arguments to the script rather than curl
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

Successfully merging this pull request may close these issues.

2 participants