Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
SEMIBREAKING: Make --quiet the standard, add --verbose
Browse files Browse the repository at this point in the history
Align with other tools and only log failures, not successes, by default

This is breaking if you relied on the output of a log on success
  • Loading branch information
voxpelli committed Jul 28, 2019
1 parent 5e4f11b commit d886e2b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
10 changes: 5 additions & 5 deletions cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const args = require('minimist')(process.argv.slice(2), {
extra: false,
dev: true,
'default-entries': true,
quiet: false
verbose: false
},
boolean: ['missing', 'extra', 'dev', 'version', 'ignore', 'default-entries', 'quiet'],
boolean: ['missing', 'extra', 'dev', 'version', 'ignore', 'default-entries', 'verbose'],
alias: {
extra: 'unused',
'ignore-module': 'i',
Expand Down Expand Up @@ -45,7 +45,7 @@ if (args.help || args._.length === 0) {
console.log("--extensions, -e List of file extensions with detective to use when resolving require paths. Eg. 'js,jsx:detective-es6'")
console.log('--version Show current version')
console.log('--ignore To always exit with code 0 pass --ignore')
console.log('--quiet To disable logging on success')
console.log('--verbose Enable logging of success')
console.log('')

process.exit(1)
Expand Down Expand Up @@ -96,7 +96,7 @@ check({
failed += extras.length
if (extras.length) {
console.error('Fail! Modules in package.json not used in code: ' + extras.join(', '))
} else if (!args.quiet) {
} else if (args.verbose) {
console.log('Success! All dependencies in package.json are used in the code')
}
}
Expand All @@ -105,7 +105,7 @@ check({
failed += missing.length
if (missing.length) {
console.error('Fail! Dependencies not listed in package.json: ' + missing.join(', '))
} else if (!args.quiet) {
} else if (args.verbose) {
console.log('Success! All dependencies used in the code are listed in package.json')
}
}
Expand Down
14 changes: 5 additions & 9 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,21 @@ $ dependency-check <path to module file(s), package.json or module folder>
# e.g.
$ dependency-check ./package.json
$ dependency-check ./package.json --verbose
Success! All dependencies used in the code are listed in package.json
Success! All dependencies in package.json are used in the code
$ dependency-check ./package.json --missing
$ dependency-check ./package.json --missing --verbose
Success! All dependencies used in the code are listed in package.json
$ dependency-check ./package.json --unused
$ dependency-check ./package.json --unused --verbose
Success! All dependencies in package.json are used in the code
# or with file input instead:
$ dependency-check ./index.js
Success! All dependencies used in the code are listed in package.json
Success! All dependencies in package.json are used in the code
# even with globs and multiple inputs:
$ dependency-check ./test/**/*.js ./lib/*.js
Success! All dependencies used in the code are listed in package.json
Success! All dependencies in package.json are used in the code
```

`dependency-check` exits with code 1 if there are discrepancies, in addition to printing them out
Expand Down Expand Up @@ -105,9 +101,9 @@ running `dependency-check ./package.json -e js,jsx:precinct` will resolve requir

running `dependency-check ./package.json --detective precinct` will `require()` the local `precinct` as the default parser. This can be set per-extension using using `-e`. Defaults to parsing with [`detective`](https://www.npmjs.com/package/detective).

### --quiet
### --verbose

Running with `--quiet` will diable the default log message on success, so that dependency-check only logs on failure.
Running with `--verbose` will enable a log message on success, otherwise dependency-check only logs on failure.

### --help

Expand Down

0 comments on commit d886e2b

Please sign in to comment.