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
npm
library 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
npm
library 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
npm
library. - Inbox: