Did you search for similar issues before submitting this one?
Yes.
Facebook recently came out with new package management command line tool that works with the npm registry (https://yarnpkg.com/). It's much faster and produces deterministic builds. It would be awesome if it was an easy thing we could switch to using.
After an initial go at this here are my findings (on terrible hotel wifi):
yarn install (no cache)
6m 52s 33ms
npm install
8m 11s 17ms
yarn install (with cache)
3m 33s 51ms
It's really nice that Yarn keeps a local fs cache of everything you install so often times it doesn't need to fetch packages. Also it look like travis-ci has yarn and yarn-cache support (https://blog.travis-ci.com/2016-11-21-travis-ci-now-supports-yarn).
So if we were to move forward, I think it would be as simple as:
yarn command in browser-laptop to generate a yarn.lock file.What do you all think? @bbondy @bsclifton @ayumi @cezaraugusto
++! I've been using it for brave/sync. I think it's good.
does everything work correctly including native modules?
Last time I tried it on Brave's repo (around the time Facebook released 0.15.1) it was not working at all.
It skipped the steps where modules are being built from source and had a problem with optional dependencies that should not be installed (I have opened a ticket, idk if it was resolved https://github.com/yarnpkg/yarn/issues/705). Meaning you can't install with yarn on Windows or Linux because of dependencies that were being installed and were only working on Mac.
It could get better since then, but I suggest to not move to it unless tested very well on every platform. There is no reason to move out of NPM, just to save 2 sec of build time.
Although it'd be nice, it's not a priority for us short term. Would accept PRs that support it though.
On first take everything appears to be working. I'll play around with it this weekend and either close or submit a PR.
Very cool :heart:
It seems it works great for macOS, the problem might be for folks trying on Linux (like @Sh1d0w) or Windows. But since using yarn is optional, I think as long as it was called out in the README as experimental, we'd be OK :smile:
@bsclifton Afaik Travis also runs under Linux, so I don't see any benefit from switching if it will not work under it :)
Everyone is free to use what he wants, but I don't think you should change the main docs, promoting broken and unstable package manager.
@Sh1d0w well, we'd definitely want to mention Yarn in the docs if we check in a yarn.lock file (especially mentioning that it's experimental), to avoid folks opening issues for it
Switching is entirely up to the programmer :smile: Travis.ci can continue to use npm
Ok, here is my thinking on this.
As far as I can tell Yarn works nicely with Brave on Mac, Linux and Windows. Despite the --ignore-optional sometimes not working I think it's worth adding Yarn support to Brave. All we need to do is create and add the yarn.lock file to our codebase. We can leave npm in Travis and each individual developer can choose whether to use npm or yarn to install and build.
The only workflow change we'd make is that we need to use yarn install when adding new dependencies so they update the lock file.
This seems like the best approach because it's a small cost that will allow most or all of us to speed up our build and install times.
@bsclifton and @bbondy does that sound reasonable to you? If you'd rather just not I'm ok with that too!
+1!
@jkup sounds great! :smile:
+1
@jkup Please also make travis do this in a PR and if it works we'll merge it in.
I think it will lock our dependencies better which would reduce the chance when we sometimes introduce a bug without changing code because of a dependency bug, this happened twice to us before with RC builds.
Also update mvim tools/cibuild.py to use yarn please and the README. Thanks.
Had to revert the PR.
I spent a couple hours on this but didn't resolve it in branch: yarn-travis.
yarn install v0.18.1
[1/4] Resolving packages...
[2/4] Fetching packages...
warning [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
warning [email protected]: The engine "ender" appears to be invalid.
error [email protected]: The platform "linux" is incompatible with this module.
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
I'm not clear if it's a bug in yarn or a bug in how electron-builder specifies its deps:
https://github.com/yarnpkg/yarn/issues/1233
See also:
https://github.com/yarnpkg/yarn/issues/705
Which I think @Sh1d0w alluded to above.
To fix I think we need to fork our own electron-builder and then merge this in:
https://github.com/wireapp/wire-desktop/pull/248
Build and publish it and then update our package.json
From electron-builder 2.11.0, I think changing to newer electron-builder will be more work
Most helpful comment
++! I've been using it for brave/sync. I think it's good.