@Tobbe
These notes will help you replace “yarn” with “pnpm”
a. Remove lerna.json and yarn.lock
b. In the root’s’ package.json, add this:
"workspaces": [
"packages/*"
],
c. When you use pnpm on a project, you don’t want others to accidentally run npm install or yarn. To prevent devs from using other package managers, you can add the following preinstall script to your package.json:
{
"scripts": {
"preinstall": "npx only-allow pnpm"
...
}
}
Now, whenever someone runs npm install or yarn, they’ll get an error instead and installation will not proceed.
d. Create a file name, pnpm-workspace.yaml in the root with the following contents:
packages:
- 'packages/*'
e. Install the dependencies
cd redwood
pnpm --ignore-scripts install
f. Add a dependency module using pnpm
pnpm add express Save to dependencies
pnpm add -D express Save to devDependencies
pnpm add -O express Save to optionalDependencies
g. When adding, removing, or updating dependencies within a workspace, you need to go that workspace’s folder first
cd packages/api
pnpm add csurf cookie-parser
cd packages/web
pnpm remove react-hot-toast
h. Run a script defined in the package’s file from the command prompt:
pnpm run *script-name*
i. Replacing ‘yarn’ commands with ‘pnpm’ in the pakage.json
yarn lint ---> pnpm run lint
yarn jest ---> pnpm run jest
j. Replacing ‘lerna run’ and ‘lerna publish’ commands with ‘pnpm’ in the pakage.json, these links may help
https://pnpm.io/cli/publish
https://pnpm.io/workspaces