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 yarn version check on startup #1138
Comments
I love this, but I'd prefer not to have a prompt to upgrade (or at least a config flag to turn that behavior off). The Thanks for the great work! |
Big fan of this idea |
Love this idea. In case it offers any inspiration, we use https://github.com/yeoman/update-notifier for start-up based update notifications in a few different CLI projects. I think you might be trying to do something a little more custom in each case given you would like to stick closely to the installation method originally used to install yarn. |
@addyosmani - Yeah, I saw that (someone linked to it in another issue somewhere) but it looks tightly-coupled to npm. I wonder if we could use the UI of it while customising the backend. In our case, we have an endpoint https://yarnpkg.com/latest-version that returns the version number, so a lot of the complexity (ie. checking version number from npm) doesn't exist for us. It should be fairly straightforward 😄 |
@Daniel15 please make a PR for this. Can we somehow add a token to every build indicating the install method? I think that's way better than any sort of inference we might do. |
Sgtm @Daniel15 :) I'll loop in @sindresorhus just in case he's interested in generalizing update-notifier (or similar) to work better with yarn (even if it may not get used here). |
I'll try to do that when I get some time to work on it (perhaps a week or two from now), I just thought I'd post the idea while it's still fresh in my mind. If anyone else wants to work on this and it's unassigned on Github, feel free to pick it up (I'll assign it to me if I start working on it) 😄 |
Yeah, that sounds like the best idea. It'd help with #942 (if we want to implement that) too. |
I don't think I'm thinking the output text could be:
Having the command on a separate line makes it easier to copy-paste for users.
The |
Thanks for your insight, @sindresorhus!
This is a great idea, better than showing the notification / asking about it before running the tool. |
Created #1429 to fix this, pending approval. |
… version available (#1429) * Add automatic check for updates that nags the user when there's a new version available - fixes #1138 * remove self-update * add support for updating yarn to tarball installer * use new installationMethod package.json value to output update command * address comments from @Daniel15 * remove self update tests
Where is it?…
But |
The check only runs once per day, so it might not have ran yet. |
Still no:
|
Do you want to request a feature or report a bug?
Feature
What is the current behavior?
Yarn does not notify the user that a new version of Yarn is available
What is the expected behavior?
Yarn should periodically check for new version on startup. Maybe once per day. You can get the latest version number by hitting
https://yarnpkg.com/latest-version
.If the latest version is newer than the current version, display a message with the new version number, and instructions on how to update. Optionally, if the user is using a TTY (ie. they're not piping the output elsewhere or running Yarn from a script), we could prompt if they want to upgrade right away:
This would use
yarn update-self
once it's updated to use the same installation method originally used (#1139).For an initial version, we could just show instructions on how to update. Important: These instructions should correspond to the installation method the user used to install Yarn.
For example, on Debian or Ubuntu:
On Windows when using the Windows installer:
On Mac OS:
When installed via npm:
Currently we don't actually record the installation method anywhere, so I think we'll just have to guess it based on the environment (eg. if
/usr/share/lintian/overrides/yarn
exists, the Ubuntu/Debian package was used) unless we update all the installation methods to write a config file specifying the installation method.If we can't tell which installation method was used, just print the new version number without the upgrade instructions.
The text was updated successfully, but these errors were encountered: