ts-repo-utils 7.9.4 → 7.9.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/dist/cmd/assert-repo-is-clean.mjs +2 -1
- package/dist/cmd/assert-repo-is-clean.mjs.map +1 -1
- package/dist/cmd/check-should-run-type-checks.mjs +2 -1
- package/dist/cmd/check-should-run-type-checks.mjs.map +1 -1
- package/dist/cmd/format-diff-from.mjs +2 -1
- package/dist/cmd/format-diff-from.mjs.map +1 -1
- package/dist/cmd/format-uncommitted.mjs +2 -1
- package/dist/cmd/format-uncommitted.mjs.map +1 -1
- package/dist/cmd/gen-index-ts.mjs +2 -1
- package/dist/cmd/gen-index-ts.mjs.map +1 -1
- package/dist/functions/is-directly-executed.d.mts.map +1 -1
- package/dist/functions/is-directly-executed.mjs +4 -1
- package/dist/functions/is-directly-executed.mjs.map +1 -1
- package/package.json +42 -42
- package/src/cmd/assert-repo-is-clean.mts +1 -1
- package/src/cmd/check-should-run-type-checks.mts +1 -1
- package/src/cmd/format-diff-from.mts +1 -1
- package/src/cmd/format-uncommitted.mts +1 -1
- package/src/cmd/gen-index-ts.mts +1 -1
- package/src/functions/diff.test.mts +31 -31
- package/src/functions/exec-async.test.mts +18 -18
- package/src/functions/format.test.mts +26 -26
- package/src/functions/is-directly-executed.mts +4 -1
|
@@ -6,13 +6,14 @@ import { assertRepoIsClean } from '../functions/assert-repo-is-clean.mjs';
|
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import 'prettier';
|
|
8
8
|
import 'micromatch';
|
|
9
|
+
import 'node:fs';
|
|
9
10
|
import 'node:url';
|
|
10
11
|
import 'node:fs/promises';
|
|
11
12
|
import '@sindresorhus/is';
|
|
12
13
|
|
|
13
14
|
const cmdDef = cmd.command({
|
|
14
15
|
name: 'assert-repo-is-clean-cli',
|
|
15
|
-
version: '7.9.
|
|
16
|
+
version: '7.9.5',
|
|
16
17
|
args: {
|
|
17
18
|
silent: cmd.flag({
|
|
18
19
|
long: 'silent',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert-repo-is-clean.mjs","sources":["../../src/cmd/assert-repo-is-clean.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assert-repo-is-clean.mjs","sources":["../../src/cmd/assert-repo-is-clean.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;AAKA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;AACzB,IAAA,IAAI,EAAE,0BAA0B;AAChC,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ,QAAA,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC;AACf,YAAA,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EAAE,sDAAsD;SACpE,CAAC;AACH,KAAA;AACD,IAAA,OAAO,EAAE,CAAC,IAAI,KAAI;QAChB,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,KAAI;AAClC,YAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC;AAE1C,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ,CAAC;AACF,CAAA,CAAC;AAEF,MAAM,IAAI,GAAG,OAAO,IAAoC,KAAmB;IACzE,MAAM,iBAAiB,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -5,6 +5,7 @@ import '../node-global.mjs';
|
|
|
5
5
|
import 'node:child_process';
|
|
6
6
|
import 'prettier';
|
|
7
7
|
import 'micromatch';
|
|
8
|
+
import 'node:fs';
|
|
8
9
|
import 'node:url';
|
|
9
10
|
import 'node:fs/promises';
|
|
10
11
|
import { checkShouldRunTypeChecks } from '../functions/should-run.mjs';
|
|
@@ -12,7 +13,7 @@ import '@sindresorhus/is';
|
|
|
12
13
|
|
|
13
14
|
const cmdDef = cmd.command({
|
|
14
15
|
name: 'check-should-run-type-checks-cli',
|
|
15
|
-
version: '7.9.
|
|
16
|
+
version: '7.9.5',
|
|
16
17
|
args: {
|
|
17
18
|
pathsIgnore: cmd.multioption({
|
|
18
19
|
long: 'paths-ignore',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-should-run-type-checks.mjs","sources":["../../src/cmd/check-should-run-type-checks.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"check-should-run-type-checks.mjs","sources":["../../src/cmd/check-should-run-type-checks.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;AAKA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;AACzB,IAAA,IAAI,EAAE,kCAAkC;AACxC,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ,QAAA,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC;AAC3B,YAAA,IAAI,EAAE,cAAc;AACpB,YAAA,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACzC,YAAA,WAAW,EACT,0KAA0K;SAC7K,CAAC;AACF,QAAA,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC;AACrB,YAAA,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;AAC9B,YAAA,WAAW,EACT,yFAAyF;SAC5F,CAAC;AACH,KAAA;AACD,IAAA,OAAO,EAAE,CAAC,IAAI,KAAI;QAChB,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,KAAI;AAClC,YAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC;AAE1C,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ,CAAC;AACF,CAAA,CAAC;AAEF,MAAM,IAAI,GAAG,OACX,IAGE,KACe;AACjB,IAAA,MAAM,wBAAwB,CAAC;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;AAC5B,KAAA,CAAC;AACJ,CAAC;AAED,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -5,13 +5,14 @@ import '../node-global.mjs';
|
|
|
5
5
|
import 'node:child_process';
|
|
6
6
|
import { formatDiffFrom } from '../functions/format.mjs';
|
|
7
7
|
import 'micromatch';
|
|
8
|
+
import 'node:fs';
|
|
8
9
|
import 'node:url';
|
|
9
10
|
import 'node:fs/promises';
|
|
10
11
|
import '@sindresorhus/is';
|
|
11
12
|
|
|
12
13
|
const cmdDef = cmd.command({
|
|
13
14
|
name: 'format-diff-from-cli',
|
|
14
|
-
version: '7.9.
|
|
15
|
+
version: '7.9.5',
|
|
15
16
|
args: {
|
|
16
17
|
base: cmd.positional({
|
|
17
18
|
type: cmd.string,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-diff-from.mjs","sources":["../../src/cmd/format-diff-from.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"format-diff-from.mjs","sources":["../../src/cmd/format-diff-from.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAMA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;AACzB,IAAA,IAAI,EAAE,sBAAsB;AAC5B,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ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,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,IAAI,KAAK;AAChD,YAAA,eAAe,EAAE,IAAI,CAAC,eAAe,IAAI,KAAK;AAC9C,YAAA,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,KAAK;AAC1C,YAAA,aAAa,EAAE,IAAI,CAAC,aAAa,IAAI,IAAI;AACzC,YAAA,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,KAAK;AAC7B,SAAA,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,KAAI;AAC1B,YAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC;AAE1C,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ,CAAC;AACF,CAAA,CAAC;AAEF,MAAM,IAAI,GAAG,OACX,IAOE,KACe;IACjB,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE;AAC7C,QAAA,gBAAgB,EAAE,CAAC,IAAI,CAAC,gBAAgB;AACxC,QAAA,eAAe,EAAE,CAAC,IAAI,CAAC,eAAe;AACtC,QAAA,aAAa,EAAE,CAAC,IAAI,CAAC,aAAa;QAClC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,MAAM,EAAE,IAAI,CAAC,MAAM;AACpB,KAAA,CAAC;AAEF,IAAA,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACxB,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjB;AACF,CAAC;AAED,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -5,13 +5,14 @@ import '../node-global.mjs';
|
|
|
5
5
|
import 'node:child_process';
|
|
6
6
|
import { formatUncommittedFiles } from '../functions/format.mjs';
|
|
7
7
|
import 'micromatch';
|
|
8
|
+
import 'node:fs';
|
|
8
9
|
import 'node:url';
|
|
9
10
|
import 'node:fs/promises';
|
|
10
11
|
import '@sindresorhus/is';
|
|
11
12
|
|
|
12
13
|
const cmdDef = cmd.command({
|
|
13
14
|
name: 'format-uncommitted-cli',
|
|
14
|
-
version: '7.9.
|
|
15
|
+
version: '7.9.5',
|
|
15
16
|
args: {
|
|
16
17
|
excludeUntracked: cmd.flag({
|
|
17
18
|
long: 'exclude-untracked',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-uncommitted.mjs","sources":["../../src/cmd/format-uncommitted.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"format-uncommitted.mjs","sources":["../../src/cmd/format-uncommitted.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAMA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;AACzB,IAAA,IAAI,EAAE,wBAAwB;AAC9B,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ,QAAA,gBAAgB,EAAE,GAAG,CAAC,IAAI,CAAC;AACzB,YAAA,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EACT,oEAAoE;SACvE,CAAC;AACF,QAAA,eAAe,EAAE,GAAG,CAAC,IAAI,CAAC;AACxB,YAAA,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EACT,mEAAmE;SACtE,CAAC;AACF,QAAA,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC;AACtB,YAAA,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EACT,iEAAiE;SACpE,CAAC;AACF,QAAA,aAAa,EAAE,GAAG,CAAC,IAAI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B,KAAA,CAAC;AAEF,IAAA,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACxB,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjB;AACF,CAAC;AAED,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -5,6 +5,7 @@ import '../node-global.mjs';
|
|
|
5
5
|
import 'node:child_process';
|
|
6
6
|
import 'prettier';
|
|
7
7
|
import { genIndex } from '../functions/gen-index.mjs';
|
|
8
|
+
import 'node:fs';
|
|
8
9
|
import 'node:url';
|
|
9
10
|
import 'node:fs/promises';
|
|
10
11
|
import '@sindresorhus/is';
|
|
@@ -30,7 +31,7 @@ const nonEmptyArray = (t, commandName) => cmd.extendType(cmd.array(t), {
|
|
|
30
31
|
});
|
|
31
32
|
const cmdDef = cmd.command({
|
|
32
33
|
name: 'gen-index-ts-cli',
|
|
33
|
-
version: '7.9.
|
|
34
|
+
version: '7.9.5',
|
|
34
35
|
args: {
|
|
35
36
|
// required args
|
|
36
37
|
targetDirectory: cmd.positional({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gen-index-ts.mjs","sources":["../../src/cmd/gen-index-ts.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gen-index-ts.mjs","sources":["../../src/cmd/gen-index-ts.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;AAUA,MAAM,aAAa,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE;AAC/C,IAAA,IAAI,EAAE,CAAC,CAAC,KAAI;QACV,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,CAA2B,CAAC;;;AAI9C,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,CAA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BAAgB,EAChB,wBAAwB,EACxB,kBAAkB,EAClB,OAAO,EACP,aAAa,EACb,MAAM,GASN,KAAmB;AACnB,IAAA,MAAM,QAAQ,CAAC;AACb,QAAA,eAAe,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG;AAC3C,cAAE,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,EAAE;AACpD,cAAE,eAAe;QACnB,wBAAwB;QACxB,gBAAgB;QAChB,OAAO;QACP,kBAAkB;QAClB,aAAa;QACb,MAAM;AACP,KAAA,CAAC;AACJ,CAAC;AAED,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-directly-executed.d.mts","sourceRoot":"","sources":["../../src/functions/is-directly-executed.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-directly-executed.d.mts","sourceRoot":"","sources":["../../src/functions/is-directly-executed.mts"],"names":[],"mappings":"AAGA,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,OAGyB,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
1
2
|
import { fileURLToPath } from 'node:url';
|
|
2
3
|
|
|
3
|
-
const isDirectlyExecuted = (fileUrl) =>
|
|
4
|
+
const isDirectlyExecuted = (fileUrl) => process.argv[1] !== undefined &&
|
|
5
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
6
|
+
fs.realpathSync(fileURLToPath(fileUrl)) === fs.realpathSync(process.argv[1]);
|
|
4
7
|
|
|
5
8
|
export { isDirectlyExecuted };
|
|
6
9
|
//# sourceMappingURL=is-directly-executed.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-directly-executed.mjs","sources":["../../src/functions/is-directly-executed.mts"],"sourcesContent":[null],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"is-directly-executed.mjs","sources":["../../src/functions/is-directly-executed.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAGO,MAAM,kBAAkB,GAAG,CAAC,OAAe,KAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,SAAS;;IAE7B,EAAE,CAAC,YAAY,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-repo-utils",
|
|
3
|
-
"version": "7.9.
|
|
3
|
+
"version": "7.9.5",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript"
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"cspell": "cspell \"**\" --gitignore --gitignore-root ./ --no-progress",
|
|
45
45
|
"doc": "tsx ./scripts/cmd/gen-docs.mts",
|
|
46
46
|
"doc:embed": "tsx ./scripts/cmd/embed-samples.mts",
|
|
47
|
-
"doc:preview": "vite preview --config ./configs/vite.doc.config.
|
|
47
|
+
"doc:preview": "vite preview --config ./configs/vite.doc.config.mts",
|
|
48
48
|
"doc:watch": "typedoc --options ./configs/typedoc.config.mjs --watch",
|
|
49
49
|
"fmt": "pnpm run z:format-uncommitted",
|
|
50
50
|
"fmt:diff": "pnpm run z:format-diff-from origin/main",
|
|
@@ -77,7 +77,7 @@
|
|
|
77
77
|
"z:format-diff-from": "tsx ./src/cmd/format-diff-from.mjs",
|
|
78
78
|
"z:format-uncommitted": "tsx ./src/cmd/format-uncommitted.mjs",
|
|
79
79
|
"z:gen-index-ts": "tsx ./src/cmd/gen-index-ts.mjs",
|
|
80
|
-
"z:vitest": "vitest --config ./configs/vitest.config.
|
|
80
|
+
"z:vitest": "vitest --config ./configs/vitest.config.mts"
|
|
81
81
|
},
|
|
82
82
|
"dependencies": {
|
|
83
83
|
"@sindresorhus/is": "^7.1.1",
|
|
@@ -86,48 +86,48 @@
|
|
|
86
86
|
"fast-glob": "^3.3.3",
|
|
87
87
|
"micromatch": "^4.0.8",
|
|
88
88
|
"prettier": "^3.7.3",
|
|
89
|
-
"ts-data-forge": "^
|
|
90
|
-
"tsx": "^4.
|
|
89
|
+
"ts-data-forge": "^6.0.0",
|
|
90
|
+
"tsx": "^4.21.0"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@rollup/plugin-replace": "
|
|
94
|
-
"@rollup/plugin-strip": "
|
|
95
|
-
"@rollup/plugin-typescript": "
|
|
96
|
-
"@semantic-release/changelog": "
|
|
97
|
-
"@semantic-release/commit-analyzer": "
|
|
98
|
-
"@semantic-release/exec": "
|
|
99
|
-
"@semantic-release/git": "
|
|
100
|
-
"@semantic-release/github": "
|
|
101
|
-
"@semantic-release/npm": "
|
|
102
|
-
"@semantic-release/release-notes-generator": "
|
|
103
|
-
"@types/node": "
|
|
104
|
-
"@vitest/coverage-v8": "
|
|
105
|
-
"@vitest/ui": "
|
|
106
|
-
"conventional-changelog-conventionalcommits": "
|
|
107
|
-
"cspell": "
|
|
108
|
-
"dedent": "
|
|
93
|
+
"@rollup/plugin-replace": "6.0.3",
|
|
94
|
+
"@rollup/plugin-strip": "3.0.4",
|
|
95
|
+
"@rollup/plugin-typescript": "12.3.0",
|
|
96
|
+
"@semantic-release/changelog": "6.0.3",
|
|
97
|
+
"@semantic-release/commit-analyzer": "13.0.1",
|
|
98
|
+
"@semantic-release/exec": "7.1.0",
|
|
99
|
+
"@semantic-release/git": "10.0.1",
|
|
100
|
+
"@semantic-release/github": "12.0.2",
|
|
101
|
+
"@semantic-release/npm": "13.1.2",
|
|
102
|
+
"@semantic-release/release-notes-generator": "14.1.0",
|
|
103
|
+
"@types/node": "24.10.1",
|
|
104
|
+
"@vitest/coverage-v8": "4.0.14",
|
|
105
|
+
"@vitest/ui": "4.0.14",
|
|
106
|
+
"conventional-changelog-conventionalcommits": "9.1.0",
|
|
107
|
+
"cspell": "9.4.0",
|
|
108
|
+
"dedent": "1.7.0",
|
|
109
109
|
"eslint": "9.39.1",
|
|
110
|
-
"eslint-config-typed": "
|
|
111
|
-
"fast-glob": "
|
|
112
|
-
"github-settings-as-code": "
|
|
113
|
-
"jiti": "
|
|
114
|
-
"markdownlint": "
|
|
115
|
-
"markdownlint-cli2": "
|
|
116
|
-
"npm-run-all2": "
|
|
117
|
-
"prettier": "
|
|
118
|
-
"prettier-plugin-organize-imports": "
|
|
119
|
-
"prettier-plugin-packagejson": "
|
|
120
|
-
"rollup": "
|
|
121
|
-
"semantic-release": "
|
|
122
|
-
"ts-fortress": "
|
|
123
|
-
"ts-type-forge": "
|
|
124
|
-
"tslib": "
|
|
125
|
-
"tsx": "
|
|
126
|
-
"typedoc": "
|
|
127
|
-
"typedoc-github-theme": "
|
|
128
|
-
"typescript": "
|
|
129
|
-
"vite": "
|
|
130
|
-
"vitest": "
|
|
110
|
+
"eslint-config-typed": "4.0.5",
|
|
111
|
+
"fast-glob": "3.3.3",
|
|
112
|
+
"github-settings-as-code": "1.0.6",
|
|
113
|
+
"jiti": "2.6.1",
|
|
114
|
+
"markdownlint": "0.39.0",
|
|
115
|
+
"markdownlint-cli2": "0.19.1",
|
|
116
|
+
"npm-run-all2": "8.0.4",
|
|
117
|
+
"prettier": "3.7.3",
|
|
118
|
+
"prettier-plugin-organize-imports": "4.3.0",
|
|
119
|
+
"prettier-plugin-packagejson": "2.5.20",
|
|
120
|
+
"rollup": "4.53.3",
|
|
121
|
+
"semantic-release": "25.0.2",
|
|
122
|
+
"ts-fortress": "6.1.0",
|
|
123
|
+
"ts-type-forge": "2.3.0",
|
|
124
|
+
"tslib": "2.8.1",
|
|
125
|
+
"tsx": "4.20.6",
|
|
126
|
+
"typedoc": "0.28.15",
|
|
127
|
+
"typedoc-github-theme": "0.3.1",
|
|
128
|
+
"typescript": "5.9.3",
|
|
129
|
+
"vite": "7.2.6",
|
|
130
|
+
"vitest": "4.0.14"
|
|
131
131
|
},
|
|
132
132
|
"peerDependencies": {
|
|
133
133
|
"prettier": "^3.7.3"
|
package/src/cmd/gen-index-ts.mts
CHANGED
|
@@ -99,10 +99,10 @@ describe('diff', () => {
|
|
|
99
99
|
try {
|
|
100
100
|
const result = await repoFunctions.getUntrackedFiles({ silent: true });
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
assert.isTrue(Result.isOk(result));
|
|
103
103
|
|
|
104
104
|
if (Result.isOk(result)) {
|
|
105
|
-
|
|
105
|
+
assert.isTrue(Array.isArray(result.value));
|
|
106
106
|
}
|
|
107
107
|
} finally {
|
|
108
108
|
await cleanup();
|
|
@@ -124,7 +124,7 @@ describe('diff', () => {
|
|
|
124
124
|
|
|
125
125
|
const result = await repoFunctions.getUntrackedFiles({ silent: true });
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
assert.isTrue(Result.isOk(result));
|
|
128
128
|
|
|
129
129
|
if (Result.isOk(result)) {
|
|
130
130
|
const files = result.value;
|
|
@@ -157,7 +157,7 @@ describe('diff', () => {
|
|
|
157
157
|
|
|
158
158
|
const result = await repoFunctions.getUntrackedFiles({ silent: true });
|
|
159
159
|
|
|
160
|
-
|
|
160
|
+
assert.isTrue(Result.isOk(result));
|
|
161
161
|
|
|
162
162
|
if (Result.isOk(result)) {
|
|
163
163
|
const files = result.value;
|
|
@@ -199,7 +199,7 @@ describe('diff', () => {
|
|
|
199
199
|
|
|
200
200
|
const result = await repoFunctions.getUntrackedFiles({ silent: true });
|
|
201
201
|
|
|
202
|
-
|
|
202
|
+
assert.isTrue(Result.isOk(result));
|
|
203
203
|
|
|
204
204
|
if (Result.isOk(result)) {
|
|
205
205
|
const files = result.value;
|
|
@@ -221,7 +221,7 @@ describe('diff', () => {
|
|
|
221
221
|
try {
|
|
222
222
|
const result = await repoFunctions.getUntrackedFiles({ silent: true });
|
|
223
223
|
|
|
224
|
-
|
|
224
|
+
assert.isTrue(Result.isOk(result));
|
|
225
225
|
|
|
226
226
|
if (Result.isOk(result)) {
|
|
227
227
|
const files = result.value;
|
|
@@ -247,7 +247,7 @@ describe('diff', () => {
|
|
|
247
247
|
const result = await repoFunctions.getUntrackedFiles({ silent: true });
|
|
248
248
|
|
|
249
249
|
// Should always return a Result, either Ok or Err
|
|
250
|
-
|
|
250
|
+
assert.isTrue(Result.isOk(result) || Result.isErr(result));
|
|
251
251
|
} finally {
|
|
252
252
|
await cleanup();
|
|
253
253
|
}
|
|
@@ -261,7 +261,7 @@ describe('diff', () => {
|
|
|
261
261
|
try {
|
|
262
262
|
const result = await repoFunctions.getUntrackedFiles({ silent: true });
|
|
263
263
|
|
|
264
|
-
|
|
264
|
+
assert.isTrue(Result.isOk(result));
|
|
265
265
|
|
|
266
266
|
if (Result.isOk(result)) {
|
|
267
267
|
const files = result.value;
|
|
@@ -288,10 +288,10 @@ describe('diff', () => {
|
|
|
288
288
|
try {
|
|
289
289
|
const result = await repoFunctions.getUntrackedFiles({ silent: true });
|
|
290
290
|
|
|
291
|
-
|
|
291
|
+
assert.isTrue(Result.isOk(result));
|
|
292
292
|
|
|
293
293
|
if (Result.isOk(result)) {
|
|
294
|
-
|
|
294
|
+
assert.isTrue(Array.isArray(result.value));
|
|
295
295
|
}
|
|
296
296
|
} finally {
|
|
297
297
|
await cleanup();
|
|
@@ -308,10 +308,10 @@ describe('diff', () => {
|
|
|
308
308
|
try {
|
|
309
309
|
const result = await repoFunctions.getStagedFiles({ silent: true });
|
|
310
310
|
|
|
311
|
-
|
|
311
|
+
assert.isTrue(Result.isOk(result));
|
|
312
312
|
|
|
313
313
|
if (Result.isOk(result)) {
|
|
314
|
-
|
|
314
|
+
assert.isTrue(Array.isArray(result.value));
|
|
315
315
|
}
|
|
316
316
|
} finally {
|
|
317
317
|
await cleanup();
|
|
@@ -336,7 +336,7 @@ describe('diff', () => {
|
|
|
336
336
|
|
|
337
337
|
const result = await repoFunctions.getStagedFiles({ silent: true });
|
|
338
338
|
|
|
339
|
-
|
|
339
|
+
assert.isTrue(Result.isOk(result));
|
|
340
340
|
|
|
341
341
|
if (Result.isOk(result)) {
|
|
342
342
|
const files = result.value;
|
|
@@ -374,7 +374,7 @@ describe('diff', () => {
|
|
|
374
374
|
|
|
375
375
|
const result = await repoFunctions.getStagedFiles({ silent: true });
|
|
376
376
|
|
|
377
|
-
|
|
377
|
+
assert.isTrue(Result.isOk(result));
|
|
378
378
|
|
|
379
379
|
if (Result.isOk(result)) {
|
|
380
380
|
const files = result.value;
|
|
@@ -420,7 +420,7 @@ describe('diff', () => {
|
|
|
420
420
|
silent: true,
|
|
421
421
|
});
|
|
422
422
|
|
|
423
|
-
|
|
423
|
+
assert.isTrue(Result.isOk(resultExclude));
|
|
424
424
|
|
|
425
425
|
if (Result.isOk(resultExclude)) {
|
|
426
426
|
const files = resultExclude.value;
|
|
@@ -444,7 +444,7 @@ describe('diff', () => {
|
|
|
444
444
|
silent: true,
|
|
445
445
|
});
|
|
446
446
|
|
|
447
|
-
|
|
447
|
+
assert.isTrue(Result.isOk(resultInclude));
|
|
448
448
|
|
|
449
449
|
if (Result.isOk(resultInclude)) {
|
|
450
450
|
const files = resultInclude.value;
|
|
@@ -470,7 +470,7 @@ describe('diff', () => {
|
|
|
470
470
|
try {
|
|
471
471
|
const result = await repoFunctions.getStagedFiles({ silent: true });
|
|
472
472
|
|
|
473
|
-
|
|
473
|
+
assert.isTrue(Result.isOk(result));
|
|
474
474
|
|
|
475
475
|
if (Result.isOk(result)) {
|
|
476
476
|
const files = result.value;
|
|
@@ -495,10 +495,10 @@ describe('diff', () => {
|
|
|
495
495
|
try {
|
|
496
496
|
const result = await repoFunctions.getStagedFiles({ silent: true });
|
|
497
497
|
|
|
498
|
-
|
|
498
|
+
assert.isTrue(Result.isOk(result));
|
|
499
499
|
|
|
500
500
|
if (Result.isOk(result)) {
|
|
501
|
-
|
|
501
|
+
assert.isTrue(Array.isArray(result.value));
|
|
502
502
|
}
|
|
503
503
|
} finally {
|
|
504
504
|
await cleanup();
|
|
@@ -514,7 +514,7 @@ describe('diff', () => {
|
|
|
514
514
|
const result = await repoFunctions.getStagedFiles({ silent: true });
|
|
515
515
|
|
|
516
516
|
// Should always return a Result, either Ok or Err
|
|
517
|
-
|
|
517
|
+
assert.isTrue(Result.isOk(result) || Result.isErr(result));
|
|
518
518
|
} finally {
|
|
519
519
|
await cleanup();
|
|
520
520
|
}
|
|
@@ -530,10 +530,10 @@ describe('diff', () => {
|
|
|
530
530
|
try {
|
|
531
531
|
const result = await repoFunctions.getModifiedFiles({ silent: true });
|
|
532
532
|
|
|
533
|
-
|
|
533
|
+
assert.isTrue(Result.isOk(result));
|
|
534
534
|
|
|
535
535
|
if (Result.isOk(result)) {
|
|
536
|
-
|
|
536
|
+
assert.isTrue(Array.isArray(result.value));
|
|
537
537
|
}
|
|
538
538
|
} finally {
|
|
539
539
|
await cleanup();
|
|
@@ -565,7 +565,7 @@ describe('diff', () => {
|
|
|
565
565
|
|
|
566
566
|
const result = await repoFunctions.getModifiedFiles({ silent: true });
|
|
567
567
|
|
|
568
|
-
|
|
568
|
+
assert.isTrue(Result.isOk(result));
|
|
569
569
|
|
|
570
570
|
if (Result.isOk(result)) {
|
|
571
571
|
const files = result.value;
|
|
@@ -612,7 +612,7 @@ describe('diff', () => {
|
|
|
612
612
|
|
|
613
613
|
const result = await repoFunctions.getModifiedFiles({ silent: true });
|
|
614
614
|
|
|
615
|
-
|
|
615
|
+
assert.isTrue(Result.isOk(result));
|
|
616
616
|
|
|
617
617
|
if (Result.isOk(result)) {
|
|
618
618
|
const files = result.value;
|
|
@@ -654,7 +654,7 @@ describe('diff', () => {
|
|
|
654
654
|
silent: true,
|
|
655
655
|
});
|
|
656
656
|
|
|
657
|
-
|
|
657
|
+
assert.isTrue(Result.isOk(resultExclude));
|
|
658
658
|
|
|
659
659
|
if (Result.isOk(resultExclude)) {
|
|
660
660
|
const files = resultExclude.value;
|
|
@@ -668,7 +668,7 @@ describe('diff', () => {
|
|
|
668
668
|
silent: true,
|
|
669
669
|
});
|
|
670
670
|
|
|
671
|
-
|
|
671
|
+
assert.isTrue(Result.isOk(resultInclude));
|
|
672
672
|
|
|
673
673
|
if (Result.isOk(resultInclude)) {
|
|
674
674
|
const files = resultInclude.value;
|
|
@@ -688,7 +688,7 @@ describe('diff', () => {
|
|
|
688
688
|
try {
|
|
689
689
|
const result = await repoFunctions.getModifiedFiles({ silent: true });
|
|
690
690
|
|
|
691
|
-
|
|
691
|
+
assert.isTrue(Result.isOk(result));
|
|
692
692
|
|
|
693
693
|
if (Result.isOk(result)) {
|
|
694
694
|
const files = result.value;
|
|
@@ -713,10 +713,10 @@ describe('diff', () => {
|
|
|
713
713
|
try {
|
|
714
714
|
const result = await repoFunctions.getModifiedFiles({ silent: true });
|
|
715
715
|
|
|
716
|
-
|
|
716
|
+
assert.isTrue(Result.isOk(result));
|
|
717
717
|
|
|
718
718
|
if (Result.isOk(result)) {
|
|
719
|
-
|
|
719
|
+
assert.isTrue(Array.isArray(result.value));
|
|
720
720
|
}
|
|
721
721
|
} finally {
|
|
722
722
|
await cleanup();
|
|
@@ -732,7 +732,7 @@ describe('diff', () => {
|
|
|
732
732
|
const result = await repoFunctions.getModifiedFiles({ silent: true });
|
|
733
733
|
|
|
734
734
|
// Should always return a Result, either Ok or Err
|
|
735
|
-
|
|
735
|
+
assert.isTrue(Result.isOk(result) || Result.isErr(result));
|
|
736
736
|
} finally {
|
|
737
737
|
await cleanup();
|
|
738
738
|
}
|
|
@@ -763,7 +763,7 @@ describe('diff', () => {
|
|
|
763
763
|
silent: true,
|
|
764
764
|
});
|
|
765
765
|
|
|
766
|
-
|
|
766
|
+
assert.isTrue(Result.isOk(result) || Result.isErr(result));
|
|
767
767
|
} finally {
|
|
768
768
|
await cleanup();
|
|
769
769
|
}
|
|
@@ -28,7 +28,7 @@ describe('exec-async', () => {
|
|
|
28
28
|
test('should execute simple command successfully', async () => {
|
|
29
29
|
const result = await $('echo "hello world"', { silent: true });
|
|
30
30
|
|
|
31
|
-
|
|
31
|
+
assert.isTrue(Result.isOk(result));
|
|
32
32
|
|
|
33
33
|
if (Result.isOk(result)) {
|
|
34
34
|
expect(result.value.stdout.trim()).toBe('hello world');
|
|
@@ -40,7 +40,7 @@ describe('exec-async', () => {
|
|
|
40
40
|
test('should execute command with multiple lines of output', async () => {
|
|
41
41
|
const result = await $('echo "line1\nline2\nline3"', { silent: true });
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
assert.isTrue(Result.isOk(result));
|
|
44
44
|
|
|
45
45
|
if (Result.isOk(result)) {
|
|
46
46
|
expect(result.value.stdout.trim()).toBe('line1\nline2\nline3');
|
|
@@ -52,7 +52,7 @@ describe('exec-async', () => {
|
|
|
52
52
|
test('should handle empty output', async () => {
|
|
53
53
|
const result = await $('true', { silent: true });
|
|
54
54
|
|
|
55
|
-
|
|
55
|
+
assert.isTrue(Result.isOk(result));
|
|
56
56
|
|
|
57
57
|
if (Result.isOk(result)) {
|
|
58
58
|
expect(result.value.stdout).toBe('');
|
|
@@ -66,7 +66,7 @@ describe('exec-async', () => {
|
|
|
66
66
|
test('should handle command not found error', async () => {
|
|
67
67
|
const result = await $('nonexistent_command_xyz', { silent: true });
|
|
68
68
|
|
|
69
|
-
|
|
69
|
+
assert.isTrue(Result.isErr(result));
|
|
70
70
|
|
|
71
71
|
if (Result.isErr(result)) {
|
|
72
72
|
expect(result.value).toBeDefined();
|
|
@@ -78,7 +78,7 @@ describe('exec-async', () => {
|
|
|
78
78
|
test('should handle exit code error', async () => {
|
|
79
79
|
const result = await $('exit 1', { silent: true });
|
|
80
80
|
|
|
81
|
-
|
|
81
|
+
assert.isTrue(Result.isErr(result));
|
|
82
82
|
|
|
83
83
|
if (Result.isErr(result)) {
|
|
84
84
|
expect(result.value).toBeDefined();
|
|
@@ -92,7 +92,7 @@ describe('exec-async', () => {
|
|
|
92
92
|
silent: true,
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
assert.isTrue(Result.isErr(result));
|
|
96
96
|
|
|
97
97
|
if (Result.isErr(result)) {
|
|
98
98
|
expect(result.value).toBeDefined();
|
|
@@ -128,7 +128,7 @@ describe('exec-async', () => {
|
|
|
128
128
|
test('should return string with default encoding', async () => {
|
|
129
129
|
const result = await $('echo "test"', { silent: true });
|
|
130
130
|
|
|
131
|
-
|
|
131
|
+
assert.isTrue(Result.isOk(result));
|
|
132
132
|
|
|
133
133
|
if (Result.isOk(result)) {
|
|
134
134
|
expectTypeOf(result.value.stdout).toBeString();
|
|
@@ -141,24 +141,24 @@ describe('exec-async', () => {
|
|
|
141
141
|
encoding: 'buffer',
|
|
142
142
|
});
|
|
143
143
|
|
|
144
|
-
|
|
144
|
+
assert.isTrue(Result.isOk(result));
|
|
145
145
|
|
|
146
146
|
if (Result.isOk(result)) {
|
|
147
|
-
|
|
147
|
+
assert.isTrue(Buffer.isBuffer(result.value.stdout));
|
|
148
148
|
|
|
149
|
-
|
|
149
|
+
assert.isTrue(Buffer.isBuffer(result.value.stderr));
|
|
150
150
|
}
|
|
151
151
|
});
|
|
152
152
|
|
|
153
153
|
test('should return Buffer with null encoding', async () => {
|
|
154
154
|
const result = await $('echo "test"', { silent: true, encoding: null });
|
|
155
155
|
|
|
156
|
-
|
|
156
|
+
assert.isTrue(Result.isOk(result));
|
|
157
157
|
|
|
158
158
|
if (Result.isOk(result)) {
|
|
159
|
-
|
|
159
|
+
assert.isTrue(Buffer.isBuffer(result.value.stdout));
|
|
160
160
|
|
|
161
|
-
|
|
161
|
+
assert.isTrue(Buffer.isBuffer(result.value.stderr));
|
|
162
162
|
}
|
|
163
163
|
});
|
|
164
164
|
|
|
@@ -168,7 +168,7 @@ describe('exec-async', () => {
|
|
|
168
168
|
encoding: 'utf8',
|
|
169
169
|
});
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
assert.isTrue(Result.isOk(result));
|
|
172
172
|
|
|
173
173
|
if (Result.isOk(result)) {
|
|
174
174
|
expectTypeOf(result.value.stdout).toBeString();
|
|
@@ -184,7 +184,7 @@ describe('exec-async', () => {
|
|
|
184
184
|
silent: true,
|
|
185
185
|
});
|
|
186
186
|
|
|
187
|
-
|
|
187
|
+
assert.isTrue(Result.isOk(result));
|
|
188
188
|
|
|
189
189
|
if (Result.isOk(result)) {
|
|
190
190
|
expect(result.value.stdout.trim()).toBe('hello world');
|
|
@@ -194,7 +194,7 @@ describe('exec-async', () => {
|
|
|
194
194
|
test('should handle command chaining with &&', async () => {
|
|
195
195
|
const result = await $('echo "first" && echo "second"', { silent: true });
|
|
196
196
|
|
|
197
|
-
|
|
197
|
+
assert.isTrue(Result.isOk(result));
|
|
198
198
|
|
|
199
199
|
if (Result.isOk(result)) {
|
|
200
200
|
expect(result.value.stdout.trim()).toBe('first\nsecond');
|
|
@@ -204,7 +204,7 @@ describe('exec-async', () => {
|
|
|
204
204
|
test('should handle command chaining with ;', async () => {
|
|
205
205
|
const result = await $('echo "first"; echo "second"', { silent: true });
|
|
206
206
|
|
|
207
|
-
|
|
207
|
+
assert.isTrue(Result.isOk(result));
|
|
208
208
|
|
|
209
209
|
if (Result.isOk(result)) {
|
|
210
210
|
expect(result.value.stdout.trim()).toBe('first\nsecond');
|
|
@@ -216,7 +216,7 @@ describe('exec-async', () => {
|
|
|
216
216
|
silent: true,
|
|
217
217
|
});
|
|
218
218
|
|
|
219
|
-
|
|
219
|
+
assert.isTrue(Result.isErr(result));
|
|
220
220
|
});
|
|
221
221
|
});
|
|
222
222
|
|
|
@@ -74,7 +74,7 @@ describe(formatFilesGlob, () => {
|
|
|
74
74
|
// Format TypeScript files
|
|
75
75
|
const result = await formatFilesGlob(`${testDir}/*.ts`, { silent: true });
|
|
76
76
|
|
|
77
|
-
|
|
77
|
+
assert.isTrue(Result.isOk(result));
|
|
78
78
|
|
|
79
79
|
// Check that files were formatted
|
|
80
80
|
const content1 = await readTestFile(file1);
|
|
@@ -113,7 +113,7 @@ describe(formatFilesGlob, () => {
|
|
|
113
113
|
silent: true,
|
|
114
114
|
});
|
|
115
115
|
|
|
116
|
-
|
|
116
|
+
assert.isTrue(Result.isOk(result));
|
|
117
117
|
});
|
|
118
118
|
|
|
119
119
|
test('should handle nested directories with glob pattern', async () => {
|
|
@@ -136,7 +136,7 @@ describe(formatFilesGlob, () => {
|
|
|
136
136
|
silent: true,
|
|
137
137
|
});
|
|
138
138
|
|
|
139
|
-
|
|
139
|
+
assert.isTrue(Result.isOk(result));
|
|
140
140
|
|
|
141
141
|
// Check that nested file was formatted
|
|
142
142
|
const content = await readTestFile(nestedFile);
|
|
@@ -203,7 +203,7 @@ describe(formatFiles, () => {
|
|
|
203
203
|
silent: true,
|
|
204
204
|
});
|
|
205
205
|
|
|
206
|
-
|
|
206
|
+
assert.isTrue(Result.isOk(result));
|
|
207
207
|
|
|
208
208
|
// Check formatted content
|
|
209
209
|
const content1 = await readTestFile(file1);
|
|
@@ -235,7 +235,7 @@ describe(formatFiles, () => {
|
|
|
235
235
|
silent: true,
|
|
236
236
|
});
|
|
237
237
|
|
|
238
|
-
|
|
238
|
+
assert.isTrue(Result.isOk(result));
|
|
239
239
|
});
|
|
240
240
|
});
|
|
241
241
|
|
|
@@ -304,7 +304,7 @@ describe(formatUncommittedFiles, () => {
|
|
|
304
304
|
|
|
305
305
|
const result = await formatUncommittedFiles({ silent: true });
|
|
306
306
|
|
|
307
|
-
|
|
307
|
+
assert.isTrue(Result.isOk(result));
|
|
308
308
|
|
|
309
309
|
// Verify all git functions were called
|
|
310
310
|
expect(getUntrackedFiles).toHaveBeenCalledWith({ silent: true });
|
|
@@ -345,7 +345,7 @@ describe(formatUncommittedFiles, () => {
|
|
|
345
345
|
silent: true,
|
|
346
346
|
});
|
|
347
347
|
|
|
348
|
-
|
|
348
|
+
assert.isTrue(Result.isOk(result));
|
|
349
349
|
|
|
350
350
|
expect(getUntrackedFiles).toHaveBeenCalledWith({ silent: true });
|
|
351
351
|
|
|
@@ -376,7 +376,7 @@ describe(formatUncommittedFiles, () => {
|
|
|
376
376
|
silent: true,
|
|
377
377
|
});
|
|
378
378
|
|
|
379
|
-
|
|
379
|
+
assert.isTrue(Result.isOk(result));
|
|
380
380
|
|
|
381
381
|
expect(getUntrackedFiles).not.toHaveBeenCalled();
|
|
382
382
|
|
|
@@ -407,7 +407,7 @@ describe(formatUncommittedFiles, () => {
|
|
|
407
407
|
silent: true,
|
|
408
408
|
});
|
|
409
409
|
|
|
410
|
-
|
|
410
|
+
assert.isTrue(Result.isOk(result));
|
|
411
411
|
|
|
412
412
|
expect(getUntrackedFiles).not.toHaveBeenCalled();
|
|
413
413
|
|
|
@@ -450,7 +450,7 @@ describe(formatUncommittedFiles, () => {
|
|
|
450
450
|
silent: true,
|
|
451
451
|
});
|
|
452
452
|
|
|
453
|
-
|
|
453
|
+
assert.isTrue(Result.isOk(result));
|
|
454
454
|
|
|
455
455
|
expect(getUntrackedFiles).toHaveBeenCalledWith({ silent: true });
|
|
456
456
|
|
|
@@ -481,7 +481,7 @@ describe(formatUncommittedFiles, () => {
|
|
|
481
481
|
|
|
482
482
|
const result = await formatUncommittedFiles({ silent: true });
|
|
483
483
|
|
|
484
|
-
|
|
484
|
+
assert.isTrue(Result.isOk(result));
|
|
485
485
|
|
|
486
486
|
// Verify file was formatted (only once despite appearing in all categories)
|
|
487
487
|
const content = await fs.readFile(duplicateFile, 'utf8');
|
|
@@ -504,7 +504,7 @@ describe(formatUncommittedFiles, () => {
|
|
|
504
504
|
|
|
505
505
|
const result = await formatUncommittedFiles({ silent: true });
|
|
506
506
|
|
|
507
|
-
|
|
507
|
+
assert.isTrue(Result.isOk(result));
|
|
508
508
|
} finally {
|
|
509
509
|
await cleanupTest();
|
|
510
510
|
}
|
|
@@ -525,7 +525,7 @@ describe(formatUncommittedFiles, () => {
|
|
|
525
525
|
silent: true,
|
|
526
526
|
});
|
|
527
527
|
|
|
528
|
-
|
|
528
|
+
assert.isTrue(Result.isErr(result));
|
|
529
529
|
|
|
530
530
|
if (Result.isErr(result)) {
|
|
531
531
|
assert.deepStrictEqual(result.value, error);
|
|
@@ -550,7 +550,7 @@ describe(formatUncommittedFiles, () => {
|
|
|
550
550
|
silent: true,
|
|
551
551
|
});
|
|
552
552
|
|
|
553
|
-
|
|
553
|
+
assert.isTrue(Result.isErr(result));
|
|
554
554
|
|
|
555
555
|
if (Result.isErr(result)) {
|
|
556
556
|
assert.deepStrictEqual(result.value, error);
|
|
@@ -575,7 +575,7 @@ describe(formatUncommittedFiles, () => {
|
|
|
575
575
|
silent: true,
|
|
576
576
|
});
|
|
577
577
|
|
|
578
|
-
|
|
578
|
+
assert.isTrue(Result.isErr(result));
|
|
579
579
|
|
|
580
580
|
if (Result.isErr(result)) {
|
|
581
581
|
assert.deepStrictEqual(result.value, error);
|
|
@@ -605,12 +605,12 @@ describe(formatUncommittedFiles, () => {
|
|
|
605
605
|
|
|
606
606
|
const result1 = await formatUncommittedFiles({ silent: false });
|
|
607
607
|
|
|
608
|
-
|
|
608
|
+
assert.isTrue(Result.isOk(result1));
|
|
609
609
|
// With silent: false, console output may occur
|
|
610
610
|
|
|
611
611
|
const result2 = await formatUncommittedFiles({ silent: true });
|
|
612
612
|
|
|
613
|
-
|
|
613
|
+
assert.isTrue(Result.isOk(result2));
|
|
614
614
|
// With silent: true, console output should be suppressed
|
|
615
615
|
|
|
616
616
|
vi.unstubAllGlobals();
|
|
@@ -643,7 +643,7 @@ describe(formatUncommittedFiles, () => {
|
|
|
643
643
|
|
|
644
644
|
const result = await formatUncommittedFiles({ silent: true });
|
|
645
645
|
|
|
646
|
-
|
|
646
|
+
assert.isTrue(Result.isOk(result));
|
|
647
647
|
|
|
648
648
|
const content = await fs.readFile(path.join(testDir, testFile), 'utf8');
|
|
649
649
|
|
|
@@ -682,7 +682,7 @@ describe(formatUncommittedFiles, () => {
|
|
|
682
682
|
const result = await formatUncommittedFiles({ silent: true });
|
|
683
683
|
|
|
684
684
|
// Should handle error gracefully
|
|
685
|
-
|
|
685
|
+
assert.isTrue(Result.isOk(result) || Result.isErr(result));
|
|
686
686
|
} finally {
|
|
687
687
|
await cleanupTest();
|
|
688
688
|
}
|
|
@@ -733,7 +733,7 @@ describe(formatDiffFrom, () => {
|
|
|
733
733
|
|
|
734
734
|
const result = await formatDiffFrom('main', { silent: true });
|
|
735
735
|
|
|
736
|
-
|
|
736
|
+
assert.isTrue(Result.isOk(result));
|
|
737
737
|
|
|
738
738
|
// Check file was formatted
|
|
739
739
|
const content = await readTestFile(file1);
|
|
@@ -787,7 +787,7 @@ describe(formatDiffFrom, () => {
|
|
|
787
787
|
silent: true,
|
|
788
788
|
});
|
|
789
789
|
|
|
790
|
-
|
|
790
|
+
assert.isTrue(Result.isOk(result));
|
|
791
791
|
|
|
792
792
|
// Check both files were formatted
|
|
793
793
|
const diffContent = await readTestFile(diffFile);
|
|
@@ -841,7 +841,7 @@ describe(formatDiffFrom, () => {
|
|
|
841
841
|
silent: true,
|
|
842
842
|
});
|
|
843
843
|
|
|
844
|
-
|
|
844
|
+
assert.isTrue(Result.isOk(result));
|
|
845
845
|
|
|
846
846
|
// Verify both functions were called
|
|
847
847
|
expect(getDiffFrom).toHaveBeenCalledWith('main', { silent: true });
|
|
@@ -902,7 +902,7 @@ describe(formatDiffFrom, () => {
|
|
|
902
902
|
// Test default behavior (no options provided)
|
|
903
903
|
const result = await formatDiffFrom('main', { silent: true });
|
|
904
904
|
|
|
905
|
-
|
|
905
|
+
assert.isTrue(Result.isOk(result));
|
|
906
906
|
|
|
907
907
|
// Check all files were formatted
|
|
908
908
|
const diffContent = await readTestFile(diffFile);
|
|
@@ -976,7 +976,7 @@ describe(formatDiffFrom, () => {
|
|
|
976
976
|
silent: true,
|
|
977
977
|
});
|
|
978
978
|
|
|
979
|
-
|
|
979
|
+
assert.isTrue(Result.isOk(result));
|
|
980
980
|
|
|
981
981
|
// Check both files were formatted
|
|
982
982
|
const diffContent = await readTestFile(diffFile);
|
|
@@ -1033,7 +1033,7 @@ describe(formatDiffFrom, () => {
|
|
|
1033
1033
|
silent: true,
|
|
1034
1034
|
});
|
|
1035
1035
|
|
|
1036
|
-
|
|
1036
|
+
assert.isTrue(Result.isOk(result));
|
|
1037
1037
|
|
|
1038
1038
|
// Verify all functions were called
|
|
1039
1039
|
expect(getDiffFrom).toHaveBeenCalledWith('main', { silent: true });
|
|
@@ -1084,7 +1084,7 @@ describe(formatDiffFrom, () => {
|
|
|
1084
1084
|
silent: true,
|
|
1085
1085
|
});
|
|
1086
1086
|
|
|
1087
|
-
|
|
1087
|
+
assert.isTrue(Result.isOk(result));
|
|
1088
1088
|
|
|
1089
1089
|
// Check only diff file was formatted
|
|
1090
1090
|
const diffContent = await readTestFile(diffFile);
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
+
import * as fs from 'node:fs';
|
|
1
2
|
import { fileURLToPath } from 'node:url';
|
|
2
3
|
|
|
3
4
|
export const isDirectlyExecuted = (fileUrl: string): boolean =>
|
|
4
|
-
|
|
5
|
+
process.argv[1] !== undefined &&
|
|
6
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
7
|
+
fs.realpathSync(fileURLToPath(fileUrl)) === fs.realpathSync(process.argv[1]);
|