watskeburt 4.0.1 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +2 -1
- package/dist/cli.js +57 -51
- package/dist/format/format.js +10 -4
- package/dist/format/json.js +1 -1
- package/dist/format/regex.js +17 -36
- package/dist/git-primitives.js +72 -72
- package/dist/main.js +20 -20
- package/dist/map-change-type.js +14 -14
- package/dist/parse-diff-lines.js +19 -19
- package/dist/parse-status-lines.js +22 -24
- package/dist/version.js +1 -1
- package/package.json +51 -51
- package/types/watskeburt.d.ts +53 -48
package/README.md
CHANGED
@@ -69,7 +69,8 @@ This emits a regex that contains all changed files that could be
|
|
69
69
|
source files in the JavaScript ecosystem (.js, .mjs, .ts, .tsx ...). It can
|
70
70
|
be used in e.g. dependency-cruiser's `--focus` and `--reaches` filters.
|
71
71
|
|
72
|
-
The JSON output (= the array above, serialized) also contains other
|
72
|
+
The JSON output (= the array above, serialized) also contains all other
|
73
|
+
extensions.
|
73
74
|
|
74
75
|
```
|
75
76
|
Usage: watskeburt [options] [old-revision] [new-revision]
|
package/dist/cli.js
CHANGED
@@ -14,60 +14,66 @@ Options:
|
|
14
14
|
-V, --version output the version number
|
15
15
|
-h, --help display help for command${EOL}`;
|
16
16
|
export async function cli(
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
17
|
+
pArguments = process.argv.slice(2),
|
18
|
+
pOutStream = process.stdout,
|
19
|
+
pErrorStream = process.stderr,
|
20
|
+
pErrorExitCode = 1,
|
21
21
|
) {
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
22
|
+
try {
|
23
|
+
const lArguments = getArguments(pArguments);
|
24
|
+
if (lArguments.values.help) {
|
25
|
+
pOutStream.write(HELP_MESSAGE);
|
26
|
+
return;
|
27
|
+
}
|
28
|
+
if (lArguments.values.version) {
|
29
|
+
pOutStream.write(`${VERSION}${EOL}`);
|
30
|
+
return;
|
31
|
+
}
|
32
|
+
if (!outputTypeIsValid(lArguments.values.outputType)) {
|
33
|
+
pErrorStream.write(
|
34
|
+
`error: option '-T, --outputType <type>' argument '${lArguments.values.outputType}' is invalid. Allowed choices are json, regex.${EOL}`,
|
35
|
+
);
|
36
|
+
process.exitCode = pErrorExitCode;
|
37
|
+
return;
|
38
|
+
}
|
39
|
+
const lResult = await list({
|
40
|
+
...lArguments.values,
|
41
|
+
oldRevision: lArguments.positionals[0],
|
42
|
+
newRevision: lArguments.positionals[1],
|
43
|
+
});
|
44
|
+
pOutStream.write(`${lResult}${EOL}`);
|
45
|
+
} catch (pError) {
|
46
|
+
pErrorStream.write(`${EOL}ERROR: ${pError.message}${EOL}${EOL}`);
|
47
|
+
process.exitCode = pErrorExitCode;
|
48
|
+
}
|
49
49
|
}
|
50
50
|
function getArguments(pArguments) {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
51
|
+
return parseArgs({
|
52
|
+
args: pArguments,
|
53
|
+
options: {
|
54
|
+
outputType: {
|
55
|
+
type: "string",
|
56
|
+
short: "T",
|
57
|
+
default: "regex",
|
58
|
+
},
|
59
|
+
trackedOnly: {
|
60
|
+
type: "boolean",
|
61
|
+
default: false,
|
62
|
+
},
|
63
|
+
extensions: {
|
64
|
+
type: "string",
|
65
|
+
short: "x",
|
66
|
+
default:
|
67
|
+
"cjs,cjsx,coffee,csx,cts,js,json,jsx,litcoffee,ls,mjs,mts,svelte,ts,tsx,vue,vuex",
|
68
|
+
},
|
69
|
+
help: { type: "boolean", short: "h", default: false },
|
70
|
+
version: { type: "boolean", short: "V", default: false },
|
71
|
+
},
|
72
|
+
strict: true,
|
73
|
+
allowPositionals: true,
|
74
|
+
tokens: false,
|
75
|
+
});
|
70
76
|
}
|
71
77
|
function outputTypeIsValid(pOutputType) {
|
72
|
-
|
78
|
+
return ["json", "regex"].includes(pOutputType);
|
73
79
|
}
|
package/dist/format/format.js
CHANGED
@@ -1,9 +1,15 @@
|
|
1
1
|
import formatAsRegex from "./regex.js";
|
2
2
|
import formatAsJSON from "./json.js";
|
3
3
|
const OUTPUT_TYPE_TO_FUNCTION = new Map([
|
4
|
-
|
5
|
-
|
4
|
+
["regex", formatAsRegex],
|
5
|
+
["json", formatAsJSON],
|
6
6
|
]);
|
7
|
-
export function format(pChanges, pOutputType) {
|
8
|
-
|
7
|
+
export function format(pChanges, pOutputType, pExtensions) {
|
8
|
+
const lExtensions = new Set(
|
9
|
+
pExtensions
|
10
|
+
.split(",")
|
11
|
+
.map((pExtension) => pExtension.trim())
|
12
|
+
.map((pExtension) => `.${pExtension}`),
|
13
|
+
);
|
14
|
+
return OUTPUT_TYPE_TO_FUNCTION.get(pOutputType)(pChanges, lExtensions);
|
9
15
|
}
|
package/dist/format/json.js
CHANGED
package/dist/format/regex.js
CHANGED
@@ -1,42 +1,23 @@
|
|
1
1
|
import { extname } from "node:path";
|
2
|
-
const DEFAULT_EXTENSIONS = new Set([
|
3
|
-
".cjs",
|
4
|
-
".cjsx",
|
5
|
-
".coffee",
|
6
|
-
".csx",
|
7
|
-
".cts",
|
8
|
-
".js",
|
9
|
-
".json",
|
10
|
-
".jsx",
|
11
|
-
".litcoffee",
|
12
|
-
".ls",
|
13
|
-
".mjs",
|
14
|
-
".mts",
|
15
|
-
".svelte",
|
16
|
-
".ts",
|
17
|
-
".tsx",
|
18
|
-
".vue",
|
19
|
-
".vuex",
|
20
|
-
]);
|
21
2
|
const DEFAULT_CHANGE_TYPES = new Set([
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
3
|
+
"modified",
|
4
|
+
"added",
|
5
|
+
"renamed",
|
6
|
+
"copied",
|
7
|
+
"untracked",
|
27
8
|
]);
|
28
9
|
export default function formatAsRegex(
|
29
|
-
|
30
|
-
|
31
|
-
|
10
|
+
pChanges,
|
11
|
+
pExtensions,
|
12
|
+
pChangeTypes = DEFAULT_CHANGE_TYPES,
|
32
13
|
) {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
14
|
+
const lChanges = pChanges
|
15
|
+
.filter(
|
16
|
+
(pChange) =>
|
17
|
+
pChangeTypes.has(pChange.type) &&
|
18
|
+
pExtensions.has(extname(pChange.name)),
|
19
|
+
)
|
20
|
+
.map(({ name }) => name.replace(/\\/g, "\\\\").replace(/\./g, "[.]"))
|
21
|
+
.join("|");
|
22
|
+
return `^(${lChanges})$`;
|
42
23
|
}
|
package/dist/git-primitives.js
CHANGED
@@ -1,84 +1,84 @@
|
|
1
1
|
import { spawn } from "node:child_process";
|
2
2
|
export async function getStatusShort(pSpawnFunction = spawn) {
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
3
|
+
const lErrorMap = new Map([
|
4
|
+
[129, `'${process.cwd()}' does not seem to be a git repository`],
|
5
|
+
]);
|
6
|
+
const lResult = await getGitResult(
|
7
|
+
["status", "--porcelain"],
|
8
|
+
lErrorMap,
|
9
|
+
pSpawnFunction,
|
10
|
+
);
|
11
|
+
return lResult;
|
12
12
|
}
|
13
13
|
export async function getDiffLines(
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
pOldRevision,
|
15
|
+
pNewRevision,
|
16
|
+
pSpawnFunction = spawn,
|
17
17
|
) {
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
18
|
+
const lErrorMap = new Map([
|
19
|
+
[
|
20
|
+
128,
|
21
|
+
`revision '${pOldRevision}' ${pNewRevision ? `(or '${pNewRevision}') ` : ""}unknown`,
|
22
|
+
],
|
23
|
+
[129, `'${process.cwd()}' does not seem to be a git repository`],
|
24
|
+
]);
|
25
|
+
const lResult = await getGitResult(
|
26
|
+
pNewRevision
|
27
|
+
? ["diff", pOldRevision, pNewRevision, "--name-status"]
|
28
|
+
: ["diff", pOldRevision, "--name-status"],
|
29
|
+
lErrorMap,
|
30
|
+
pSpawnFunction,
|
31
|
+
);
|
32
|
+
return lResult;
|
33
33
|
}
|
34
34
|
export async function getSHA(pSpawnFunction = spawn) {
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
35
|
+
const lSha1Length = 40;
|
36
|
+
const lResult = await getGitResult(
|
37
|
+
["rev-parse", "HEAD"],
|
38
|
+
new Map(),
|
39
|
+
pSpawnFunction,
|
40
|
+
);
|
41
|
+
return lResult.slice(0, lSha1Length);
|
42
42
|
}
|
43
43
|
function getGitResult(pArguments, pErrorMap, pSpawnFunction) {
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
44
|
+
const lGit = pSpawnFunction("git", pArguments, {
|
45
|
+
cwd: process.cwd(),
|
46
|
+
env: process.env,
|
47
|
+
});
|
48
|
+
let lStdOutData = "";
|
49
|
+
let lStdErrorData = "";
|
50
|
+
return new Promise((pResolve, pReject) => {
|
51
|
+
lGit.stdout?.on("data", (pData) => {
|
52
|
+
lStdOutData = lStdOutData.concat(pData);
|
53
|
+
});
|
54
|
+
lGit.stderr?.on("data", (pData) => {
|
55
|
+
lStdErrorData = lStdErrorData.concat(pData);
|
56
|
+
});
|
57
|
+
lGit.on("close", (pCode) => {
|
58
|
+
if (pCode === 0) {
|
59
|
+
pResolve(stringifyOutStream(lStdOutData));
|
60
|
+
} else {
|
61
|
+
pReject(
|
62
|
+
new Error(
|
63
|
+
pErrorMap.get(pCode ?? 0) ||
|
64
|
+
`internal git error: ${pCode} (${stringifyOutStream(lStdErrorData)})`,
|
65
|
+
),
|
66
|
+
);
|
67
|
+
}
|
68
|
+
});
|
69
|
+
lGit.on("error", (pError) => {
|
70
|
+
if (pError?.code === "ENOENT") {
|
71
|
+
pReject(new Error("git executable not found"));
|
72
|
+
} else {
|
73
|
+
pReject(new Error(`internal spawn error: ${pError}`));
|
74
|
+
}
|
75
|
+
});
|
76
|
+
});
|
77
77
|
}
|
78
78
|
function stringifyOutStream(pBufferOrString) {
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
79
|
+
if (pBufferOrString instanceof Buffer) {
|
80
|
+
return pBufferOrString.toString("utf8");
|
81
|
+
} else {
|
82
|
+
return pBufferOrString;
|
83
|
+
}
|
84
84
|
}
|
package/dist/main.js
CHANGED
@@ -2,26 +2,26 @@ import { parseDiffLines } from "./parse-diff-lines.js";
|
|
2
2
|
import { parseStatusLines } from "./parse-status-lines.js";
|
3
3
|
import * as primitives from "./git-primitives.js";
|
4
4
|
export async function list(pOptions) {
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
5
|
+
const lOldRevision = pOptions?.oldRevision || (await primitives.getSHA());
|
6
|
+
const lOptions = pOptions || {};
|
7
|
+
const [lDiffLines, lStatusLines] = await Promise.all([
|
8
|
+
primitives.getDiffLines(lOldRevision, pOptions?.newRevision),
|
9
|
+
!lOptions.trackedOnly ? primitives.getStatusShort() : "",
|
10
|
+
]);
|
11
|
+
let lChanges = parseDiffLines(lDiffLines);
|
12
|
+
if (!lOptions.trackedOnly) {
|
13
|
+
lChanges = lChanges.concat(
|
14
|
+
parseStatusLines(lStatusLines).filter(
|
15
|
+
({ type: changeType }) => changeType === "untracked",
|
16
|
+
),
|
17
|
+
);
|
18
|
+
}
|
19
|
+
if (!lOptions.outputType) {
|
20
|
+
return lChanges;
|
21
|
+
}
|
22
|
+
const { format } = await import("./format/format.js");
|
23
|
+
return format(lChanges, lOptions.outputType, lOptions.extensions);
|
24
24
|
}
|
25
25
|
export function getSHA() {
|
26
|
-
|
26
|
+
return primitives.getSHA();
|
27
27
|
}
|
package/dist/map-change-type.js
CHANGED
@@ -1,16 +1,16 @@
|
|
1
|
-
const
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
1
|
+
const CHANGE_TYPE_MAP = new Map([
|
2
|
+
["A", "added"],
|
3
|
+
["C", "copied"],
|
4
|
+
["D", "deleted"],
|
5
|
+
["M", "modified"],
|
6
|
+
["R", "renamed"],
|
7
|
+
["T", "type changed"],
|
8
|
+
["U", "unmerged"],
|
9
|
+
["B", "pairing broken"],
|
10
|
+
[" ", "unmodified"],
|
11
|
+
["?", "untracked"],
|
12
|
+
["!", "ignored"],
|
13
13
|
]);
|
14
|
-
export function
|
15
|
-
|
14
|
+
export function mapChangeType(pChar) {
|
15
|
+
return CHANGE_TYPE_MAP.get(pChar) ?? "unknown";
|
16
16
|
}
|
package/dist/parse-diff-lines.js
CHANGED
@@ -1,25 +1,25 @@
|
|
1
1
|
import { EOL } from "node:os";
|
2
|
-
import {
|
2
|
+
import { mapChangeType } from "./map-change-type.js";
|
3
3
|
const DIFF_NAME_STATUS_LINE_PATTERN =
|
4
|
-
|
4
|
+
/^(?<type>[ACDMRTUXB])(?<similarity>[0-9]{3})?[ \t]+(?<name>[^ \t]+)[ \t]*(?<newName>[^ \t]+)?$/;
|
5
5
|
export function parseDiffLines(pString) {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
return pString
|
7
|
+
.split(EOL)
|
8
|
+
.filter(Boolean)
|
9
|
+
.map(parseDiffLine)
|
10
|
+
.filter(({ name, type }) => Boolean(name) && Boolean(type));
|
11
11
|
}
|
12
12
|
export function parseDiffLine(pString) {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
13
|
+
const lMatchResult = pString.match(DIFF_NAME_STATUS_LINE_PATTERN);
|
14
|
+
const lReturnValue = {};
|
15
|
+
if (lMatchResult?.groups) {
|
16
|
+
lReturnValue.type = mapChangeType(lMatchResult.groups.type);
|
17
|
+
if (lMatchResult.groups.newName) {
|
18
|
+
lReturnValue.name = lMatchResult.groups.newName;
|
19
|
+
lReturnValue.oldName = lMatchResult.groups.name;
|
20
|
+
} else {
|
21
|
+
lReturnValue.name = lMatchResult.groups.name;
|
22
|
+
}
|
23
|
+
}
|
24
|
+
return lReturnValue;
|
25
25
|
}
|
@@ -1,30 +1,28 @@
|
|
1
1
|
import { EOL } from "node:os";
|
2
|
-
import {
|
2
|
+
import { mapChangeType } from "./map-change-type.js";
|
3
3
|
const DIFF_SHORT_STATUS_LINE_PATTERN =
|
4
|
-
|
4
|
+
/^(?<stagedType>[ ACDMRTUXB?!])(?<unStagedType>[ ACDMRTUXB?!])[ \t]+(?<name>[^ \t]+)(( -> )(?<newName>[^ \t]+))?$/;
|
5
5
|
export function parseStatusLines(pString) {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
6
|
+
return pString
|
7
|
+
.split(EOL)
|
8
|
+
.filter(Boolean)
|
9
|
+
.map(parseStatusLine)
|
10
|
+
.filter(({ name, type }) => Boolean(name) && Boolean(type));
|
11
11
|
}
|
12
12
|
export function parseStatusLine(pString) {
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
}
|
29
|
-
return lReturnValue;
|
13
|
+
const lMatchResult = pString.match(DIFF_SHORT_STATUS_LINE_PATTERN);
|
14
|
+
const lReturnValue = {};
|
15
|
+
if (lMatchResult?.groups) {
|
16
|
+
const lStagedType = mapChangeType(lMatchResult.groups.stagedType);
|
17
|
+
const lUnStagedType = mapChangeType(lMatchResult.groups.unStagedType);
|
18
|
+
lReturnValue.type =
|
19
|
+
lStagedType === "unmodified" ? lUnStagedType : lStagedType;
|
20
|
+
if (lMatchResult.groups.newName) {
|
21
|
+
lReturnValue.name = lMatchResult.groups.newName;
|
22
|
+
lReturnValue.oldName = lMatchResult.groups.name;
|
23
|
+
} else {
|
24
|
+
lReturnValue.name = lMatchResult.groups.name;
|
25
|
+
}
|
26
|
+
}
|
27
|
+
return lReturnValue;
|
30
28
|
}
|
package/dist/version.js
CHANGED
@@ -1 +1 @@
|
|
1
|
-
export const VERSION = "4.0
|
1
|
+
export const VERSION = "4.1.0";
|
package/package.json
CHANGED
@@ -1,53 +1,53 @@
|
|
1
1
|
{
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
2
|
+
"name": "watskeburt",
|
3
|
+
"version": "4.1.0",
|
4
|
+
"description": "List files changed since a git revision",
|
5
|
+
"keywords": [
|
6
|
+
"git",
|
7
|
+
"diff"
|
8
|
+
],
|
9
|
+
"homepage": "https://github.com/sverweij/watskeburt",
|
10
|
+
"repository": {
|
11
|
+
"type": "git",
|
12
|
+
"url": "git+https://github.com/sverweij/watskeburt.git"
|
13
|
+
},
|
14
|
+
"bugs": {
|
15
|
+
"url": "https://github.com/sverweij/watskeburt/issues"
|
16
|
+
},
|
17
|
+
"author": {
|
18
|
+
"name": "Sander Verweij",
|
19
|
+
"url": "https://sverweij.github.io"
|
20
|
+
},
|
21
|
+
"license": "MIT",
|
22
|
+
"bin": {
|
23
|
+
"watskeburt": "dist/run-cli.js"
|
24
|
+
},
|
25
|
+
"main": "dist/main.js",
|
26
|
+
"module": "dist/main.js",
|
27
|
+
"type": "module",
|
28
|
+
"sideEffects": false,
|
29
|
+
"exports": {
|
30
|
+
".": [
|
31
|
+
{
|
32
|
+
"types": "./types/watskeburt.d.ts",
|
33
|
+
"import": "./dist/main.js"
|
34
|
+
},
|
35
|
+
"./dist/main.js"
|
36
|
+
]
|
37
|
+
},
|
38
|
+
"types": "types/watskeburt.d.ts",
|
39
|
+
"files": [
|
40
|
+
"dist",
|
41
|
+
"!**/*.DS_Store",
|
42
|
+
"types",
|
43
|
+
"LICENSE",
|
44
|
+
"package.json",
|
45
|
+
"README.md"
|
46
|
+
],
|
47
|
+
"engines": {
|
48
|
+
"node": "^18||>=20"
|
49
|
+
},
|
50
|
+
"scripts": {
|
51
|
+
"test": "echo for test, build and static analysis scripts: see the github repository"
|
52
|
+
}
|
53
53
|
}
|
package/types/watskeburt.d.ts
CHANGED
@@ -1,65 +1,70 @@
|
|
1
1
|
export type changeType =
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
2
|
+
| "added"
|
3
|
+
| "copied"
|
4
|
+
| "deleted"
|
5
|
+
| "modified"
|
6
|
+
| "renamed"
|
7
|
+
| "type changed"
|
8
|
+
| "unmerged"
|
9
|
+
| "pairing broken"
|
10
|
+
| "unknown"
|
11
|
+
| "unmodified"
|
12
|
+
| "untracked"
|
13
|
+
| "ignored";
|
14
14
|
|
15
15
|
export interface IChange {
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
16
|
+
/**
|
17
|
+
* name of the file
|
18
|
+
*/
|
19
|
+
name: string;
|
20
|
+
/**
|
21
|
+
* how the file was changed
|
22
|
+
*/
|
23
|
+
type: changeType;
|
24
|
+
/**
|
25
|
+
* if the file was renamed: what the old file's name was
|
26
|
+
*/
|
27
|
+
oldName?: string;
|
28
28
|
}
|
29
29
|
|
30
30
|
export type outputTypeType = "regex" | "json";
|
31
31
|
|
32
32
|
export interface IBaseOptions {
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
33
|
+
/**
|
34
|
+
* The revision against which to compare. When not passed defaults to the
|
35
|
+
* _current_ commit hash (if there's any)
|
36
|
+
*/
|
37
|
+
oldRevision?: string;
|
38
|
+
/**
|
39
|
+
* Newer revision against which to compare. Leave out when you want to
|
40
|
+
* compare against the working tree
|
41
|
+
*/
|
42
|
+
newRevision?: string;
|
43
|
+
/**
|
44
|
+
* When true only takes already tracked files into account.
|
45
|
+
* When false also takes untracked files into account (default)
|
46
|
+
*/
|
47
|
+
trackedOnly?: boolean;
|
48
48
|
}
|
49
49
|
|
50
50
|
export interface IFormatOptions extends IBaseOptions {
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
51
|
+
/**
|
52
|
+
* The type of output to deliver.
|
53
|
+
*/
|
54
|
+
outputType: "regex" | "json";
|
55
|
+
|
56
|
+
/**
|
57
|
+
* A comma-separated list of file extensions to include in the output
|
58
|
+
*/
|
59
|
+
extensions: string;
|
55
60
|
}
|
56
61
|
|
57
62
|
export interface IInternalOptions extends IBaseOptions {
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
+
/**
|
64
|
+
* The type of output to deliver. undefined/ left out
|
65
|
+
* the outputType defaults to a list of `IChange`s
|
66
|
+
*/
|
67
|
+
outputType?: undefined;
|
63
68
|
}
|
64
69
|
|
65
70
|
export type IOptions = IFormatOptions | IInternalOptions;
|