I have the following script in my package.json
:
{
"build-dist": "tsc -p src/main/ts/tsconfig.json --outDir build/dist/npm-fs && cp LICENSE.txt README.md build/dist/npm-fs && node scripts/build/build-dist.mjs"
}
My script at scripts/build/build-dist.mjs
requires a command line argument to be passed. Would it be possible to have this custom script at the beginning of this script chain and still receive and process passed command line arguments?
{
"build-dist": "node scripts/build/build-dist.mjs && tsc -p src/main/ts/tsconfig.json --outDir build/dist/npm-fs && cp LICENSE.txt README.md build/dist/npm-fs"
}
It requires (and validates input) and throws an error if validation fails and since it requires a command line argument it has to be the last script called to correctly consume command line arguments. As a result, the first two scripts in the chain
tsc -p src/main/ts/tsconfig.json --outDir build/dist/npm-fs && cp LICENSE.txt README.md build/dist/npm-fs
are always executed regardless of whether validation fails or not. I'd much rather have fast-fail behavior and have execution completely halt if that script throws an error.
This question is essentially a duplicate of this. I'm hoping there's a new feature now available or maybe someone has figured out a more elegant solution.