lint-staged
Advanced tools
Comparing version 12.4.2 to 12.4.3
@@ -7,3 +7,3 @@ #!/usr/bin/env node | ||
import cmdline from 'commander' | ||
import { Option, program } from 'commander' | ||
import debug from 'debug' | ||
@@ -27,46 +27,71 @@ import supportsColor from 'supports-color' | ||
cmdline | ||
.version(version) | ||
.option('--allow-empty', 'allow empty commits when tasks revert all staged changes', false) | ||
.option( | ||
'-p, --concurrent <number|boolean>', | ||
'the number of tasks to run concurrently, or false for serial', | ||
true | ||
const debugLog = debug('lint-staged:bin') | ||
debugLog('Running `lint-staged@%s`', version) | ||
const cli = program.version(version) | ||
cli.option('--allow-empty', 'allow empty commits when tasks revert all staged changes', false) | ||
cli.option( | ||
'-p, --concurrent <number|boolean>', | ||
'the number of tasks to run concurrently, or false for serial', | ||
true | ||
) | ||
cli.option('-c, --config [path]', 'path to configuration file, or - to read from stdin') | ||
cli.option('--cwd [path]', 'run all tasks in specific directory, instead of the current') | ||
cli.option('-d, --debug', 'print additional debug information', false) | ||
cli.option('--max-arg-length [number]', 'maximum length of the command-line argument string', 0) | ||
/** | ||
* We don't want to show the `--stash` flag because it's on by default, and only show the | ||
* negatable flag `--no-stash` in stead. There seems to be a bug in Commander.js where | ||
* configuring only the latter won't actually set the default value. | ||
*/ | ||
cli | ||
.addOption( | ||
new Option('--stash', 'enable the backup stash, and revert in case of errors') | ||
.default(true) | ||
.hideHelp() | ||
) | ||
.option('-c, --config [path]', 'path to configuration file, or - to read from stdin') | ||
.option('--cwd [path]', 'run all tasks in specific directory, instead of the current') | ||
.option('-d, --debug', 'print additional debug information', false) | ||
.option('--max-arg-length [number]', 'maximum length of the command-line argument string', 0) | ||
.option('--no-stash', 'disable the backup stash, and do not revert in case of errors', false) | ||
.option('-q, --quiet', 'disable lint-staged’s own console output', false) | ||
.option('-r, --relative', 'pass relative filepaths to tasks', false) | ||
.option('-x, --shell [path]', 'skip parsing of tasks for better shell support', false) | ||
.option( | ||
'-v, --verbose', | ||
'show task output even when tasks succeed; by default only failed output is shown', | ||
false | ||
.addOption( | ||
new Option( | ||
'--no-stash', | ||
'disable the backup stash, and do not revert in case of errors' | ||
).default(false) | ||
) | ||
.parse(process.argv) | ||
const cmdlineOptions = cmdline.opts() | ||
cli.option('-q, --quiet', 'disable lint-staged’s own console output', false) | ||
if (cmdlineOptions.debug) { | ||
cli.option('-r, --relative', 'pass relative filepaths to tasks', false) | ||
cli.option('-x, --shell [path]', 'skip parsing of tasks for better shell support', false) | ||
cli.option( | ||
'-v, --verbose', | ||
'show task output even when tasks succeed; by default only failed output is shown', | ||
false | ||
) | ||
const cliOptions = cli.parse(process.argv).opts() | ||
if (cliOptions.debug) { | ||
debug.enable('lint-staged*') | ||
} | ||
const debugLog = debug('lint-staged:bin') | ||
debugLog('Running `lint-staged@%s`', version) | ||
const options = { | ||
allowEmpty: !!cmdlineOptions.allowEmpty, | ||
concurrent: JSON.parse(cmdlineOptions.concurrent), | ||
configPath: cmdlineOptions.config, | ||
cwd: cmdlineOptions.cwd, | ||
debug: !!cmdlineOptions.debug, | ||
maxArgLength: cmdlineOptions.maxArgLength || undefined, | ||
quiet: !!cmdlineOptions.quiet, | ||
relative: !!cmdlineOptions.relative, | ||
shell: cmdlineOptions.shell /* Either a boolean or a string pointing to the shell */, | ||
stash: !!cmdlineOptions.stash, // commander inverts `no-<x>` flags to `!x` | ||
verbose: !!cmdlineOptions.verbose, | ||
allowEmpty: !!cliOptions.allowEmpty, | ||
concurrent: JSON.parse(cliOptions.concurrent), | ||
configPath: cliOptions.config, | ||
cwd: cliOptions.cwd, | ||
debug: !!cliOptions.debug, | ||
maxArgLength: cliOptions.maxArgLength || undefined, | ||
quiet: !!cliOptions.quiet, | ||
relative: !!cliOptions.relative, | ||
shell: cliOptions.shell /* Either a boolean or a string pointing to the shell */, | ||
stash: !!cliOptions.stash, // commander inverts `no-<x>` flags to `!x` | ||
verbose: !!cliOptions.verbose, | ||
} | ||
@@ -73,0 +98,0 @@ |
{ | ||
"name": "lint-staged", | ||
"version": "12.4.2", | ||
"version": "12.4.3", | ||
"description": "Lint files staged by git", | ||
@@ -37,31 +37,32 @@ "license": "MIT", | ||
"colorette": "^2.0.16", | ||
"commander": "^8.3.0", | ||
"debug": "^4.3.3", | ||
"commander": "^9.3.0", | ||
"debug": "^4.3.4", | ||
"execa": "^5.1.1", | ||
"lilconfig": "2.0.4", | ||
"listr2": "^4.0.1", | ||
"micromatch": "^4.0.4", | ||
"lilconfig": "2.0.5", | ||
"listr2": "^4.0.5", | ||
"micromatch": "^4.0.5", | ||
"normalize-path": "^3.0.0", | ||
"object-inspect": "^1.12.0", | ||
"object-inspect": "^1.12.2", | ||
"pidtree": "^0.5.0", | ||
"string-argv": "^0.3.1", | ||
"supports-color": "^9.2.1", | ||
"supports-color": "^9.2.2", | ||
"yaml": "^1.10.2" | ||
}, | ||
"devDependencies": { | ||
"@babel/core": "^7.16.12", | ||
"@babel/eslint-parser": "^7.16.5", | ||
"@babel/preset-env": "^7.16.11", | ||
"babel-jest": "^27.4.6", | ||
"@babel/core": "^7.18.2", | ||
"@babel/eslint-parser": "^7.18.2", | ||
"@babel/preset-env": "^7.18.2", | ||
"babel-jest": "^28.1.0", | ||
"babel-plugin-transform-imports": "2.0.0", | ||
"consolemock": "^1.1.0", | ||
"eslint": "^8.7.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-import": "^2.25.4", | ||
"eslint": "^8.16.0", | ||
"eslint-config-prettier": "^8.5.0", | ||
"eslint-plugin-import": "^2.26.0", | ||
"eslint-plugin-node": "^11.1.0", | ||
"eslint-plugin-prettier": "^4.0.0", | ||
"fs-extra": "^10.0.0", | ||
"husky": "^7.0.4", | ||
"jest": "^27.4.7", | ||
"fs-extra": "^10.1.0", | ||
"husky": "^8.0.1", | ||
"jest": "^28.1.0", | ||
"jest-snapshot-serializer-ansi": "^1.0.0", | ||
"prettier": "^2.5.1" | ||
"prettier": "^2.6.2" | ||
}, | ||
@@ -68,0 +69,0 @@ "keywords": [ |
@@ -597,3 +597,3 @@ # 🚫💩 lint-staged ![GitHub Actions](https://github.com/okonet/lint-staged/workflows/CI/badge.svg) [![npm version](https://badge.fury.io/js/lint-staged.svg)](https://badge.fury.io/js/lint-staged) [![Codecov](https://codecov.io/gh/okonet/lint-staged/branch/master/graph/badge.svg)](https://codecov.io/gh/okonet/lint-staged) | ||
relative: false, | ||
shell: false | ||
shell: false, | ||
stash: true, | ||
@@ -600,0 +600,0 @@ verbose: false |
102679
1816
16
+ Addedcommander@9.5.0(transitive)
+ Addedlilconfig@2.0.5(transitive)
- Removedcommander@8.3.0(transitive)
- Removedlilconfig@2.0.4(transitive)
Updatedcommander@^9.3.0
Updateddebug@^4.3.4
Updatedlilconfig@2.0.5
Updatedlistr2@^4.0.5
Updatedmicromatch@^4.0.5
Updatedobject-inspect@^1.12.2
Updatedsupports-color@^9.2.2