I have created an npm package script for npx depcheck
and one of its parameters, --ignore
, its value is getting very long and I expect will get longer.
"audit:depcheck": "npx depcheck --specials=bin --ignore-dirs=dist,node_modules --ignores=tslint,gts,ts-node,ts-node-dev,typescript,mocha,winston,passport-springcm,passport-box,passport-dropbox-oauth2,passport-google-oauth20,passport-microsoft,mocha,nyc",
Tried: I have tried just simply breaking the very long script into new lines but this approach is not JSON compliant.
Goal: Do the same thing, but readable within 110 character width editor.
To define an NPM script, set its name and write the script under the 'scripts' property of your package. json file: To execute your Script, use the 'npm run <NAME-OF-YOUR-SCRIPT>' command. Some predefined aliases convert to npm run, like npm test or npm start, you can use them interchangeably.
npm-package-json-lint is a configurable linter that helps enforce standards for your package. json file. By default no rules are enabled.
"edit-package-json" is an NPM package that makes changes to "package. json" files. It can be used on the command line (as "editPackageJson") or from within a Node app.
You can write a shell script, like (do not copy-paste it exactly, just to get the idea):
#!/usr/bin/env bash
npx depcheck --specials=bin --ignore-dirs=dist,node_modules --ignores=tslint,gts,ts-node,ts-node-dev,typescript,mocha,winston,passport-springcm,passport-box,passport-dropbox-oauth2,passport-google-oauth20,passport-microsoft,mocha,nyc
Name it something descriptive, for example npx_depcheck.sh
or something else you want. Then call the shell script from package.json
:
"audit:depcheck": "./npx_depcheck.sh",
Note: make sure your script can run: chmod u+x ./npx_depcheck.sh
Edit: as @RobC wrote, this solution expects that the system has a shell. The point is, you can attach any kind of scripts, just keep in mind that different environments have different runtimes and tools (a Node.js script makes sense, since the environment where you want to run your application most likely has Node.JS installed).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With