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
Fix self-update #676
Fix self-update #676
Conversation
Nice! |
Yes I think so. @kittens can you have a look at kittens/roadrunner#1 ? |
@@ -38,6 +38,7 @@ export function getModuleCacheDirectory(): string { | |||
export const MODULE_CACHE_DIRECTORY = getModuleCacheDirectory(); | |||
export const LINK_REGISTRY_DIRECTORY = `${MODULE_CACHE_DIRECTORY}/.link`; | |||
export const GLOBAL_MODULE_DIRECTORY = `${MODULE_CACHE_DIRECTORY}/.global`; | |||
export const CACHE_FILENAME = path.join(userHome, '.yarn', '.roadrunner.json'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to use this variable in bin/yarn.js
, but afaics I cannot simple import this file there right? Currently this line is duplicate here and in bin/yarn.js
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.yarn is prone to change afaik.
There should be a constant with the folder name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can extract that to an other constant, but then still it wouldn't be usable in bin/yarn.js
I think.
return run(async (reporter, config) => { | ||
// mock an existing self-update | ||
await child.exec('make build'); | ||
await child.exec('npm run build'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is probably safe to assume that npm is available when running tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we do "kpm run build"? :)
For now, yeah, we can assume there is some npm version on the dev environment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you mean yarn
? :P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh yeah, kpm has been engraved in my brain now :)
const version = await child.exec('node bin/yarn.js -V'); | ||
expect(version[0].trim(), `0.11.0`); | ||
expect(version[0].trim(), '0.14.1'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to update the version as <0.14 was using the name kpm
in the release
|
||
expect(await fs.exists(path.resolve(updatesFolder, 'v0.98.0'))).toBe(false); | ||
expect(await fs.exists(path.resolve(updatesFolder, 'v0.99.0'))).toBe(true); | ||
expect(await fs.exists(path.resolve(updatesFolder, 'v0.11.0'))).toBe(true); | ||
expect(await fs.exists(path.resolve(updatesFolder, 'v0.15.0'))).toBe(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is updated to use 0.15 to check it picks the correct asset.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can remove all the Github API stuff from this. Instead of using the Github API, you can hit https://yarnpkg.com/latest-version to get the version number. Then you can simply hit https://yarnpkg.com/latest.tar.gz to get the latest tarball. Much simpler 😄 . There's also https://yarnpkg.com/downloads/{version}/{file}
for specific version.
Good point, @Daniel15, dropping Github wrapper from dependencies is good for size and startup performance. |
A good RFC discussion is how to enable self-update to be automatic. |
For what it's worth, updates are handled along with the rest of the operating system if you use the Linux package (Ubuntu/Debian/CentOS), that's one major advantage of using them and one of the main reasons we built them :) |
Well, I mean the other 99.5 percent of users who don't use Linux :) On 12 October 2016 at 20:29, Daniel Lo Nigro notifications@github.com
|
@bestander Chocolatey handles updates too I believe, so Windows users are covered too once our Chocolatey package is approved. The Windows dev userbase is larger than the Mac OS dev userbase 😛 . The Windows installer probably needs a proper auto-update too, that downloads the latest MSI and installs it. |
You don't expect every version of windows to install yarn with chocolatey? Some history: I added it here when we found that maintaining packages via yummy and Chef was too much hassle and it seemed like a reasonable idea to have a lightweight mechanism to get everyone on the same version within the org. As for the community project, I think we get quite a lot of benefits if most of users are getting updated to the latest stable whether it is done via package managers or via self-update. |
Also I am not a huge fan of this implementation, a bit too hacky |
For macOS probably adding yarn to brew might probably also make it easy to install and update there. How do we want to proceed with this PR? Should I do all the mentioned changes (not github etc.) and later you can still decide to remove/simplify it? |
Yeah, that sounds good to me! Sorry I went a little off-topic in the comments. Removing all the Github stuff should simplify it quite a bit :) |
@Daniel15 I don't know the implications of this but right now https://yarnpkg.com/latest-version does not list the latest version: $ yarn -V
0.15.1
$ curl -s https://yarnpkg.com/latest-version
0.15.0 |
Michael, could you file a bug? On 13 October 2016 at 11:23, Michael Stillwell notifications@github.com
|
This is probably because there was no release (in as a consequence no new tarball) created on github, only the tag in git. |
@bestander Sure, reported as #989. |
0.15.1 is not a "real" release, it was just a patch to the tarball and npm Sent from my phone. On Oct 13, 2016 3:51 AM, "Michael Stillwell" notifications@github.com
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me!
@@ -33,7 +32,7 @@ | |||
"request": "^2.75.0", | |||
"request-capture-har": "^1.1.4", | |||
"rimraf": "^2.5.0", | |||
"roadrunner": "^1.0.6", | |||
"roadrunner": "danez/roadrunner#patch-1", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we wait for a release of roadrunner before merging this?
@@ -2237,14 +2223,6 @@ getpass@^0.1.1: | |||
dependencies: | |||
assert-plus "^1.0.0" | |||
|
|||
github@2.5.1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍 🎉
The test are still failing, because of 0.15.1. The problem is that https://yarnpkg.com/latest-version says to 0.15.0, but when downloading latest.tar.gz the package.json in this archive says 0.15.1. Im gonna try instead of relying on the package.json instead see where the current symlink points. |
It's tricky because 0.15.1 is not a "real" release - It was just a fixed re-release of the npm package and tarball, but everything else (Windows installer, Linux packages) are still on 0.15.0 |
looking forward to this 👍 |
var path = require('path'); | ||
var CACHE_FILENAME = path.join(userHome, '.yarn', '.roadrunner.json'); | ||
mkdirp.sync(path.dirname(CACHE_FILENAME)); | ||
var constants = require('../lib-legacy/constants'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I now also require constants here from lib-legacy, so that I can use the folder constants. I think that shouldn't be a problem.
version "1.0.6" | ||
resolved "https://registry.yarnpkg.com/roadrunner/-/roadrunner-1.0.6.tgz#e466a15f9844289413d09943ad263574623ec1c9" | ||
resolved "https://codeload.github.com/danez/roadrunner/tar.gz/2ead9501e3681fa7584b79e6e6546fb046a83f54" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's push the change upstream before merging this.
I noticed that it is possible to download a certain version of yarn see #751 (comment) |
Let's keep it simple - It's totally fine to only support updating to the most recent version 😄 |
@danez you have a broken test:
|
CircleCI is not updating the dependencies :( |
I'll restart with cache clean |
Seems there is no step on circleCI to install dependencies? At least I can't see one. |
Yeah, odd, looks like cleaning all cache lost eslint and webpack. |
Created this one #1157 |
@danez, could you please rebase it? |
Pick the correct file to download in self-update We cannot rely that the first asset is always the tar file This picks the correct file from the assets Use dev version of roadrunner and reset it correctly Enable self-update tests
Seems circleCI is to slow to run the tests :/ The test is anyway really ugly, and involves building yarn, so not sure if we should keep it. |
Hm, I would assume that download gets stuck. What do you think of keeping this test disabled for a while and merge the rest? |
Okay I disabled it now, even after 3 minutes it was running into a timeout. As all the other downloads seem to be quiet fast it might also be the FS which is slow, and we copy a lot of stuff in this test. |
Thanks, @danez! |
This fixes self-update by doing:
current
gets reevaluatedThe roadrunner change is necessary as the tests need to invalidate the path cache so that the next test can reevaluate the symlinks. Same for the actual self-update command which also changes the symlink. This depends on kittens/roadrunner#1
Fixes #612
Docs: yarnpkg/website#173