2 ms·
NPM has no concept of dependencies of steps like make has for what people use in "scripts". It is painful to see people doing that all the time and then constru
by zelphirkalt 4y ago
NPM has no concept of dependencies of steps like make has for what people use in "scripts". It is painful to see people doing that all the time and then constructing their commands as long strings, which the tool they use has no knowledge about, using recursive invocation and having to write "npm run" again and again in those long strings, while in a Makefile it is all figured out automatically, as dependencies of steps are clearly stated as such.
It feels akin to handling HTML as a long string and fumbling around in it, as was done in the past in many PHP projects, instead of handling HTML as structured data, an XML tree or similar.
NPM package.json scripts is a Makefile for the very poor. Yes it can be used like that. Should it? When commands start to have prerequisites probably not.
- pcthrowaway 4y agoIf one script has a dependency on another script, just have the dependent script defined as `"npm run otherscript && ..."` You still don't get to define output files as dependencies, so it's not quite Make, but it's really not that bad if your project is already node/js/ts