Page MenuHomePhabricator

Consider moving from npm to yarn for WMF repos?
Closed, DeclinedPublic

Description

https://yarnpkg.com

https://github.com/yarnpkg/yarn

Are there real benefits? https://shapeshed.com/thoughts-on-yarn/ mentions speed (which is nice) and shared cache (which we already have in CI?). Is it worth it?


From duplicate task T178647 by @Yurik:

This is for consideration only, not a request yet, as I might be able to get upstream lib to publish multiple npm packages.

There is at least one case, when npm refuses to support a use case that yarn supports. The Install multiple versions of a dependency #5499 was rejected by the NPM team, despite a very vocal demand by the community. Yarn chose to implement it.

This feature allows multiple versions of the same library to be added to a project. My particular use case is supporting multiple versions of Vega library, all of which exist under the same name in NPM repository.

The problem with yarn approach is that it makes package.json incompatible with the npm (npm throws an error on npm: protocol).

Can we introduce some project-level setting, e.g. a key in package.json to specify which package manager to use for the build?

Event Timeline

Restricted Application added a subscriber: Aklapper. · View Herald TranscriptOct 14 2016, 7:00 PM

I have learned about yarn just last week from Nuria / Analytics team. Would you mind reaching out to them and check were they are heading and whether they are already experimenting?

From a quick reading, seems it is all back compatible and given one has npm we could just run:

  • npm install yarn
  • yarn test // yarn run whatever
hashar triaged this task as Low priority.Nov 7 2016, 10:13 AM

From https://gerrit.wikimedia.org/r/#/c/316904/

Migrate from bower to npm instead of yarn
We originally thought migrating to yarn would be a good idea. It turns out it fails to install some bower packages and doesn't work well with git repository dependencies yet. So we'll include the yarn.lock file for now and look again in a few months when yarn 1.0 is released. Until then we have moved to npm from bower, simplifying and upgrading the packages.
The google fonts kept breaking the build in offline mode and otherwise, so we also spent some time and replaced them with locally downloaded fonts. This means certain files of the semantic build had to be checked into source control and the build had to be changed a bit. All is well.

TheDJ added a subscriber: TheDJ.Nov 7 2016, 11:26 AM
TheDJ added a comment.Nov 7 2016, 11:36 AM

Yarn seems interesting, and I think we definitely should look into using that at some point. I think that with a little bit of refinement, it could be a really good drop in replacement.
I hope that they keep it easy to stay npm compatible, for at least development situations.

Ricordisamoa updated the task description. (Show Details)Feb 10 2017, 8:34 AM
Ricordisamoa added a subscriber: Ricordisamoa.
Jdforrester-WMF changed the task status from Open to Stalled.Aug 9 2018, 5:32 PM

AFAICT, there's no appetite for this right now. Marking as Stalled but would be happy for this to be Declined instead.

TheDJ closed this task as Declined.Aug 24 2018, 11:42 AM

I think we can pretty much call this dead. It seems npm is catching up on most fronts, and this being a Facebook project seems to create higher levels of discomfort with certain people.

If we ever get where we need to be, it will likely be with vanilla npm