npm ci
Instead of rm -rf node_modules + npm install, you can use npm ci to cleanly install the dependencies in your package-lock.json. It requires a package-lock.json to already exist and will automatically delete the node_modules folder if itβs present.
See npm ci | npm Docs for more details.
Scripts: passing arguments
You can pass arguments to scripts in your package.json file using the -- separator. For example, if you have a script called build that runs tsc and you want to pass the --watch flag to tsc, you can run npm run build -- --watch.
Links
Creating an npm library
- πΊ Create NPM JavaScript Packages using TypeScript β’ 7 minute video by Basarat Ali concisely demonstrating how to write a tiny
npmlibrary using TS, publish a compiled version of it tonpm, and use it in another project. - πΊ Create a React Component Library using TypeScript β’ 4 minute video by Basarat Ali showing how to write a tiny React
npmlibrary using TS, publish a compiled version of it tonpm, and use it in another project. - πΊ Managing CSS when building a React Component Library β’ 3 minute video by Basarat Ali showing how to add a CSS-in-JS dependency to a React
npmlibrary. - Inbox: