doc-detective 2.11.0-dev.4 → 2.11.0-dev.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.doc-detective.json +2 -1
- package/package.json +1 -1
- package/samples/reference.png +0 -0
- package/src/index.js +24 -19
package/.doc-detective.json
CHANGED
package/package.json
CHANGED
|
Binary file
|
package/src/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
1
|
+
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
const { runTests, runCoverage } = require("doc-detective-core");
|
|
4
4
|
const { setArgs, setConfig, outputResults, setMeta } = require("./utils");
|
|
@@ -11,13 +11,12 @@ function complete(commands) {
|
|
|
11
11
|
return function (str) {
|
|
12
12
|
var i;
|
|
13
13
|
var ret = [];
|
|
14
|
-
for (i=0; i< commands.length; i++) {
|
|
15
|
-
if (commands[i].indexOf(str) == 0)
|
|
16
|
-
ret.push(commands[i]);
|
|
14
|
+
for (i = 0; i < commands.length; i++) {
|
|
15
|
+
if (commands[i].indexOf(str) == 0) ret.push(commands[i]);
|
|
17
16
|
}
|
|
18
17
|
return ret;
|
|
19
18
|
};
|
|
20
|
-
}
|
|
19
|
+
}
|
|
21
20
|
|
|
22
21
|
// Run
|
|
23
22
|
setMeta();
|
|
@@ -31,20 +30,6 @@ async function main(argv) {
|
|
|
31
30
|
);
|
|
32
31
|
// `command` is the next argument after `doc-detective` or `src/index.js`
|
|
33
32
|
let command = argv[index + 1];
|
|
34
|
-
// If no command, prompt user to select a command
|
|
35
|
-
if (command !== "runTests" && command !== "runCoverage") {
|
|
36
|
-
const ask = `
|
|
37
|
-
Welcome to Doc Detective. Choose a command:
|
|
38
|
-
- 'runTests' - Run tests defined in specifications and documentation source files.
|
|
39
|
-
- 'runCoverage' - Calculate test coverage of doc content.
|
|
40
|
-
|
|
41
|
-
You can skip this next time by running 'npx doc-detective <command>'. You can also set 'defaultCommand' in your .doc-detective.json config file.
|
|
42
|
-
|
|
43
|
-
For more info, visit https://doc-detective.com.
|
|
44
|
-
|
|
45
|
-
Command: `;
|
|
46
|
-
command = prompt({ask, value: "runTests", autocomplete: complete(["runTests", "runCoverage"])});
|
|
47
|
-
}
|
|
48
33
|
// Set args
|
|
49
34
|
argv = setArgs(argv);
|
|
50
35
|
// Get .doc-detective.json config, if it exists
|
|
@@ -55,6 +40,26 @@ Command: `;
|
|
|
55
40
|
}
|
|
56
41
|
// Set config
|
|
57
42
|
config = setConfig(config, argv);
|
|
43
|
+
command = command || config.defaultCommand;
|
|
44
|
+
// If no command, prompt user to select a command
|
|
45
|
+
if (command !== "runTests" && command !== "runCoverage") {
|
|
46
|
+
const ask = `
|
|
47
|
+
Welcome to Doc Detective. Choose a command:
|
|
48
|
+
- 'runTests' - Run tests defined in specifications and documentation source files.
|
|
49
|
+
- 'runCoverage' - Calculate test coverage of doc content.
|
|
50
|
+
|
|
51
|
+
You can skip this next time by running 'npx doc-detective <command>'. You can also set 'defaultCommand' in your .doc-detective.json config file.
|
|
52
|
+
|
|
53
|
+
For more info, visit https://doc-detective.com.
|
|
54
|
+
|
|
55
|
+
Command: `;
|
|
56
|
+
command = prompt({
|
|
57
|
+
ask,
|
|
58
|
+
value: "runTests",
|
|
59
|
+
autocomplete: complete(["runTests", "runCoverage"]),
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
58
63
|
// Run command
|
|
59
64
|
let results = {};
|
|
60
65
|
let outputDir;
|