# for gulp/node usage$ npm install --save-dev dep-validate# for command line usage$ npm install -g dep-validate
$ dep-validate --dependencies '~' --devDependencies '^' --exclude pkg1 --exclude pkg2 --hardcoded=allow --only production --only development --packageFile ./package.json
The exit code will be a
1 in case of error, with a chart displaying errors. It'll be
0 on success with no output.
All options are shown below and are the defaults (so they're used if not provided). The only exception is
file, which will resolve the current
package.json (by reading upwards in directory).
var dv = ;// available optionsvar opts =allowHardcoded: true // allow hardcoded versions without verificationdependencies: '~' // the range to enforce on all "dependencies"devDependencies: '^' // the range to enforce on all "devDependencies"exluded: 'my-package' // packages to exclude from validationpackageFile: './package.json' // the package.json file to read and validateonly: 'production' 'development' // only check prod/dev dependencies// `validate()` results a results objectvar results = dv;// which can be printed using `log()`if dvdv;// or use `pipe()` for a callback-style interface (it's still synchronous)dv
var dv = ;var gulp = ;gulp
.gulp() can also accept a
failOnError option which will cause your Gulp task to cause an error if your dependencies do not satisfy your rules.