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

Support modern yarn #291

Open
JosXa opened this issue Jul 3, 2024 · 5 comments
Open

Support modern yarn #291

JosXa opened this issue Jul 3, 2024 · 5 comments

Comments

@JosXa
Copy link

JosXa commented Jul 3, 2024

Since there's already this awesome graphical user interface, it would be really cool if I could pick Yarn 4.3+ over pnpm (as I use it everywhere).

Fun fact: pnpm uses huge chunks of the yarn berry code base under the hood ^^

@magne4000
Copy link
Member

I haven't really used yarn since 1.0, could you direct me to what's different to current yarn usage (i.e. yarn dlx @batijs/cli)?

@JosXa
Copy link
Author

JosXa commented Jul 3, 2024

Yarn Berry (v2+) has very little resemblance to legacy Yarn. It supports workspaces, automatic constraints, package patching, and their own Plug'n'Play linker, though that's still experimental and I wouldn't recommend enabling it for the masses (see nodeLinker setting below). They keep on innovating and it's become an amazing tool, arguably the most powerful one of the available choices.

The right way to grab the latest yarn install is to first corepack enable (node 18+), then yarn set version latest. This will generate a .yarnrc file, update the gitignore, and prepare the project for yarn install (or just yarn).

I'd recommend the following .yarnrc settings:

compressionLevel: mixed
enableGlobalCache: true
nodeLinker: node-modules

supportedArchitectures:
  cpu:
    - x64
    - arm64
  libc:
    - glibc
    - musl
  os:
    - darwin
    - linux
    - win32

yarnPath: .yarn/releases/yarn-<whatever-is-latest-version>.cjs

The result could then be checked into the generator.

@magne4000
Copy link
Member

I'm still not sure to understand what's not working currently if you execute yarn dlx @batijs/cli

@magne4000
Copy link
Member

I'm still not sure to understand what's not working currently if you execute yarn dlx @batijs/cli

@JosXa any info?

@dvteixeira24
Copy link

dvteixeira24 commented Aug 6, 2024

fwiw I generated a vike project with bati and it works with Plug n Play after some patches to telefunc brillout/telefunc#77

did corepack enable and set "packageManager": "yarn@4.4.0" in package.json

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

No branches or pull requests

3 participants