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 CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2022-2024 Sander Verweij
3
+ Copyright (c) 2022-2025 Sander Verweij
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
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(
@@ -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.split(",").map((pExtension) => `.${pExtension.trim()}`),
9
+ (pExtensions ?? "*")
10
+ .split(",")
11
+ .map((pExtension) => `.${pExtension.trim()}`),
10
12
  );
11
13
  return OUTPUT_TYPE_TO_FUNCTION.get(pOutputType)(pChanges, lExtensions);
12
14
  }
@@ -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 lResult = await getGitResult(
7
+ const lStatusOutput = await getGitResult(
7
8
  ["status", "--porcelain"],
8
9
  lErrorMap,
9
10
  pSpawnFunction,
10
11
  );
11
- return lResult;
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 lResult = await getGitResult(
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 lResult;
33
+ return lDiffOutput;
33
34
  }
34
35
  export async function getSHA(pSpawnFunction = spawn) {
35
- const lSha1Length = 40;
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 lResult.slice(0, lSha1Length);
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";
1
+ export const VERSION = "4.2.3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "watskeburt",
3
- "version": "4.2.1",
3
+ "version": "4.2.3",
4
4
  "description": "List files changed since a git revision",
5
5
  "keywords": [
6
6
  "git",