watskeburt 4.2.1 → 4.2.3
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE +1 -1
- package/README.md +8 -0
- package/dist/cli.js +5 -0
- package/dist/format/format.js +3 -1
- package/dist/git-primitives.js +7 -7
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/LICENSE
CHANGED
package/README.md
CHANGED
@@ -83,9 +83,17 @@ Options:
|
|
83
83
|
-T, --outputType <type> what format to emit (choices: "json", "regex", default: "regex")
|
84
84
|
--trackedOnly only take tracked files into account (default: false)
|
85
85
|
-V, --version output the version number
|
86
|
+
-e, --extensions <list> comma separated list of file extensions to consider
|
87
|
+
- pass "*" to consider all extensions
|
88
|
+
- currently applicable only to the "regex" reporter
|
89
|
+
- defaults to to most popular extensions in the
|
90
|
+
JavaScript/ TypeScript ecosystem
|
86
91
|
-h, --help display help for command
|
87
92
|
```
|
88
93
|
|
94
|
+
Default list of extensions (cli, regex reporter only):
|
95
|
+
`"cjs, cjsx, coffee, csx, cts, js, json, jsx, litcoffee, ls, mjs, mts, svelte, ts, tsx, vue, vuex"`.
|
96
|
+
|
89
97
|
## why?
|
90
98
|
|
91
99
|
I needed something robust to support caching in
|
package/dist/cli.js
CHANGED
@@ -11,6 +11,11 @@ lists files & their statuses since [old-revision] or between [old-revision] and
|
|
11
11
|
Options:
|
12
12
|
-T, --outputType <type> what format to emit (choices: "json", "regex", default: "regex")
|
13
13
|
--trackedOnly only take tracked files into account (default: false)
|
14
|
+
-e, --extensions <list> comma separated list of file extensions to consider
|
15
|
+
- pass "*" to consider all extensions
|
16
|
+
- currently applicable only to the "regex" reporter
|
17
|
+
- defaults to to most popular extensions in the
|
18
|
+
JavaScript/ TypeScript ecosystem
|
14
19
|
-V, --version output the version number
|
15
20
|
-h, --help display help for command${EOL}`;
|
16
21
|
export async function cli(
|
package/dist/format/format.js
CHANGED
@@ -6,7 +6,9 @@ const OUTPUT_TYPE_TO_FUNCTION = new Map([
|
|
6
6
|
]);
|
7
7
|
export function format(pChanges, pOutputType, pExtensions) {
|
8
8
|
const lExtensions = new Set(
|
9
|
-
pExtensions
|
9
|
+
(pExtensions ?? "*")
|
10
|
+
.split(",")
|
11
|
+
.map((pExtension) => `.${pExtension.trim()}`),
|
10
12
|
);
|
11
13
|
return OUTPUT_TYPE_TO_FUNCTION.get(pOutputType)(pChanges, lExtensions);
|
12
14
|
}
|
package/dist/git-primitives.js
CHANGED
@@ -1,14 +1,15 @@
|
|
1
1
|
import { spawn } from "node:child_process";
|
2
|
+
const SHA1_LENGTH = 40;
|
2
3
|
export async function getStatusShort(pSpawnFunction = spawn) {
|
3
4
|
const lErrorMap = new Map([
|
4
5
|
[129, `'${process.cwd()}' does not seem to be a git repository`],
|
5
6
|
]);
|
6
|
-
const
|
7
|
+
const lStatusOutput = await getGitResult(
|
7
8
|
["status", "--porcelain"],
|
8
9
|
lErrorMap,
|
9
10
|
pSpawnFunction,
|
10
11
|
);
|
11
|
-
return
|
12
|
+
return lStatusOutput;
|
12
13
|
}
|
13
14
|
export async function getDiffLines(
|
14
15
|
pOldRevision,
|
@@ -22,23 +23,22 @@ export async function getDiffLines(
|
|
22
23
|
],
|
23
24
|
[129, `'${process.cwd()}' does not seem to be a git repository`],
|
24
25
|
]);
|
25
|
-
const
|
26
|
+
const lDiffOutput = await getGitResult(
|
26
27
|
pNewRevision
|
27
28
|
? ["diff", pOldRevision, pNewRevision, "--name-status"]
|
28
29
|
: ["diff", pOldRevision, "--name-status"],
|
29
30
|
lErrorMap,
|
30
31
|
pSpawnFunction,
|
31
32
|
);
|
32
|
-
return
|
33
|
+
return lDiffOutput;
|
33
34
|
}
|
34
35
|
export async function getSHA(pSpawnFunction = spawn) {
|
35
|
-
const
|
36
|
-
const lResult = await getGitResult(
|
36
|
+
const lRevParseOutput = await getGitResult(
|
37
37
|
["rev-parse", "HEAD"],
|
38
38
|
new Map(),
|
39
39
|
pSpawnFunction,
|
40
40
|
);
|
41
|
-
return
|
41
|
+
return lRevParseOutput.slice(0, SHA1_LENGTH);
|
42
42
|
}
|
43
43
|
function getGitResult(pArguments, pErrorMap, pSpawnFunction) {
|
44
44
|
const lGit = pSpawnFunction("git", pArguments, {
|
package/dist/version.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const VERSION = "4.2.
|
1
|
+
export const VERSION = "4.2.3";
|