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

Towards yarn v3 (berry) #29

Closed
wants to merge 25 commits into from
Closed

Towards yarn v3 (berry) #29

wants to merge 25 commits into from

Conversation

kachkaev
Copy link
Owner

@kachkaev kachkaev commented Oct 17, 2020

Edit 2021-11: A smaller version of this PR landed in #160 (it upgrades Yarn from v1 to v3 but keeps node_modules). PnP mode is activated in #161.


  1.  Bump Yarn

    yarn set version berry
    yarn install
    yarn dlx @yarnpkg/pnpify --sdk vscode
    rm -rf node_modules
  2. Tweak .gitignore etc.

  3. Replace yarn-deduplicate with yarn dedupe.

  4. Change yarn args in CI and in git hooks

  5. Hoist ESLint plugins 😞

  6. Bring back Prettier plugins

  7. Wait for Use require.resolve as a fallback of path.resolve DavidAnson/markdownlint#342 to fix Markdownlint

  8. Investigate failing GitHub integration with Snyk (see separate comment below)

  9. Track Picking a different typescript.tsdk from a list / use in a multi-root workspace with yarn2 pnp microsoft/vscode#108866

  10. Wait for yarn2 Vercel build failed - No Next.js version could be detected in your project vercel/vercel#5280 to fix Deployment to Vercel

@vercel
Copy link

vercel bot commented Oct 17, 2020

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/kachkaev/njt/DdY7PmqyZBWUhp5BqiFw16JtsdJ9
✅ Preview: https://njt-git-yarn-berry-kachkaev.vercel.app

Comment on lines +16 to +17
!.yarn/releases
!.yarn/plugins
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
!.yarn/releases
!.yarn/plugins

You probably don't want prettier to touch these files

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah you are right! Same for ESLint and Markdownlint. What is interesting though is that I just ran yarn fix:prettier and did not notice any .yarn/* paths in stdout. I guess that something in my approach to config files ends up excluding all folders starting with the dot by default. For that reason, I had to add !/.github/ a while ago (see above) — otherwise the yamls were not formatted.

I’ll see what's best: to keep things as is or to ‘break the symmetry’ between the ignore files. Gonna switch to work work till the next weekend 🙂

@merceyz
Copy link

merceyz commented Oct 18, 2020

Wait for DavidAnson/markdownlint#342 to fix Markdownlint

You can manually apply that fix as a patch if you want, so you don't have to wait.
https://yarnpkg.com/features/protocols#patch

@kachkaev
Copy link
Owner Author

kachkaev commented Oct 18, 2020

@ivanstanev 👋 I saw you were contributing to snyk/snyk and decided to ping you if that’s OK. As I’m trying to upgrade the project to Yarn 2 (Berry), I seem to be having a problem with the Snyk reports. The details show this:

Failed to parse package.json or yarn.lock as valid JSON (or YAML)

Screenshot 2020-10-19 at 00 14 11

My suspicion is that the problem could be to do with yarn.lock format changing from v1 to v2. Is it because Snyk still can’t parse v2 or is it because the project is hidden nailed to v1 somehow? I tried searching for similar issues with no luck so decided to bring it up with someone from Snyk on GitHub before opening a support ticket. Curious what you or your colleagues think (if you have time on this, of course) 🙌


UPD (2020-10-20 22:45 BST): I created a Snyk support request #7168. Their reply (TL;DR): The feature is being worked on, but no timeline yet. They’ll update me when it’s done.

@merceyz
Copy link

merceyz commented Oct 19, 2020

The irony in that error is that the V1 lockfile isn't valid YAML while the V2 lockfile is 😄

@SagnikPradhan
Copy link

Any update on this?

@kachkaev kachkaev changed the title Towards yarn v2 (berry) Towards yarn v3 (berry) Aug 7, 2021
@kachkaev
Copy link
Owner Author

kachkaev commented Nov 21, 2021

This PR is partially replaced by #160 (I’ve upgraded Yarn but kept node_modules there). I had to give up on Snyk and disable it for now. It’s been a year since I reached Snyk support and asked them to support yarn.lock v2. Still no good news: https://github.com/snyk/snyk/issues/1518.

@kachkaev kachkaev changed the title Towards yarn v3 (berry) Switch to Yarn PnP Nov 21, 2021
@kachkaev kachkaev changed the title Switch to Yarn PnP Switch to Yarn Berry PnP Nov 21, 2021
@kachkaev kachkaev changed the title Switch to Yarn Berry PnP Towards yarn v3 (berry) Nov 21, 2021
@kachkaev
Copy link
Owner Author

kachkaev commented Nov 21, 2021

I’m closing this PR in favour of #161, which continues work done in #160. Keeping this diff as is instead of rebasing for history keeping purposes.

@kachkaev kachkaev closed this Nov 21, 2021
@kachkaev kachkaev deleted the yarn-berry branch November 21, 2021 20:31
@kachkaev
Copy link
Owner Author

kachkaev commented Feb 1, 2022

Mission complete! 🕺

https://twitter.com/kachkaev/status/1488630228842917891

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

Successfully merging this pull request may close these issues.

None yet

4 participants