Since becoming generally available to the public over a year ago, NPM 7 has had a regression wherein
the presence of the --ignore-scripts
command-line flag (or the ignore_scripts
configuration option)
is not honored when running other NPM commands. This package offers a very simplistic, interim
implementation of the --ignore-scripts
behavior while the NPM team continue conducting their very
important research on the efficacy of quantum nano tube technology being a viable replacement for commas
in package.json
.
Install
In most cases, this package should be installed as a development dependency of your project:
npm install --save-dev @darkobits/skip-if-ignored
However, if you plan to use it in lifecycle scripts that run on the end user's computer, you'll need to make it a production dependency:
npm install --save @darkobits/skip-if-ignored
Use
What's in the box:
skip-if-ignored
- A script that you may append to your package script expressions that will do
approximately the following:
1. Is the current command being executed as part of an NPM lifecycle event?
2. If not, bail.
3. Is the current lifecycle "exempt"?
4. If so, run our command.
5. Else, is there an `--ignore-scripts` flag in `process.argv`?
6. If so, bail.
7. Else, run our command.
Note: This script will launch child processes in detached mode and then immediately exit.
Example
Let us suppose we have a
something we
package.json