npm to pnpm
-
having a good boilerplate typescript setup is useful to spin up projects quickly
-
This is usually sorted as we have good tooling
-
but package management is usually left to the user
-
I want to be using pnpm, i always mix it with npm. following steps are to setup pnpm for new projects
-
pnpm setup
- delete node_modules
- Add the following to package.json
"scripts": { "preinstall": "npx only-allow pnpm", ... }
- Use workspaces if needed, i don’t need at the moment
- run
pnpm import
: create a pnpm-lock.yaml file based on yarn.lock (or packages-lock.json) - Remove yarn.lock (or packages-lock.json)
- create
.npmrc
withauto-install-peers=true
- In my exp it automatically does this and setting this seems redundant
pnpm i