yarn recommended over pnpm?

Why is yarn recommended in the sapphire CLI over PNPM when PNPM is known to be the faster and more efficient package manager
Solution:
Yarn v4 is new version of Yarn that we recommend switching to as Yarn v1 has long since been deprecated.
"But I don't see any update on [source]?"
That is correct. Yarn v4 is installed through Yarn itself. You configure Yarn v4 on a per-project basis. How you installed Yarn globally is largely irrelevant to this (corepack, volta, something else). How to install Yarn v4 for your project? Simply write:...
Jump to solution
6 Replies
drainpixie
drainpixie13mo ago
It's about on par if not worse with Yarn (assuming you're not using an ancient version) and pnpm is known to be janky with sapphire, apparently Just use whichever you prefer
Favna
Favna13mo ago
You may be comparing pnpm with Yarn v1 instead of Yarn v4 regarding speed because otherwise it's definitely on par if not faster. as for why pnpm doesnt work well with sapphire: https://discord.com/channels/737141877803057244/1168008762049712128/1168964583860486154
.
.OP13mo ago
I see. With that in mind, I decided to convert to yarn from pnpm. After running yarn install no node_modules/ folder is generated, why?
Solution
Spinel
Spinel13mo ago
Yarn v4 is new version of Yarn that we recommend switching to as Yarn v1 has long since been deprecated.
"But I don't see any update on [source]?"
That is correct. Yarn v4 is installed through Yarn itself. You configure Yarn v4 on a per-project basis. How you installed Yarn globally is largely irrelevant to this (corepack, volta, something else). How to install Yarn v4 for your project? Simply write:
yarn set version berry
yarn set version berry
This will download the new Yarn v4 binary and put in .yarn/releases, you should push this to your Git repository. It will also create a .yarnrc.yml file which configures the path which you should also commit. Next you probably also want to run the following 2 commands:
yarn config set enableGlobalCache true
yarn config set nodeLinker node-modules
yarn config set enableGlobalCache true
yarn config set nodeLinker node-modules
This will add to your .yarnrc file:
enableGlobalCache: true
nodeLinker: node-modules
enableGlobalCache: true
nodeLinker: node-modules
This ensures you have a more traditional experience with node_modules and a global cache. The next step is to nuke your node_modules and yarn.lock and run yarn install Then some final adjustments. Put this in you .gitignore:
# Yarn files
.yarn/install-state.gz
.yarn/build-state.yml
# Yarn files
.yarn/install-state.gz
.yarn/build-state.yml
And anywhere in your scripts in package.json where you use * you should wrap it in extra " For example:
{
"format": "prettier --write \"src/**/*.ts\""
}
{
"format": "prettier --write \"src/**/*.ts\""
}
Mind you this last thing is a good thing to add regardless of script runner / package bundler because it ensures the glob is performed by the library and not by your shell, which may differ when people develop on different operating systems. In short, the command to set everything up you can run:
yarn set version berry && yarn config set enableGlobalCache true && yarn config set nodeLinker node-modules && echo "" >> .gitignore && echo "# Yarn files" >> .gitignore && echo ".yarn/install-state.gz" >> .gitignore && echo ".yarn/build-state.yml" >> .gitignore
yarn set version berry && yarn config set enableGlobalCache true && yarn config set nodeLinker node-modules && echo "" >> .gitignore && echo "# Yarn files" >> .gitignore && echo ".yarn/install-state.gz" >> .gitignore && echo ".yarn/build-state.yml" >> .gitignore
Favna
Favna13mo ago
Run those commands to configure it properly @Upsided
.
.OP13mo ago
oh wowza neat thanks Also I've never used yarn before, it's kinda misleading how like the first 5 articles if you look up "yarn vs pnpm speed" or something of that sort say pnpm is leagues faster
Want results from more Discord servers?
Add your server