4 ms·
I still do not understand the pros of having these scripts in package.json instead of ./scripts/*.sh..
by marius_k 5y ago
I still do not understand the pros of having these scripts in package.json instead of ./scripts/*.sh..
- tedmiston 5y agoMainly just the convenience of being able to run `npm run foo` and convenience if you need to interact with any executables installed in the node modules. I still use Makefiles everywhere in all of my projects. I like knowing I can have a consistent interface to everything with `make build`, `make run`, `make install`, etc.
- kraenhansen 5y agoI second tedmiston's point above. It's mainly convenience (running `npm run` which can be auto-completed with a shell integration too), but also discoverability: If you're switching between multiple projects, its nice to know that you can simply look there for the commands that you're able to run. I especially like the package.json scripts for simple one-liners, if I have something complicated I might also create a ./scripts directory with a script and call that from an npm run-script.