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

Migrate to yarn #40882

Closed
11 tasks done
scinos opened this issue Apr 8, 2020 · 6 comments
Closed
11 tasks done

Migrate to yarn #40882

scinos opened this issue Apr 8, 2020 · 6 comments

Comments

@scinos
Copy link
Contributor

scinos commented Apr 8, 2020

This issue is used to keep track of the migration from npm to yarn.

Summary

We move wp-calypso repo from npm to yarn (work already started by @blowery and @jameslnewell in #39121).

The biggest risk with this transition is accidentally altering the dependency tree. This could introduce production bugs at the same time we are changing our tools, making everything extra harder to diagnose and fix.

To ensure a clean transition, we first need to have a clean npm dependency tree.

Preparation

These can be merged to master

Migration to yarn

To keep things easy to review, we'll have a long-run feature branch update/npm-to-yarn-main. All these changes will be merged into that branch.

Once all the above have been reviewed and merged toupdate/npm-to-yarn-main, we'll do a final merge to master.

@scinos
Copy link
Contributor Author

scinos commented Apr 8, 2020

@nerrad @simison @nb @blowery @dmsnell @tyxla @sirbrillig @zinigor @sirreal @griffbrad @p-jackson @ChaosExAnima @brbrr @Stojdza @senadir @creativecoder

Hey folks! In the past, you have shown some interest in Calypso migrating to yarn. In case you are still interested, this is the issue where I'm capturing the state of the project. Please, feel free to check the open PRs and the overall plan and let me know if you have any feedback or directly comment on the relevant PRs.

@nb
Copy link
Member

nb commented Apr 8, 2020

Thanks for all the work on that, @scinos (and before @blowery and @jameslnewell)! This is exciting, looking forward to eliminating a whole class of tricky problems.

A couple of (hopefully not too high-level) questions:

  • What is our criteria for being ready to complete the migration? How do we know it's stable enough? Do we expect that the nom and yarn trees are the same?
  • What are ways in which we can reduce the risk for production bugs once we deploy?

@scinos
Copy link
Contributor Author

scinos commented Apr 14, 2020

@nb There are two main criteria for the migration:

  1. The changes in the tree must be contained, small, expected and explainable). We know npm can generate a tree that can't be represented in yarn with 100% fidelity, so there will be some changes.

  2. Calypso bundles must not change significatively when comparing yarn vs npm. As above, there might be some minor changes, but they must be fully explainable and expected.

I think that if we can guarantee the above two points, we will be in a good spot and the migration won't introduce any new bug.

@nb
Copy link
Member

nb commented Apr 14, 2020

Thanks, @scinos.

“Contained, small, expected and explainable” change to the tree makes perfect sense.

As for the bundles, I am curious to see whether we will be able to reason about the changes we see.

Do you think it's worth trying to test on a smaller audience? Like wordpress.com staging (seen by proxied Automatticians)? Or it will be too much effort?

@scinos
Copy link
Contributor Author

scinos commented Apr 15, 2020

For the record, the complete list of changes in the tree is listed in #40923 (comment). The changes in the bundles are listed in #40923 (comment)

At this point, I think we are pretty safe. The only bit that slightly concerns me is the duplication of acorn (see comment in the second link) because it adds 27kb to 3 async chunks. I assume those chunks are only loaded in some specific use cases, so most users won't be impacted. At any rate, deduplicating acorn to mitigate it should be pretty high in our priority list once yarn lands in master.

As for testing in a subset of users... in this specific case, I think it is too much effort. Keeping npm and yarn alive for a few days/weeks means we have to keep yarn in sync with every change in the dependency tree in npm. That process is partially manual, and therefore error prone. Which means we can introduce more risks, but specially, it means that the day we press the button to merge it "for good", we will potentially be merging a dep tree different than the tree we would have been testing in staging.

@scinos
Copy link
Contributor Author

scinos commented Apr 16, 2020

This project has been merged in master. The final list of dependency changes are listed in #41140 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants