Skip to content

Commit 615fa60

Browse files
committed
feat(debug): added debug mode
1 parent b0016dc commit 615fa60

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

README.md

+7
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,13 @@ If there are multiple scripts, they will be printed to the console and an error
7474
* Most commands require typing only 3 characters - 2 for the tool itself "nr" and 1 character for the
7575
the script label
7676

77+
## Debug
78+
79+
If something is not working as expected, you can see the verbose debug messages
80+
by running
81+
82+
DEBUG=quick nr ...
83+
7784
### Small print
7885

7986
Author: Gleb Bahmutov © 2015

bin/npm-quick-run.js

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
'use strict'
44

5+
var debug = require('debug')('quick')
56
var quickRun = require('..')
67

78
var help = [
@@ -21,5 +22,6 @@ require('simple-bin-help')({
2122
}
2223
})
2324

25+
debug('arguments %d', process.argv.length, process.argv)
2426
var prefix = process.argv[2]
2527
quickRun(prefix)

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
},
3737
"homepage": "https://github.com/bahmutov/npm-quick-run#readme",
3838
"dependencies": {
39+
"debug": "2.2.0",
3940
"findup": "0.1.5",
4041
"json-package": "1.1.2",
4142
"npm-utils": "1.5.0",

src/quick-run.js

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
const debug = require('debug')('quick')
12
const findScripts = require('json-package').find
23
const runNpmCommand = require('npm-utils').test
34
const join = require('path').join
@@ -80,6 +81,7 @@ function runPrefix (prefix) {
8081
if (extraArguments.length) {
8182
cmd += ' -- ' + extraArguments.join(' ')
8283
}
84+
debug('formed command "%s"', cmd)
8385

8486
runNpmCommand(cmd, npmErrorLoggers)
8587
.catch(function (result) {

0 commit comments

Comments
 (0)