ts-repo-utils 10.6.2 → 10.7.0
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/README.md +26 -10
- package/dist/cmd/check-should-run-type-checks.mjs +1 -1
- package/dist/cmd/check-should-run-type-checks.mjs.map +1 -1
- package/dist/cmd/check-should-run.mjs +1 -1
- package/dist/cmd/check-should-run.mjs.map +1 -1
- package/dist/cmd/format-diff-from.mjs +1 -1
- package/dist/cmd/format-diff-from.mjs.map +1 -1
- package/dist/functions/diff.d.mts +13 -1
- package/dist/functions/diff.d.mts.map +1 -1
- package/dist/functions/diff.mjs +95 -24
- package/dist/functions/diff.mjs.map +1 -1
- package/dist/functions/exec-async.d.mts +13 -1
- package/dist/functions/exec-async.d.mts.map +1 -1
- package/dist/functions/exec-async.mjs.map +1 -1
- package/dist/functions/format.d.mts +2 -1
- package/dist/functions/format.d.mts.map +1 -1
- package/dist/functions/format.mjs +1 -0
- package/dist/functions/format.mjs.map +1 -1
- package/dist/functions/should-run.d.mts +4 -2
- package/dist/functions/should-run.d.mts.map +1 -1
- package/dist/functions/should-run.mjs +2 -0
- package/dist/functions/should-run.mjs.map +1 -1
- package/package.json +32 -30
- package/src/cmd/check-should-run-type-checks.mts +1 -1
- package/src/cmd/check-should-run.mts +1 -1
- package/src/cmd/format-diff-from.mts +2 -1
- package/src/functions/diff.mts +119 -30
- package/src/functions/diff.test.mts +111 -0
- package/src/functions/exec-async.mts +13 -1
- package/src/functions/format.mts +2 -1
- package/src/functions/should-run.mts +4 -2
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
## Documentation
|
|
6
6
|
|
|
7
|
-
- API reference: <https://noshiro-pf.github.io/ts-repo-utils/>
|
|
7
|
+
- API reference: <https://noshiro-pf.github.io/mono/ts-repo-utils/>
|
|
8
8
|
|
|
9
9
|
[](https://www.npmjs.com/package/ts-repo-utils)
|
|
10
10
|
[](https://github.com/noshiro-pf/mono/blob/main/libs/ts-repo-utils/LICENSE)
|
|
@@ -75,6 +75,7 @@ npm exec -- format-uncommitted --silent
|
|
|
75
75
|
- `--exclude-staged` - Exclude staged files (default: false)
|
|
76
76
|
- `--silent` - Suppress output messages (default: false)
|
|
77
77
|
- `--ignore-unknown` - Skip files without a Prettier parser instead of erroring (default: true)
|
|
78
|
+
- `--cwd <dir>` - Only format files within this directory (relative paths are resolved against the current working directory)
|
|
78
79
|
|
|
79
80
|
### `format-diff-from`
|
|
80
81
|
|
|
@@ -106,12 +107,13 @@ Example in npm scripts:
|
|
|
106
107
|
|
|
107
108
|
**Options:**
|
|
108
109
|
|
|
109
|
-
- `<base>` - Base branch name or commit hash to compare against (required)
|
|
110
|
+
- `<base>` - Base branch name or commit hash to compare against (required). It names exactly one revision and is handed to `git` as a single argument, never as part of a command line.
|
|
110
111
|
- `--exclude-untracked` - Exclude untracked files (default: false)
|
|
111
112
|
- `--exclude-modified` - Exclude modified files (default: false)
|
|
112
113
|
- `--exclude-staged` - Exclude staged files (default: false)
|
|
113
114
|
- `--silent` - Suppress output messages (default: false)
|
|
114
115
|
- `--ignore-unknown` - Skip files without a Prettier parser instead of erroring (default: true)
|
|
116
|
+
- `--cwd <dir>` - Only format files within this directory (relative paths are resolved against the current working directory)
|
|
115
117
|
|
|
116
118
|
### `gen-index-ts`
|
|
117
119
|
|
|
@@ -213,7 +215,7 @@ npm exec -- check-should-run \
|
|
|
213
215
|
- Directory prefixes: `docs/` (the same as `docs/**`)
|
|
214
216
|
- Globs: `**.md`, `libs/*/samples/**`
|
|
215
217
|
- Default: `[]` — nothing is ignored, so the step always runs when anything changed
|
|
216
|
-
- `--base-branch` - Base branch to compare against for determining changed files (default: `origin/main`)
|
|
218
|
+
- `--base-branch` - Base branch to compare against for determining changed files (default: `origin/main`). It names exactly one revision and is handed to `git` as a single argument, never as part of a command line.
|
|
217
219
|
|
|
218
220
|
An empty diff reads as "nothing changed", so it reports `should_run=false`. On a push to the base branch itself the diff against that branch is empty for that reason; pass the commit the branch pointed at before the push as `--base-branch` there.
|
|
219
221
|
|
|
@@ -250,7 +252,7 @@ npm exec -- check-should-run-type-checks \
|
|
|
250
252
|
|
|
251
253
|
- name: Run type checks
|
|
252
254
|
if: steps.check_diff.outputs.should_run == 'true'
|
|
253
|
-
run: npm run
|
|
255
|
+
run: npm run check:types
|
|
254
256
|
```
|
|
255
257
|
|
|
256
258
|
**Options:**
|
|
@@ -260,11 +262,11 @@ npm exec -- check-should-run-type-checks \
|
|
|
260
262
|
- Directory prefixes: `docs/` (matches any file in docs directory)
|
|
261
263
|
- File extensions: `**.md` (matches any markdown file)
|
|
262
264
|
- Default: `['LICENSE', '.editorconfig', '.gitignore', '.cspell.json', '.cspell.config.yaml', '.markdownlint-cli2.mjs', '.npmignore', '.prettierignore', '.prettierrc', 'docs/', '**.md', '**.txt']`
|
|
263
|
-
- `--base-branch` - Base branch to compare against for determining changed files (default: `origin/main`)
|
|
265
|
+
- `--base-branch` - Base branch to compare against for determining changed files (default: `origin/main`). It names exactly one revision and is handed to `git` as a single argument, never as part of a command line.
|
|
264
266
|
|
|
265
267
|
**GitHub Actions Integration:**
|
|
266
268
|
|
|
267
|
-
When running in GitHub Actions, the command
|
|
269
|
+
When running in GitHub Actions, the command appends `should_run=true` or `should_run=false` to the file named by the `GITHUB_OUTPUT` environment variable, which can be used in subsequent steps.
|
|
268
270
|
|
|
269
271
|
## API Reference
|
|
270
272
|
|
|
@@ -415,8 +417,8 @@ await assertExt({
|
|
|
415
417
|
type CheckExtConfig = Readonly<{
|
|
416
418
|
directories: readonly Readonly<{
|
|
417
419
|
path: string; // Directory path to check
|
|
418
|
-
extension: string; // Expected file extension (including the dot)
|
|
419
|
-
ignorePatterns?: readonly string[]; // Optional glob patterns to ignore
|
|
420
|
+
extension: `.${string}` | readonly `.${string}`[]; // Expected file extension(s) (including the dot)
|
|
421
|
+
ignorePatterns?: readonly string[]; // Optional glob patterns to ignore (default: ['tsconfig.json'])
|
|
420
422
|
}>[];
|
|
421
423
|
}>;
|
|
422
424
|
```
|
|
@@ -537,7 +539,9 @@ Runs `git diff --staged --name-only [--diff-filter=d]`
|
|
|
537
539
|
##### `getDiffFrom(base: string, options?)`
|
|
538
540
|
|
|
539
541
|
Gets files that differ from the specified base branch or commit.
|
|
540
|
-
Runs `git diff --name-only
|
|
542
|
+
Runs `git diff --name-only [--diff-filter=d] <base> --`
|
|
543
|
+
|
|
544
|
+
`base` names exactly one revision. It reaches `git` as a single argument and never as part of a command line, so whatever it contains is read as the name of a revision and nothing else; a `base` git cannot resolve comes back as an `Err`. A `base` beginning with `-` is rejected without invoking git, since git would read it as an option.
|
|
541
545
|
|
|
542
546
|
**Common options:**
|
|
543
547
|
|
|
@@ -601,7 +605,7 @@ const shouldRun2 = await checkShouldRunTypeChecks({
|
|
|
601
605
|
- Directory prefixes: `docs/` (the same as `docs/**`)
|
|
602
606
|
- Globs: `**.md` (matches any markdown file), `libs/*/samples/**`
|
|
603
607
|
- Default: `[]` for `checkShouldRun`; for `checkShouldRunTypeChecks`, `['LICENSE', '.editorconfig', '.gitignore', '.cspell.json', '.cspell.config.yaml', '.markdownlint-cli2.mjs', '.npmignore', '.prettierignore', '.prettierrc', 'docs/', '**.md', '**.txt']` — passing the option replaces that list rather than adding to it
|
|
604
|
-
- `baseBranch?` - Base branch to compare against (default: `origin/main`)
|
|
608
|
+
- `baseBranch?` - Base branch to compare against (default: `origin/main`). It names exactly one revision and reaches `git` as a single argument.
|
|
605
609
|
|
|
606
610
|
Both return whether the step should run, and, in GitHub Actions, append `should_run=<result>` to the file named by `GITHUB_OUTPUT`. An empty diff reads as "nothing changed" and so returns `false`.
|
|
607
611
|
|
|
@@ -679,6 +683,8 @@ type Ret = Promise<
|
|
|
679
683
|
Formats only files that differ from the specified base branch or commit.
|
|
680
684
|
(Function version of the `format-diff-from` command)
|
|
681
685
|
|
|
686
|
+
`base` is passed through to [`getDiffFrom`](#getdifffrombase-string-options), so it names exactly one revision and reaches `git` as a single argument.
|
|
687
|
+
|
|
682
688
|
```tsx
|
|
683
689
|
import { formatDiffFrom } from 'ts-repo-utils';
|
|
684
690
|
|
|
@@ -774,6 +780,15 @@ type GenIndexConfig = Readonly<{
|
|
|
774
780
|
|
|
775
781
|
/** Whether to suppress output during execution (default: false) */
|
|
776
782
|
silent?: boolean;
|
|
783
|
+
|
|
784
|
+
/** Minimum depth to start generating index files (default: 0) */
|
|
785
|
+
minDepth?: number;
|
|
786
|
+
|
|
787
|
+
/**
|
|
788
|
+
* Glob patterns of index files to leave untouched, matched against the index
|
|
789
|
+
* file's own path relative to the target directory (default: none)
|
|
790
|
+
*/
|
|
791
|
+
preserve?: readonly string[];
|
|
777
792
|
}>;
|
|
778
793
|
```
|
|
779
794
|
|
|
@@ -814,6 +829,7 @@ await runCmdInStagesAcrossWorkspaces({
|
|
|
814
829
|
- `cmd` - The npm script command to execute in each package
|
|
815
830
|
- `concurrency?` - Maximum packages to process simultaneously within each stage (default: 3)
|
|
816
831
|
- `filterWorkspacePattern?` - Optional function to filter packages by name
|
|
832
|
+
- `dependencyFields?` - Which `package.json` fields the stage ordering is derived from (default: `['dependencies', 'devDependencies', 'peerDependencies']`)
|
|
817
833
|
|
|
818
834
|
#### `runCmdInParallelAcrossWorkspaces(options): Promise<void>`
|
|
819
835
|
|
|
@@ -14,7 +14,7 @@ const cmdDef = cmd.command({
|
|
|
14
14
|
baseBranch: cmd.option({
|
|
15
15
|
long: 'base-branch',
|
|
16
16
|
type: cmd.optional(cmd.string),
|
|
17
|
-
description: 'Base branch to compare against for determining changed files. Defaults to "origin/main"',
|
|
17
|
+
description: 'Base branch to compare against for determining changed files. Names exactly one revision, and is passed to git as a single argument. Defaults to "origin/main"',
|
|
18
18
|
}),
|
|
19
19
|
},
|
|
20
20
|
handler: (args) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-should-run-type-checks.mjs","sourceRoot":"","sources":["../../src/cmd/check-should-run-type-checks.mts"],"names":[],"mappings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,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;YAC9B,WAAW,EACT,gKAAgK;SACnK,CAAC;KACH;IACD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YAClC,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;YAE3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,IAAI,GAAG,KAAK,EAChB,IAGE,EACa,EAAE;IACjB,MAAM,wBAAwB,CAAC;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -14,7 +14,7 @@ const cmdDef = cmd.command({
|
|
|
14
14
|
baseBranch: cmd.option({
|
|
15
15
|
long: 'base-branch',
|
|
16
16
|
type: cmd.optional(cmd.string),
|
|
17
|
-
description: 'Base branch to compare against for determining changed files. Defaults to "origin/main"',
|
|
17
|
+
description: 'Base branch to compare against for determining changed files. Names exactly one revision, and is passed to git as a single argument. Defaults to "origin/main"',
|
|
18
18
|
}),
|
|
19
19
|
},
|
|
20
20
|
handler: (args) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"check-should-run.mjs","sourceRoot":"","sources":["../../src/cmd/check-should-run.mts"],"names":[],"mappings":";AAEA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,eAAe,CAAC;AACpC,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,CAAC;KACH;IACD,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;QAChB,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;YAClC,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC,CAAC;YAE3C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC;CACF,CAAC,CAAC;AAEH,MAAM,IAAI,GAAG,KAAK,EAChB,IAGE,EACa,EAAE;IACjB,MAAM,cAAc,CAAC;QACnB,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;KAC5B,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -9,7 +9,7 @@ const cmdDef = cmd.command({
|
|
|
9
9
|
base: cmd.positional({
|
|
10
10
|
type: cmd.string,
|
|
11
11
|
displayName: 'base',
|
|
12
|
-
description: 'Base branch name or commit hash to compare against',
|
|
12
|
+
description: 'Base branch name or commit hash to compare against. Names exactly one revision, and is passed to git as a single argument.',
|
|
13
13
|
}),
|
|
14
14
|
excludeUntracked: cmd.flag({
|
|
15
15
|
long: 'exclude-untracked',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format-diff-from.mjs","sourceRoot":"","sources":["../../src/cmd/format-diff-from.mts"],"names":[],"mappings":";AAEA,OAAO,KAAK,GAAG,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAExD,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;IACzB,IAAI,EAAE,sBAAsB;IAC5B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ACxC,eAAe,EAAE,CAAC,IAAI,CAAC,eAAe;QACtC,aAAa,EAAE,CAAC,IAAI,CAAC,aAAa;QAClC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,MAAM,EAAE,IAAI,CAAC,MAAM;QACnB,GAAG,EAAE,IAAI,CAAC,GAAG;KACd,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC,CAAC;AAEF,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -46,7 +46,19 @@ export declare const getStagedFiles: (options?: Readonly<{
|
|
|
46
46
|
}>>>;
|
|
47
47
|
/**
|
|
48
48
|
* Get files that differ from the specified base branch or commit. Runs `git
|
|
49
|
-
* diff --name-only
|
|
49
|
+
* diff --name-only [--diff-filter=d] <base> --`
|
|
50
|
+
*
|
|
51
|
+
* `base` names exactly one revision. It reaches `git` as a single argument and
|
|
52
|
+
* never as a command line, so whatever it contains — whitespace, punctuation —
|
|
53
|
+
* is part of the revision name rather than further arguments, and a `base` that
|
|
54
|
+
* git does not resolve comes back as an `Err`. A value beginning with `-` is
|
|
55
|
+
* rejected before git is invoked, because git would read it as an option.
|
|
56
|
+
*
|
|
57
|
+
* `base` is the only caller-supplied value this module puts on a git
|
|
58
|
+
* invocation, which makes the two properties above the ones to preserve: see
|
|
59
|
+
* {@link execGit} for why they are handled as data rather than as text, and
|
|
60
|
+
* `tools/scripts/cmd/unblock-prs/util.mts` in this repository for the same
|
|
61
|
+
* leading-`-` rule applied to refs from an untrusted source.
|
|
50
62
|
*/
|
|
51
63
|
export declare const getDiffFrom: (base: string, options?: Readonly<{
|
|
52
64
|
/** @default true */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.mts","sourceRoot":"","sources":["../../src/functions/diff.mts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"diff.d.mts","sourceRoot":"","sources":["../../src/functions/diff.mts"],"names":[],"mappings":"AAAA,OAAO,EAAY,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAElE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAGvC;;GAEG;AACH,eAAO,MAAM,UAAU,aACX,QAAQ,CAAC;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,KACvC,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,aAAa,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAUvE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,aAClB,QAAQ,CAAC;IACjB,oBAAoB;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qBAAqB;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC,KACD,OAAO,CACR,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,aAAa,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAOtE,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,gBAAgB,aACjB,QAAQ,CAAC;IACjB,oBAAoB;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qBAAqB;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC,KACD,OAAO,CACR,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,aAAa,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAOtE,CAAC;AAEL;;;GAGG;AACH,eAAO,MAAM,cAAc,aACf,QAAQ,CAAC;IACjB,oBAAoB;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qBAAqB;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC,KACD,OAAO,CACR,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,aAAa,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAOtE,CAAC;AAEL;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,WAAW,SAChB,MAAM,YACF,QAAQ,CAAC;IACjB,oBAAoB;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qBAAqB;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC,KACD,OAAO,CACR,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,aAAa,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CAiBzE,CAAC"}
|
package/dist/functions/diff.mjs
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { execFile } from 'node:child_process';
|
|
1
2
|
import * as path from 'node:path';
|
|
2
3
|
import { Result } from 'ts-data-forge';
|
|
3
4
|
import { $ } from './exec-async.mjs';
|
|
@@ -18,9 +19,9 @@ export const getGitRoot = async (options) => {
|
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
export const getUntrackedFiles = async (options) => cmdResultToFiles({
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
args: ['ls-files', '--others', '--exclude-standard'],
|
|
23
|
+
argsToExcludeDeleted: [],
|
|
24
|
+
argsToIncludeDeleted: ['--deleted'],
|
|
24
25
|
options,
|
|
25
26
|
});
|
|
26
27
|
|
|
@@ -28,9 +29,9 @@ export const getUntrackedFiles = async (options) => cmdResultToFiles({
|
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
export const getModifiedFiles = async (options) => cmdResultToFiles({
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
args: ['diff', '--name-only'],
|
|
33
|
+
argsToExcludeDeleted: ['--diff-filter=d'],
|
|
34
|
+
argsToIncludeDeleted: [],
|
|
34
35
|
options,
|
|
35
36
|
});
|
|
36
37
|
|
|
@@ -38,36 +39,57 @@ export const getModifiedFiles = async (options) => cmdResultToFiles({
|
|
|
38
39
|
|
|
39
40
|
|
|
40
41
|
export const getStagedFiles = async (options) => cmdResultToFiles({
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
42
|
+
args: ['diff', '--staged', '--name-only'],
|
|
43
|
+
argsToExcludeDeleted: ['--diff-filter=d'],
|
|
44
|
+
argsToIncludeDeleted: [],
|
|
44
45
|
options,
|
|
45
46
|
});
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
export const getDiffFrom = async (base, options) => {
|
|
64
|
+
if (base.startsWith('-')) {
|
|
65
|
+
return Result.err({
|
|
66
|
+
message: `Invalid base "${base}": a base must name a revision, not an option.`,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
return cmdResultToFiles({
|
|
70
|
+
args: ['diff', '--name-only'],
|
|
71
|
+
argsToExcludeDeleted: ['--diff-filter=d'],
|
|
72
|
+
argsToIncludeDeleted: [],
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
trailingArgs: [base, '--'],
|
|
76
|
+
options,
|
|
77
|
+
});
|
|
78
|
+
};
|
|
79
|
+
const cmdResultToFiles = async ({ args, argsToExcludeDeleted, argsToIncludeDeleted, trailingArgs = [], options, }) => {
|
|
57
80
|
|
|
58
81
|
const gitRootResult = await getGitRoot({ silent: options?.silent ?? false });
|
|
59
82
|
if (Result.isErr(gitRootResult)) {
|
|
60
83
|
return gitRootResult;
|
|
61
84
|
}
|
|
62
85
|
const gitRoot = gitRootResult.value;
|
|
63
|
-
const result = await
|
|
64
|
-
|
|
65
|
-
(options?.excludeDeleted ?? true)
|
|
66
|
-
?
|
|
67
|
-
:
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
.join(' '), {
|
|
86
|
+
const result = await execGit([
|
|
87
|
+
...args,
|
|
88
|
+
...((options?.excludeDeleted ?? true)
|
|
89
|
+
? argsToExcludeDeleted
|
|
90
|
+
: argsToIncludeDeleted),
|
|
91
|
+
...trailingArgs,
|
|
92
|
+
], {
|
|
71
93
|
silent: options?.silent ?? false,
|
|
72
94
|
|
|
73
95
|
|
|
@@ -88,4 +110,53 @@ const cmdResultToFiles = async ({ cmd, cmdOptionToExcludeDeleted, cmdOptionToInc
|
|
|
88
110
|
.map((relativePath) => path.join(gitRoot, relativePath));
|
|
89
111
|
return Result.ok(files);
|
|
90
112
|
};
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
const execGit = async (args, options) => {
|
|
139
|
+
const { silent, cwd } = options;
|
|
140
|
+
if (!silent) {
|
|
141
|
+
console.info(`$ git ${args.join(' ')}`);
|
|
142
|
+
}
|
|
143
|
+
return new Promise((resolve) => {
|
|
144
|
+
execFile('git', args, { cwd, encoding: 'utf8' }, (error, stdout, stderr) => {
|
|
145
|
+
if (!silent) {
|
|
146
|
+
if (stdout !== '') {
|
|
147
|
+
console.info(stdout);
|
|
148
|
+
}
|
|
149
|
+
if (stderr !== '') {
|
|
150
|
+
console.error(stderr);
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
resolve(error === null
|
|
154
|
+
? Result.ok({
|
|
155
|
+
stdout,
|
|
156
|
+
stderr,
|
|
157
|
+
})
|
|
158
|
+
: Result.err(error));
|
|
159
|
+
});
|
|
160
|
+
});
|
|
161
|
+
};
|
|
91
162
|
//# sourceMappingURL=diff.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.mjs","sourceRoot":"","sources":["../../src/functions/diff.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"diff.mjs","sourceRoot":"","sources":["../../src/functions/diff.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAsB,MAAM,oBAAoB,CAAC;AAClE,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAC;AAErC;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,EAC7B,OAAwC,EACgC,EAAE;IAC1E,MAAM,MAAM,GAAG,MAAM,CAAC,CAAC,+BAA+B,EAAE;QACtD,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK;KACjC,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC;QACzB,OAAO,MAAM,CAAC;IAChB,CAAC;IAED,OAAO,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAC/C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,EACpC,OAKE,EAGF,EAAE,CACF,gBAAgB,CAAC;IACf,IAAI,EAAE,CAAC,UAAU,EAAE,UAAU,EAAE,oBAAoB,CAAC;IACpD,oBAAoB,EAAE,EAAE;IACxB,oBAAoB,EAAE,CAAC,WAAW,CAAC;IAC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;AACH,MAAM,OAAO,GAAG,KAAK,EACnB,IAAuB,EACvB,OAAmD,EAGnD,EAAE;IACF,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,GAAG,OAAO,CAAC;IAEhC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,CAAC,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE;QAC7B,QAAQ,CACN,KAAK,EACL,IAAI,EACJ,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,EACzB,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACxB,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;oBAClB,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;gBACvB,CAAC;gBAED,IAAI,MAAM,KAAK,EAAE,EAAE,CAAC;oBAClB,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;gBACxB,CAAC;YACH,CAAC;YAED,OAAO,CACL,KAAK,KAAK,IAAI;gBACZ,CAAC,CAAC,MAAM,CAAC,EAAE,CAA+C;oBACtD,MAAM;oBACN,MAAM;iBACP,CAAC;gBACJ,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CACtB,CAAC;QACJ,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -13,7 +13,19 @@ export type ExecResult<T extends string | Buffer> = Result<Readonly<{
|
|
|
13
13
|
/**
|
|
14
14
|
* Executes a shell command asynchronously.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
16
|
+
* `command` is a command line, and it is run by a shell. That is the contract,
|
|
17
|
+
* and it is what makes `$` useful — but it also means **a value that is data
|
|
18
|
+
* must not be interpolated into it**. A branch name, a path, a message, or
|
|
19
|
+
* anything else that came from a caller or from the environment stops being
|
|
20
|
+
* data once it is part of this string: the shell reads its punctuation as
|
|
21
|
+
* syntax, and whatever program runs then reads the rest as its own options.
|
|
22
|
+
*
|
|
23
|
+
* Build an argv and start the process without a shell instead — `execGit` in
|
|
24
|
+
* `diff.mts` is the example to copy. Use `$` for a command line that is
|
|
25
|
+
* entirely written here, in this repository, by us.
|
|
26
|
+
*
|
|
27
|
+
* @param command - The command to execute. A literal command line, not a
|
|
28
|
+
* template filled with values from elsewhere.
|
|
17
29
|
* @param options - Optional configuration for command execution.
|
|
18
30
|
* @returns A promise that resolves with the command result.
|
|
19
31
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec-async.d.mts","sourceRoot":"","sources":["../../src/functions/exec-async.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,KAAK,iBAAiB,GAAG,QAAQ,CAAC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC,CAAC;AAEH,KAAK,6BAA6B,GAChC,YAAY,CAAC,6BAA6B,GAAG,iBAAiB,CAAC;AAEjE,KAAK,6BAA6B,GAChC,YAAY,CAAC,6BAA6B,GAAG,iBAAiB,CAAC;AAKjE,MAAM,MAAM,WAAW,GAAG,YAAY,CAAC,WAAW,GAAG,iBAAiB,CAAC;AAEvE,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI,MAAM,CACxD,QAAQ,CAAC;IAAE,MAAM,EAAE,CAAC,CAAC;IAAC,MAAM,EAAE,CAAC,CAAA;CAAE,CAAC,EAClC,YAAY,CAAC,aAAa,CAC3B,CAAC;AAEF
|
|
1
|
+
{"version":3,"file":"exec-async.d.mts","sourceRoot":"","sources":["../../src/functions/exec-async.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,YAAY,MAAM,oBAAoB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C,QAAQ,CAAC;QAE5C,IAAI,QAAQ,KAAK,QAAQ,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YAC/C,yDAAyD;YACzD,YAAY,CAAC,IAAI,CACf,OAAO;YACP,oEAAoE;YACpE,iBAA+D,EAC/D,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;gBACxB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;YACtC,CAAC,CACF,CAAC;YAEF,OAAO;QACT,CAAC;QAED,yDAAyD;QACzD,YAAY,CAAC,IAAI,CACf,OAAO;QACP,oEAAoE;QACpE,iBAA+D,EAC/D,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,EAAE;YACxB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;QACtC,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,8EAA8E;AAC9E,MAAM,OAAO,GAAG,CAAC,KAAsB,EAAW,EAAE,CAClD,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC"}
|
|
@@ -44,7 +44,8 @@ export declare const formatUncommittedFiles: (options?: Readonly<{
|
|
|
44
44
|
* Format only files that differ from the specified base branch or commit
|
|
45
45
|
*
|
|
46
46
|
* @param base - Base branch name or commit hash to compare against (defaults to
|
|
47
|
-
* 'main')
|
|
47
|
+
* 'main'). It names exactly one revision and reaches `git` as a single
|
|
48
|
+
* argument; see {@link getDiffFrom}.
|
|
48
49
|
* @param options - Options for formatting
|
|
49
50
|
* @param options.includeUntracked - Include untracked files in addition to diff
|
|
50
51
|
* files (default is true)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.mts","sourceRoot":"","sources":["../../src/functions/format.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE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AAC;CACd,CAAC,KACD,OAAO,CACR,MAAM,CACJ,SAAS,EACT,aAAa,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,OAAO,EAAE,CACnE,CAgEF,CAAC;AA4BF;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,SACnB,MAAM,YACF,QAAQ,CAAC;IACjB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,MAAM,CAAC,EAAE,KAAK,GAAG,CAAC,CAAC,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,CAAC;IACjD;;;;;OAKG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CACd,CAAC,KACD,OAAO,CACR,MAAM,CACJ,SAAS,EACP,aAAa,GACb,QAAQ,CAAC;IACP,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,GACF,SAAS,OAAO,EAAE,CACrB,CA2FF,CAAC"}
|
|
@@ -274,6 +274,7 @@ const filterFilesByCwd = (files, cwd) => {
|
|
|
274
274
|
|
|
275
275
|
|
|
276
276
|
|
|
277
|
+
|
|
277
278
|
export const formatDiffFrom = async (base, options) => {
|
|
278
279
|
|
|
279
280
|
const { silent = false, includeUntracked = true, includeModified = true, includeStaged = true, ignoreUnknown = true, ignore, cwd, } = options ?? {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.mjs","sourceRoot":"","sources":["../../src/functions/format.mts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,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AE,GAAG,CAAC,CAAC;IAE/D,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,iBAAiB,GAAG;YACxB,gBAAgB,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,SAAS;YAChD,eAAe,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,SAAS;YAC9C,aAAa,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS;SAC3C,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC;QAEzB,MAAM,OAAO,GAAG;YACd,qCAAqC,IAAI,EAAE;YAC3C,iBAAiB;iBACd,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CACZ,CAAC,KAAK,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAC5D;iBACA,IAAI,CAAC,EAAE,CAAC;SACZ,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAEX,eAAe,CAAC,GAAG,OAAO,GAAG,EAAE,QAAQ,CAAC,CAAC;IAC3C,CAAC;IAED,IAAI,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,eAAe,CAAC,oBAAoB,CAAC,CAAC;QAEtC,OAAO,MAAM,CAAC,EAAE,CAAC,SAAS,CAAC,CAAC;IAC9B,CAAC;IAED,OAAO,WAAW,CAAC,QAAQ,EAAE;QAC3B,MAAM;QACN,aAAa;QACb,MAAM;KACP,CAAC,CAAC;AACL,CAAC,CAAC"}
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
* (`.editorconfig`) and ordinary globs (`**.md`, `docs/**`) both work.
|
|
49
49
|
* Defaults to `[]`, which ignores nothing.
|
|
50
50
|
* @param options.baseBranch - Base branch to compare against for determining
|
|
51
|
-
* changed files.
|
|
51
|
+
* changed files. It names exactly one revision and reaches `git` as a single
|
|
52
|
+
* argument; see {@link getDiffFrom}. Defaults to `'origin/main'`
|
|
52
53
|
* @returns Whether the step should run. An empty diff reads as "nothing
|
|
53
54
|
* changed" and so returns `false`. When running in GitHub Actions, also
|
|
54
55
|
* appends `should_run=true` or `should_run=false` to the file named by the
|
|
@@ -113,7 +114,8 @@ export declare const checkShouldRun: (options?: Readonly<{
|
|
|
113
114
|
* '.prettierrc', 'docs/', '**.md', '**.txt']`
|
|
114
115
|
*
|
|
115
116
|
* @param options.baseBranch - Base branch to compare against for determining
|
|
116
|
-
* changed files.
|
|
117
|
+
* changed files. It names exactly one revision and reaches `git` as a single
|
|
118
|
+
* argument; see {@link getDiffFrom}. Defaults to `'origin/main'`
|
|
117
119
|
* @returns A promise that resolves when the check is complete. The function
|
|
118
120
|
* will set the GITHUB_OUTPUT environment variable with `should_run=true` or
|
|
119
121
|
* `should_run=false` if running in GitHub Actions environment.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-run.d.mts","sourceRoot":"","sources":["../../src/functions/should-run.mts"],"names":[],"mappings":"AAMA
|
|
1
|
+
{"version":3,"file":"should-run.d.mts","sourceRoot":"","sources":["../../src/functions/should-run.mts"],"names":[],"mappings":"AAMA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,eAAO,MAAM,cAAc,aACf,QAAQ,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC,KACD,OAAO,CAAC,OAAO,CAyCjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,eAAO,MAAM,wBAAwB,aACzB,QAAQ,CAAC;IACjB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC,KACD,OAAO,CAAC,OAAO,CAId,CAAC"}
|
|
@@ -57,6 +57,7 @@ import { getDiffFrom, getGitRoot } from './diff.mjs';
|
|
|
57
57
|
|
|
58
58
|
|
|
59
59
|
|
|
60
|
+
|
|
60
61
|
|
|
61
62
|
|
|
62
63
|
export const checkShouldRun = async (options) => {
|
|
@@ -142,6 +143,7 @@ export const checkShouldRun = async (options) => {
|
|
|
142
143
|
|
|
143
144
|
|
|
144
145
|
|
|
146
|
+
|
|
145
147
|
|
|
146
148
|
|
|
147
149
|
export const checkShouldRunTypeChecks = async (options) => checkShouldRun({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-run.mjs","sourceRoot":"","sources":["../../src/functions/should-run.mts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"should-run.mjs","sourceRoot":"","sources":["../../src/functions/should-run.mts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACvC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAErD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EACjC,OAGE,EACgB,EAAE;IACpB,MAAM,WAAW,GAAG,OAAO,EAAE,WAAW,IAAI,EAAE,CAAC;IAE/C,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E,CAAC,UAAU,CAAC,aAAa,EAAE,cAAc,SAAS,IAAI,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4DG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,KAAK,EAC3C,OAGE,EACgB,EAAE,CACpB,cAAc,CAAC;IACb,WAAW,EAAE,OAAO,EAAE,WAAW,IAAI,2BAA2B;IAChE,UAAU,EAAE,OAAO,EAAE,UAAU;CAChC,CAAC,CAAC;AAEL,MAAM,2BAA2B,GAAG;IAClC,SAAS;IACT,eAAe;IACf,YAAY;IACZ,cAAc;IACd,qBAAqB;IACrB,wBAAwB;IACxB,YAAY;IACZ,iBAAiB;IACjB,aAAa;IACb,OAAO;IACP,OAAO;IACP,QAAQ;CACA,CAAC;AAEX;;;GAGG;AACH,MAAM,cAAc,GAAG,CAAC,OAAe,EAAU,EAAE,CACjD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,GAAG,OAAO,IAAc,CAAC,CAAC,CAAC,OAAO,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-repo-utils",
|
|
3
|
-
"version": "10.
|
|
3
|
+
"version": "10.7.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript"
|
|
@@ -57,14 +57,14 @@
|
|
|
57
57
|
"@types/node": "26.5.0",
|
|
58
58
|
"@vitest/coverage-v8": "5.0.0",
|
|
59
59
|
"@vitest/ui": "5.0.0",
|
|
60
|
-
"cspell": "10.
|
|
60
|
+
"cspell": "10.3.0",
|
|
61
61
|
"dedent": "1.7.2",
|
|
62
62
|
"esbuild": "0.28.2",
|
|
63
|
-
"eslint": "10.
|
|
64
|
-
"eslint-config-typed": "5.11.
|
|
65
|
-
"eslint-plugin-ts-data-forge": "0.
|
|
66
|
-
"eslint-plugin-ts-fortress": "1.2.
|
|
67
|
-
"eslint-plugin-ts-type-forge": "0.8.
|
|
63
|
+
"eslint": "10.10.0",
|
|
64
|
+
"eslint-config-typed": "5.11.10",
|
|
65
|
+
"eslint-plugin-ts-data-forge": "0.8.1",
|
|
66
|
+
"eslint-plugin-ts-fortress": "1.2.3",
|
|
67
|
+
"eslint-plugin-ts-type-forge": "0.8.4",
|
|
68
68
|
"jiti": "2.7.0",
|
|
69
69
|
"npm-run-all2": "9.0.3",
|
|
70
70
|
"prettier": "3.9.6",
|
|
@@ -85,7 +85,7 @@
|
|
|
85
85
|
"pnpm": ">=8.0.0"
|
|
86
86
|
},
|
|
87
87
|
"volta": {
|
|
88
|
-
"node": "26.8.
|
|
88
|
+
"node": "26.8.2"
|
|
89
89
|
},
|
|
90
90
|
"publishConfig": {
|
|
91
91
|
"access": "public",
|
|
@@ -93,35 +93,37 @@
|
|
|
93
93
|
},
|
|
94
94
|
"scripts": {
|
|
95
95
|
"build": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/build.mts",
|
|
96
|
-
"
|
|
96
|
+
"check:cspell": "cspell \"**\" --gitignore --gitignore-root ../../ --no-progress",
|
|
97
|
+
"check:dist": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/check-dist.mts",
|
|
97
98
|
"check:ext": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/check-ext.mts",
|
|
99
|
+
"check:lint": "eslint .",
|
|
100
|
+
"check:test": "pnpm run z:vitest:node run",
|
|
101
|
+
"check:test:cov": "pnpm run z:vitest:node run --coverage",
|
|
102
|
+
"check:types": "node ../../node_modules/typescript-native/bin/tsc --noEmit",
|
|
98
103
|
"check-all": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/check-all.mts",
|
|
99
|
-
"codemod": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/ts-codemod.mts --uncommitted --transformer append-as-const --transformer convert-to-readonly '{src,scripts,samples}/**/*.mts' && pnpm run fmt",
|
|
100
|
-
"codemod:diff": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/ts-codemod.mts --diff-from origin/main --transformer append-as-const --transformer convert-to-readonly '{src,scripts,samples}/**/*.mts' && pnpm run fmt",
|
|
101
|
-
"codemod:full": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/ts-codemod.mts --transformer append-as-const --transformer convert-to-readonly '{src,scripts,samples}/**/*.mts' && pnpm run fmt",
|
|
102
|
-
"cspell": "cspell \"**\" --gitignore --gitignore-root ../../ --no-progress",
|
|
103
104
|
"doc": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/gen-docs.mts",
|
|
104
|
-
"doc:embed": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/embed-examples.mts",
|
|
105
|
-
"doc:embed:jsdoc": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/embed-examples-in-jsdoc.mts",
|
|
106
105
|
"doc:preview": "vite preview --config ./configs/vite.doc.config.mts",
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"fmt
|
|
111
|
-
"
|
|
112
|
-
"
|
|
113
|
-
"lint": "eslint .",
|
|
114
|
-
"
|
|
115
|
-
"
|
|
106
|
+
"fix:codemod": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/ts-codemod.mts --uncommitted --transformer append-as-const --transformer convert-to-readonly '{src,scripts,samples}/**/*.mts' && pnpm run fix:fmt",
|
|
107
|
+
"fix:codemod:diff": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/ts-codemod.mts --diff-from origin/main --transformer append-as-const --transformer convert-to-readonly '{src,scripts,samples}/**/*.mts' && pnpm run fix:fmt",
|
|
108
|
+
"fix:codemod:full": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ../../libs/ts-codemod-cli/src/cmd/ts-codemod.mts --transformer append-as-const --transformer convert-to-readonly '{src,scripts,samples}/**/*.mts' && pnpm run fix:fmt",
|
|
109
|
+
"fix:fmt": "pnpm run z:format-uncommitted --cwd .",
|
|
110
|
+
"fix:fmt:diff": "pnpm run z:format-diff-from origin/main --cwd .",
|
|
111
|
+
"fix:fmt:full": "prettier --write .",
|
|
112
|
+
"fix:lint": "eslint . --fix",
|
|
113
|
+
"fmt": "pnpm run fix:fmt",
|
|
114
|
+
"gen": "run-s gen:index gen:readme gen:jsdoc",
|
|
115
|
+
"gen:index": "run-s gen:index:src fix:fmt",
|
|
116
|
+
"gen:index:src": "pnpm run z:gen-index-ts ./src --index-ext .mts --export-ext .mjs --target-ext .mts --target-ext .tsx --exclude entry-point.mts --exclude cmd",
|
|
117
|
+
"gen:jsdoc": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/embed-examples-in-jsdoc.mts",
|
|
118
|
+
"gen:readme": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./scripts/cmd/embed-examples.mts",
|
|
119
|
+
"prepare-release": "run-s sync-cli-versions fix:fmt build doc",
|
|
116
120
|
"sync-cli-versions": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json scripts/cmd/sync-cli-versions.mts",
|
|
117
|
-
"test": "pnpm run
|
|
118
|
-
"test:cov": "pnpm run z:vitest:node run --coverage",
|
|
121
|
+
"test": "pnpm run check:test",
|
|
119
122
|
"test:cov:ui": "vite preview --outDir ./coverage",
|
|
120
123
|
"test:ui": "pnpm run z:vitest:node --ui",
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"type-check": "node ../../node_modules/typescript-native/bin/tsc --noEmit",
|
|
124
|
+
"watch:doc": "typedoc --options ./configs/typedoc.config.mjs --watch",
|
|
125
|
+
"watch:test": "pnpm run z:vitest:node watch",
|
|
126
|
+
"watch:types": "node ../../node_modules/typescript-native/bin/tsc --noEmit --watch -p ./tsconfig.json",
|
|
125
127
|
"z:assert-repo-is-clean": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./src/cmd/assert-repo-is-clean.mts",
|
|
126
128
|
"z:check-should-run-type-checks": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./src/cmd/check-should-run-type-checks.mts",
|
|
127
129
|
"z:format-diff-from": "tsx --tsconfig ../../tools/configs/tsconfig.tsx.json ./src/cmd/format-diff-from.mts",
|
|
@@ -18,7 +18,7 @@ const cmdDef = cmd.command({
|
|
|
18
18
|
long: 'base-branch',
|
|
19
19
|
type: cmd.optional(cmd.string),
|
|
20
20
|
description:
|
|
21
|
-
'Base branch to compare against for determining changed files. Defaults to "origin/main"',
|
|
21
|
+
'Base branch to compare against for determining changed files. Names exactly one revision, and is passed to git as a single argument. Defaults to "origin/main"',
|
|
22
22
|
}),
|
|
23
23
|
},
|
|
24
24
|
handler: (args) => {
|
|
@@ -18,7 +18,7 @@ const cmdDef = cmd.command({
|
|
|
18
18
|
long: 'base-branch',
|
|
19
19
|
type: cmd.optional(cmd.string),
|
|
20
20
|
description:
|
|
21
|
-
'Base branch to compare against for determining changed files. Defaults to "origin/main"',
|
|
21
|
+
'Base branch to compare against for determining changed files. Names exactly one revision, and is passed to git as a single argument. Defaults to "origin/main"',
|
|
22
22
|
}),
|
|
23
23
|
},
|
|
24
24
|
handler: (args) => {
|
|
@@ -11,7 +11,8 @@ const cmdDef = cmd.command({
|
|
|
11
11
|
base: cmd.positional({
|
|
12
12
|
type: cmd.string,
|
|
13
13
|
displayName: 'base',
|
|
14
|
-
description:
|
|
14
|
+
description:
|
|
15
|
+
'Base branch name or commit hash to compare against. Names exactly one revision, and is passed to git as a single argument.',
|
|
15
16
|
}),
|
|
16
17
|
excludeUntracked: cmd.flag({
|
|
17
18
|
long: 'exclude-untracked',
|
package/src/functions/diff.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ExecException } from 'node:child_process';
|
|
1
|
+
import { execFile, type ExecException } from 'node:child_process';
|
|
2
2
|
import * as path from 'node:path';
|
|
3
3
|
import { Result } from 'ts-data-forge';
|
|
4
4
|
import { $ } from './exec-async.mjs';
|
|
@@ -35,9 +35,9 @@ export const getUntrackedFiles = async (
|
|
|
35
35
|
Result<readonly string[], ExecException | Readonly<{ message: string }>>
|
|
36
36
|
> =>
|
|
37
37
|
cmdResultToFiles({
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
38
|
+
args: ['ls-files', '--others', '--exclude-standard'],
|
|
39
|
+
argsToExcludeDeleted: [],
|
|
40
|
+
argsToIncludeDeleted: ['--deleted'],
|
|
41
41
|
options,
|
|
42
42
|
});
|
|
43
43
|
|
|
@@ -56,9 +56,9 @@ export const getModifiedFiles = async (
|
|
|
56
56
|
Result<readonly string[], ExecException | Readonly<{ message: string }>>
|
|
57
57
|
> =>
|
|
58
58
|
cmdResultToFiles({
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
59
|
+
args: ['diff', '--name-only'],
|
|
60
|
+
argsToExcludeDeleted: ['--diff-filter=d'], // lower case 'd' means exclude deleted files
|
|
61
|
+
argsToIncludeDeleted: [],
|
|
62
62
|
options,
|
|
63
63
|
});
|
|
64
64
|
|
|
@@ -77,15 +77,27 @@ export const getStagedFiles = async (
|
|
|
77
77
|
Result<readonly string[], ExecException | Readonly<{ message: string }>>
|
|
78
78
|
> =>
|
|
79
79
|
cmdResultToFiles({
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
80
|
+
args: ['diff', '--staged', '--name-only'],
|
|
81
|
+
argsToExcludeDeleted: ['--diff-filter=d'], // lower case 'd' means exclude deleted files
|
|
82
|
+
argsToIncludeDeleted: [],
|
|
83
83
|
options,
|
|
84
84
|
});
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* Get files that differ from the specified base branch or commit. Runs `git
|
|
88
|
-
* diff --name-only
|
|
88
|
+
* diff --name-only [--diff-filter=d] <base> --`
|
|
89
|
+
*
|
|
90
|
+
* `base` names exactly one revision. It reaches `git` as a single argument and
|
|
91
|
+
* never as a command line, so whatever it contains — whitespace, punctuation —
|
|
92
|
+
* is part of the revision name rather than further arguments, and a `base` that
|
|
93
|
+
* git does not resolve comes back as an `Err`. A value beginning with `-` is
|
|
94
|
+
* rejected before git is invoked, because git would read it as an option.
|
|
95
|
+
*
|
|
96
|
+
* `base` is the only caller-supplied value this module puts on a git
|
|
97
|
+
* invocation, which makes the two properties above the ones to preserve: see
|
|
98
|
+
* {@link execGit} for why they are handled as data rather than as text, and
|
|
99
|
+
* `tools/scripts/cmd/unblock-prs/util.mts` in this repository for the same
|
|
100
|
+
* leading-`-` rule applied to refs from an untrusted source.
|
|
89
101
|
*/
|
|
90
102
|
export const getDiffFrom = async (
|
|
91
103
|
base: string,
|
|
@@ -97,23 +109,35 @@ export const getDiffFrom = async (
|
|
|
97
109
|
}>,
|
|
98
110
|
): Promise<
|
|
99
111
|
Result<readonly string[], ExecException | Readonly<{ message: string }>>
|
|
100
|
-
> =>
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
112
|
+
> => {
|
|
113
|
+
if (base.startsWith('-')) {
|
|
114
|
+
return Result.err({
|
|
115
|
+
message: `Invalid base "${base}": a base must name a revision, not an option.`,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
return cmdResultToFiles({
|
|
120
|
+
args: ['diff', '--name-only'],
|
|
121
|
+
argsToExcludeDeleted: ['--diff-filter=d'],
|
|
122
|
+
argsToIncludeDeleted: [],
|
|
123
|
+
// `--` ends the revision list, so a base that happens to match a path in
|
|
124
|
+
// the working tree is still read as a revision.
|
|
125
|
+
trailingArgs: [base, '--'],
|
|
105
126
|
options,
|
|
106
127
|
});
|
|
128
|
+
};
|
|
107
129
|
|
|
108
130
|
const cmdResultToFiles = async ({
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
131
|
+
args,
|
|
132
|
+
argsToExcludeDeleted,
|
|
133
|
+
argsToIncludeDeleted,
|
|
134
|
+
trailingArgs = [],
|
|
112
135
|
options,
|
|
113
136
|
}: Readonly<{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
137
|
+
args: readonly string[];
|
|
138
|
+
argsToExcludeDeleted: readonly string[];
|
|
139
|
+
argsToIncludeDeleted: readonly string[];
|
|
140
|
+
trailingArgs?: readonly string[];
|
|
117
141
|
options?: Readonly<{
|
|
118
142
|
/** @default true */
|
|
119
143
|
excludeDeleted?: boolean;
|
|
@@ -132,15 +156,14 @@ const cmdResultToFiles = async ({
|
|
|
132
156
|
|
|
133
157
|
const gitRoot = gitRootResult.value;
|
|
134
158
|
|
|
135
|
-
const result = await
|
|
159
|
+
const result = await execGit(
|
|
136
160
|
[
|
|
137
|
-
|
|
138
|
-
(options?.excludeDeleted ?? true)
|
|
139
|
-
?
|
|
140
|
-
:
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
.join(' '),
|
|
161
|
+
...args,
|
|
162
|
+
...((options?.excludeDeleted ?? true)
|
|
163
|
+
? argsToExcludeDeleted
|
|
164
|
+
: argsToIncludeDeleted),
|
|
165
|
+
...trailingArgs,
|
|
166
|
+
],
|
|
144
167
|
{
|
|
145
168
|
silent: options?.silent ?? false,
|
|
146
169
|
// Run git from the repository root so that `git ls-files` (which
|
|
@@ -167,3 +190,69 @@ const cmdResultToFiles = async ({
|
|
|
167
190
|
|
|
168
191
|
return Result.ok(files);
|
|
169
192
|
};
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* Runs `git` with `args` handed to the process one argument at a time. No shell
|
|
196
|
+
* is involved, so each entry of `args` arrives at git exactly as written.
|
|
197
|
+
*
|
|
198
|
+
* **This is deliberately not {@link $}, and the difference is a security
|
|
199
|
+
* boundary rather than a matter of taste.** `$` takes a _command line_ and runs
|
|
200
|
+
* it through a shell (see its own documentation, which says so). The values
|
|
201
|
+
* these functions pass come from their callers, and a caller's value is data:
|
|
202
|
+
* a branch name, a commit-ish. Interpolating data into a command line makes the
|
|
203
|
+
* shell — and then `git`'s own option parser — read parts of it as syntax, so a
|
|
204
|
+
* caller that happens to have wired an externally-influenced value into `base`
|
|
205
|
+
* would be handing whoever controls that value the ability to run commands in
|
|
206
|
+
* the process, or to write files through options like `git diff --output=`.
|
|
207
|
+
* That is not hypothetical for a published library: `base` is documented as a
|
|
208
|
+
* branch name or commit hash, so nothing warns a consumer that the value has to
|
|
209
|
+
* be shell-safe, and a ref name may legitimately contain characters a shell
|
|
210
|
+
* treats as syntax.
|
|
211
|
+
*
|
|
212
|
+
* With `execFile` there is no command line to be part of. Every element of
|
|
213
|
+
* `args` is one argv entry, whatever it contains — whitespace, punctuation,
|
|
214
|
+
* anything — so data cannot become commands or extra options.
|
|
215
|
+
*
|
|
216
|
+
* Keep it that way: do not rewrite this to build a string, and do not route
|
|
217
|
+
* caller-supplied values through `$`.
|
|
218
|
+
*/
|
|
219
|
+
const execGit = async (
|
|
220
|
+
args: readonly string[],
|
|
221
|
+
options: Readonly<{ silent: boolean; cwd: string }>,
|
|
222
|
+
): Promise<
|
|
223
|
+
Result<Readonly<{ stdout: string; stderr: string }>, ExecException>
|
|
224
|
+
> => {
|
|
225
|
+
const { silent, cwd } = options;
|
|
226
|
+
|
|
227
|
+
if (!silent) {
|
|
228
|
+
console.info(`$ git ${args.join(' ')}`);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return new Promise((resolve) => {
|
|
232
|
+
execFile(
|
|
233
|
+
'git',
|
|
234
|
+
args,
|
|
235
|
+
{ cwd, encoding: 'utf8' },
|
|
236
|
+
(error, stdout, stderr) => {
|
|
237
|
+
if (!silent) {
|
|
238
|
+
if (stdout !== '') {
|
|
239
|
+
console.info(stdout);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
if (stderr !== '') {
|
|
243
|
+
console.error(stderr);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
resolve(
|
|
248
|
+
error === null
|
|
249
|
+
? Result.ok<Readonly<{ stdout: string; stderr: string }>>({
|
|
250
|
+
stdout,
|
|
251
|
+
stderr,
|
|
252
|
+
})
|
|
253
|
+
: Result.err(error),
|
|
254
|
+
);
|
|
255
|
+
},
|
|
256
|
+
);
|
|
257
|
+
});
|
|
258
|
+
};
|
|
@@ -840,5 +840,116 @@ describe('diff', () => {
|
|
|
840
840
|
await cleanup();
|
|
841
841
|
}
|
|
842
842
|
});
|
|
843
|
+
|
|
844
|
+
test('should list the files that differ from the given base', async () => {
|
|
845
|
+
const { repoPath, cleanup, execInRepo } = await createTempRepo();
|
|
846
|
+
|
|
847
|
+
const repoFunctions = createRepoFunctions(repoPath);
|
|
848
|
+
|
|
849
|
+
try {
|
|
850
|
+
const testFileName =
|
|
851
|
+
`test-base-file-${crypto.randomUUID()}.tmp` as const;
|
|
852
|
+
|
|
853
|
+
const testFilePath = path.join(repoPath, testFileName);
|
|
854
|
+
|
|
855
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
856
|
+
await fs.writeFile(testFilePath, 'initial content');
|
|
857
|
+
|
|
858
|
+
await execInRepo(`git add ${testFileName}`, { silent: true });
|
|
859
|
+
|
|
860
|
+
await execInRepo('git commit -m "Initial commit" --no-verify', {
|
|
861
|
+
silent: true,
|
|
862
|
+
});
|
|
863
|
+
|
|
864
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
865
|
+
await fs.writeFile(testFilePath, 'modified content');
|
|
866
|
+
|
|
867
|
+
await execInRepo(`git add ${testFileName}`, { silent: true });
|
|
868
|
+
|
|
869
|
+
await execInRepo('git commit -m "Second commit" --no-verify', {
|
|
870
|
+
silent: true,
|
|
871
|
+
});
|
|
872
|
+
|
|
873
|
+
const result = await repoFunctions.getDiffFrom('HEAD~1', {
|
|
874
|
+
silent: true,
|
|
875
|
+
});
|
|
876
|
+
|
|
877
|
+
assert.isTrue(Result.isOk(result));
|
|
878
|
+
|
|
879
|
+
if (Result.isOk(result)) {
|
|
880
|
+
expect(result.value).toContain(testFilePath);
|
|
881
|
+
}
|
|
882
|
+
} finally {
|
|
883
|
+
await cleanup();
|
|
884
|
+
}
|
|
885
|
+
});
|
|
886
|
+
|
|
887
|
+
test('should treat the base as one revision rather than several arguments', async () => {
|
|
888
|
+
const { repoPath, cleanup, execInRepo } = await createTempRepo();
|
|
889
|
+
|
|
890
|
+
const repoFunctions = createRepoFunctions(repoPath);
|
|
891
|
+
|
|
892
|
+
try {
|
|
893
|
+
const testFileName =
|
|
894
|
+
`test-single-arg-${crypto.randomUUID()}.tmp` as const;
|
|
895
|
+
|
|
896
|
+
const testFilePath = path.join(repoPath, testFileName);
|
|
897
|
+
|
|
898
|
+
// eslint-disable-next-line security/detect-non-literal-fs-filename
|
|
899
|
+
await fs.writeFile(testFilePath, 'initial content');
|
|
900
|
+
|
|
901
|
+
await execInRepo(`git add ${testFileName}`, { silent: true });
|
|
902
|
+
|
|
903
|
+
await execInRepo('git commit -m "Initial commit" --no-verify', {
|
|
904
|
+
silent: true,
|
|
905
|
+
});
|
|
906
|
+
|
|
907
|
+
const writtenByGit = path.join(repoPath, 'written-by-git.tmp');
|
|
908
|
+
|
|
909
|
+
// Whitespace in the base is part of the revision name, so the text
|
|
910
|
+
// after it is never read as an option to git.
|
|
911
|
+
const result = await repoFunctions.getDiffFrom(
|
|
912
|
+
`HEAD --output=${writtenByGit}`,
|
|
913
|
+
{ silent: true },
|
|
914
|
+
);
|
|
915
|
+
|
|
916
|
+
assert.isTrue(Result.isErr(result));
|
|
917
|
+
|
|
918
|
+
assert.isFalse(await fileExists(writtenByGit));
|
|
919
|
+
} finally {
|
|
920
|
+
await cleanup();
|
|
921
|
+
}
|
|
922
|
+
});
|
|
923
|
+
|
|
924
|
+
test('should reject a base that begins with a hyphen', async () => {
|
|
925
|
+
const { repoPath, cleanup } = await createTempRepo();
|
|
926
|
+
|
|
927
|
+
const repoFunctions = createRepoFunctions(repoPath);
|
|
928
|
+
|
|
929
|
+
try {
|
|
930
|
+
const writtenByGit = path.join(repoPath, 'written-by-git.tmp');
|
|
931
|
+
|
|
932
|
+
const result = await repoFunctions.getDiffFrom(
|
|
933
|
+
`--output=${writtenByGit}`,
|
|
934
|
+
{ silent: true },
|
|
935
|
+
);
|
|
936
|
+
|
|
937
|
+
assert.isTrue(Result.isErr(result));
|
|
938
|
+
|
|
939
|
+
assert.isFalse(await fileExists(writtenByGit));
|
|
940
|
+
} finally {
|
|
941
|
+
await cleanup();
|
|
942
|
+
}
|
|
943
|
+
});
|
|
843
944
|
});
|
|
844
945
|
});
|
|
946
|
+
|
|
947
|
+
const fileExists = async (filePath: string): Promise<boolean> => {
|
|
948
|
+
try {
|
|
949
|
+
await fs.access(filePath);
|
|
950
|
+
|
|
951
|
+
return true;
|
|
952
|
+
} catch {
|
|
953
|
+
return false;
|
|
954
|
+
}
|
|
955
|
+
};
|
|
@@ -24,7 +24,19 @@ export type ExecResult<T extends string | Buffer> = Result<
|
|
|
24
24
|
/**
|
|
25
25
|
* Executes a shell command asynchronously.
|
|
26
26
|
*
|
|
27
|
-
*
|
|
27
|
+
* `command` is a command line, and it is run by a shell. That is the contract,
|
|
28
|
+
* and it is what makes `$` useful — but it also means **a value that is data
|
|
29
|
+
* must not be interpolated into it**. A branch name, a path, a message, or
|
|
30
|
+
* anything else that came from a caller or from the environment stops being
|
|
31
|
+
* data once it is part of this string: the shell reads its punctuation as
|
|
32
|
+
* syntax, and whatever program runs then reads the rest as its own options.
|
|
33
|
+
*
|
|
34
|
+
* Build an argv and start the process without a shell instead — `execGit` in
|
|
35
|
+
* `diff.mts` is the example to copy. Use `$` for a command line that is
|
|
36
|
+
* entirely written here, in this repository, by us.
|
|
37
|
+
*
|
|
38
|
+
* @param command - The command to execute. A literal command line, not a
|
|
39
|
+
* template filled with values from elsewhere.
|
|
28
40
|
* @param options - Optional configuration for command execution.
|
|
29
41
|
* @returns A promise that resolves with the command result.
|
|
30
42
|
*/
|
package/src/functions/format.mts
CHANGED
|
@@ -398,7 +398,8 @@ const filterFilesByCwd = (
|
|
|
398
398
|
* Format only files that differ from the specified base branch or commit
|
|
399
399
|
*
|
|
400
400
|
* @param base - Base branch name or commit hash to compare against (defaults to
|
|
401
|
-
* 'main')
|
|
401
|
+
* 'main'). It names exactly one revision and reaches `git` as a single
|
|
402
|
+
* argument; see {@link getDiffFrom}.
|
|
402
403
|
* @param options - Options for formatting
|
|
403
404
|
* @param options.includeUntracked - Include untracked files in addition to diff
|
|
404
405
|
* files (default is true)
|
|
@@ -54,7 +54,8 @@ import { getDiffFrom, getGitRoot } from './diff.mjs';
|
|
|
54
54
|
* (`.editorconfig`) and ordinary globs (`**.md`, `docs/**`) both work.
|
|
55
55
|
* Defaults to `[]`, which ignores nothing.
|
|
56
56
|
* @param options.baseBranch - Base branch to compare against for determining
|
|
57
|
-
* changed files.
|
|
57
|
+
* changed files. It names exactly one revision and reaches `git` as a single
|
|
58
|
+
* argument; see {@link getDiffFrom}. Defaults to `'origin/main'`
|
|
58
59
|
* @returns Whether the step should run. An empty diff reads as "nothing
|
|
59
60
|
* changed" and so returns `false`. When running in GitHub Actions, also
|
|
60
61
|
* appends `should_run=true` or `should_run=false` to the file named by the
|
|
@@ -163,7 +164,8 @@ export const checkShouldRun = async (
|
|
|
163
164
|
* '.prettierrc', 'docs/', '**.md', '**.txt']`
|
|
164
165
|
*
|
|
165
166
|
* @param options.baseBranch - Base branch to compare against for determining
|
|
166
|
-
* changed files.
|
|
167
|
+
* changed files. It names exactly one revision and reaches `git` as a single
|
|
168
|
+
* argument; see {@link getDiffFrom}. Defaults to `'origin/main'`
|
|
167
169
|
* @returns A promise that resolves when the check is complete. The function
|
|
168
170
|
* will set the GITHUB_OUTPUT environment variable with `should_run=true` or
|
|
169
171
|
* `should_run=false` if running in GitHub Actions environment.
|