From d60956e82a3647ca1c36c4fda245d82a818bc53b Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Wed, 1 Feb 2023 20:33:13 +0100 Subject: [PATCH] update contribution guide to pnpm + update root tasks --- CONTRIBUTING.md | 23 ++++++++++++----------- package.json | 4 ++-- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 38e9e510..e29f3d2d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -58,23 +58,22 @@ To fix a bug that has been reported, ## Write Tests There are still many tests that have not been written yet! Reading and writing tests is a great opportunity to get familiar with the codebase. -You can find the tests in each package in the `test` folder. To run all tests, run `npm test` from the root folder. +You can find the tests in each package in the `test` folder. To run all tests, run `pnpm test` from the root folder. ## Project Setup To get the project up and running for development, make sure you have installed: -- git -- node, preferably v16 +- [git](https://git-scm.com/) +- [node](https://nodejs.org/en/) >= 18 +- [pnpm](https://pnpm.io/) (`npm i pnpm -g`) then, do the following: ```sh git clone https://github.com/tidalcycles/strudel.git && cd strudel -npm i # install at root to symlink packages -npx lerna bootstrap # install all dependencies in packages -cd repl && npm i # install repl dependencies -npm run start # start repl +pnpm i # install at root to symlink packages +pnpm start # start repl ``` Those commands might look slightly different for your OS. @@ -93,9 +92,8 @@ If you use VSCode, you can ## Package Workflow The project is split into multiple [packages](https://github.com/tidalcycles/strudel/tree/main/packages) with independent versioning. -When you run `npm i` on the root folder, [npm workspaces](https://docs.npmjs.com/cli/v7/using-npm/workspaces) will symlink all packages -in the `node_modules` folder. This will allow any js file to import `@strudel.cycles/` to get the local version, -which allows developing multiple packages at the same time +When you run `pnpm i` on the root folder, [pnpm workspaces](https://pnpm.io/workspaces) will install all dependencies of all subpackages. This will allow any js file to import `@strudel.cycles/` to get the local version, +allowing to develop multiple packages at the same time. ## Package Publishing @@ -106,12 +104,15 @@ npm login npx lerna publish ``` +To manually publish a single package, increase the version in the `package.json`, then run `pnpm publish`. +Important: Always publish with `pnpm`, as `npm` does not support overriding main files in `publishConfig`, which is done in all the packages. + ### New Packages To add a new package, you have to publish it manually the first time, using: ```sh -cd packages/ && npm publish --access public +cd packages/ && pnpm publish --access public ``` ## Have Fun diff --git a/package.json b/package.json index cc8bcc8a..addcb6b1 100644 --- a/package.json +++ b/package.json @@ -9,10 +9,10 @@ "test": "npm run pretest && vitest run --version", "test-ui": "npm run pretest && vitest --ui", "test-coverage": "npm run pretest && vitest --coverage", - "bootstrap": "lerna bootstrap", - "setup": "npm i && npm run jsdoc-json && npm run bootstrap && cd website && npm i", + "setup": "pnpm i && npm run jsdoc-json", "snapshot": "npm run pretest && vitest run -u --silent", "repl": "cd website && npm run dev", + "start": "cd website && npm run dev", "osc": "cd packages/osc && npm run server", "build": "cd website && npm run build", "preview": "cd website && npm run preview",