ts-repo-utils 5.1.0 → 5.2.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/dist/functions/assert-ext.d.mts +12 -7
- package/dist/functions/assert-ext.d.mts.map +1 -1
- package/dist/functions/assert-ext.mjs +4 -2
- package/dist/functions/assert-ext.mjs.map +1 -1
- package/dist/functions/assert-path-exists.d.mts +2 -0
- package/dist/functions/assert-path-exists.d.mts.map +1 -1
- package/dist/functions/assert-path-exists.mjs +2 -0
- package/dist/functions/assert-path-exists.mjs.map +1 -1
- package/dist/functions/assert-repo-is-clean.d.mts +3 -2
- package/dist/functions/assert-repo-is-clean.d.mts.map +1 -1
- package/dist/functions/assert-repo-is-clean.mjs +4 -2
- package/dist/functions/assert-repo-is-clean.mjs.map +1 -1
- package/dist/functions/diff.d.mts +2 -6
- package/dist/functions/diff.d.mts.map +1 -1
- package/dist/functions/diff.mjs +2 -6
- package/dist/functions/diff.mjs.map +1 -1
- package/dist/functions/exec-async.d.mts +1 -0
- package/dist/functions/exec-async.d.mts.map +1 -1
- package/dist/functions/exec-async.mjs +1 -0
- package/dist/functions/exec-async.mjs.map +1 -1
- package/dist/functions/format.d.mts +10 -3
- package/dist/functions/format.d.mts.map +1 -1
- package/dist/functions/format.mjs +10 -3
- package/dist/functions/format.mjs.map +1 -1
- package/dist/functions/gen-index.d.mts +18 -5
- package/dist/functions/gen-index.d.mts.map +1 -1
- package/dist/functions/gen-index.mjs +48 -32
- package/dist/functions/gen-index.mjs.map +1 -1
- package/dist/functions/should-run.d.mts +8 -5
- package/dist/functions/should-run.d.mts.map +1 -1
- package/dist/functions/should-run.mjs +8 -5
- package/dist/functions/should-run.mjs.map +1 -1
- package/dist/functions/workspace-utils/execute-parallel.d.mts +11 -6
- package/dist/functions/workspace-utils/execute-parallel.d.mts.map +1 -1
- package/dist/functions/workspace-utils/execute-parallel.mjs +40 -28
- package/dist/functions/workspace-utils/execute-parallel.mjs.map +1 -1
- package/dist/functions/workspace-utils/get-workspace-packages.d.mts +7 -4
- package/dist/functions/workspace-utils/get-workspace-packages.d.mts.map +1 -1
- package/dist/functions/workspace-utils/get-workspace-packages.mjs +7 -4
- package/dist/functions/workspace-utils/get-workspace-packages.mjs.map +1 -1
- package/dist/functions/workspace-utils/run-cmd-in-parallel.d.mts +7 -3
- package/dist/functions/workspace-utils/run-cmd-in-parallel.d.mts.map +1 -1
- package/dist/functions/workspace-utils/run-cmd-in-parallel.mjs +7 -3
- package/dist/functions/workspace-utils/run-cmd-in-parallel.mjs.map +1 -1
- package/dist/functions/workspace-utils/run-cmd-in-stages.d.mts +10 -6
- package/dist/functions/workspace-utils/run-cmd-in-stages.d.mts.map +1 -1
- package/dist/functions/workspace-utils/run-cmd-in-stages.mjs +10 -6
- package/dist/functions/workspace-utils/run-cmd-in-stages.mjs.map +1 -1
- package/package.json +3 -2
- package/src/functions/assert-ext.mts +13 -7
- package/src/functions/assert-path-exists.mts +2 -0
- package/src/functions/assert-repo-is-clean.mts +4 -2
- package/src/functions/diff.mts +2 -6
- package/src/functions/diff.test.mts +13 -13
- package/src/functions/exec-async.mts +1 -0
- package/src/functions/format.mts +10 -3
- package/src/functions/gen-index.mts +107 -48
- package/src/functions/should-run.mts +8 -5
- package/src/functions/workspace-utils/execute-parallel.mts +42 -29
- package/src/functions/workspace-utils/get-workspace-packages.mts +7 -4
- package/src/functions/workspace-utils/run-cmd-in-parallel.mts +7 -3
- package/src/functions/workspace-utils/run-cmd-in-stages.mts +10 -6
|
@@ -1,17 +1,20 @@
|
|
|
1
1
|
import '../node-global.mjs';
|
|
2
2
|
/**
|
|
3
|
-
* Checks if TypeScript type checks should run based on the diff from
|
|
4
|
-
* Skips type checks if all changed files are documentation files,
|
|
5
|
-
* or other non-TypeScript files that don't affect type
|
|
3
|
+
* Checks if TypeScript type checks should run based on the diff from
|
|
4
|
+
* origin/main. Skips type checks if all changed files are documentation files,
|
|
5
|
+
* spell check config, or other non-TypeScript files that don't affect type
|
|
6
|
+
* checking.
|
|
6
7
|
*
|
|
7
8
|
* Ignored file patterns:
|
|
9
|
+
*
|
|
8
10
|
* - '.cspell.json'
|
|
9
11
|
* - '**.md'
|
|
10
12
|
* - '**.txt'
|
|
11
13
|
* - 'docs/**'
|
|
12
14
|
*
|
|
13
|
-
* @returns A promise that resolves when the check is complete. Sets
|
|
14
|
-
* environment variable with should_run=true/false if running in
|
|
15
|
+
* @returns A promise that resolves when the check is complete. Sets
|
|
16
|
+
* GITHUB_OUTPUT environment variable with should_run=true/false if running in
|
|
17
|
+
* GitHub Actions.
|
|
15
18
|
*/
|
|
16
19
|
export declare const checkShouldRunTypeChecks: () => Promise<void>;
|
|
17
20
|
//# sourceMappingURL=should-run.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-run.d.mts","sourceRoot":"","sources":["../../src/functions/should-run.mts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAG5B
|
|
1
|
+
{"version":3,"file":"should-run.d.mts","sourceRoot":"","sources":["../../src/functions/should-run.mts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAG5B;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,QAAa,OAAO,CAAC,IAAI,CA4B7D,CAAC"}
|
|
@@ -3,18 +3,21 @@ import '../node-global.mjs';
|
|
|
3
3
|
import { getDiffFrom } from './diff.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Checks if TypeScript type checks should run based on the diff from
|
|
7
|
-
* Skips type checks if all changed files are documentation files,
|
|
8
|
-
* or other non-TypeScript files that don't affect type
|
|
6
|
+
* Checks if TypeScript type checks should run based on the diff from
|
|
7
|
+
* origin/main. Skips type checks if all changed files are documentation files,
|
|
8
|
+
* spell check config, or other non-TypeScript files that don't affect type
|
|
9
|
+
* checking.
|
|
9
10
|
*
|
|
10
11
|
* Ignored file patterns:
|
|
12
|
+
*
|
|
11
13
|
* - '.cspell.json'
|
|
12
14
|
* - '**.md'
|
|
13
15
|
* - '**.txt'
|
|
14
16
|
* - 'docs/**'
|
|
15
17
|
*
|
|
16
|
-
* @returns A promise that resolves when the check is complete. Sets
|
|
17
|
-
* environment variable with should_run=true/false if running in
|
|
18
|
+
* @returns A promise that resolves when the check is complete. Sets
|
|
19
|
+
* GITHUB_OUTPUT environment variable with should_run=true/false if running in
|
|
20
|
+
* GitHub Actions.
|
|
18
21
|
*/
|
|
19
22
|
const checkShouldRunTypeChecks = async () => {
|
|
20
23
|
// paths-ignore:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"should-run.mjs","sources":["../../src/functions/should-run.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAIA
|
|
1
|
+
{"version":3,"file":"should-run.mjs","sources":["../../src/functions/should-run.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAIA;;;;;;;;;;;;;;;;AAgBG;AACI,MAAM,wBAAwB,GAAG,YAA0B;;;;;;IAOhE,MAAM,aAAa,GAAG,OAAO,CAAC,GAAG,CAAC,eAAe,CAAC;AAElD,IAAA,MAAM,KAAK,GAAG,MAAM,WAAW,CAAC,aAAa,CAAC;AAE9C,IAAA,IAAI,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE;QACvB,OAAO,CAAC,KAAK,CAAC,qBAAqB,EAAE,KAAK,CAAC,KAAK,CAAC;AACjD,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjB;AAEA,IAAA,MAAM,iBAAiB,GAAY,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,CACnD,CAAC,IAAI,KACH,IAAI,KAAK,cAAc;AACvB,QAAA,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC;AACxB,QAAA,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAC3B,CAAC,QAAQ,KAAK,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CACpE,CAAC,KAAK,CACV;AAED,IAAA,IAAI,aAAa,KAAK,SAAS,EAAE;QAC/B,MAAM,EAAE,CAAC,UAAU,CAAC,aAAa,EAAE,CAAA,WAAA,EAAc,iBAAiB,CAAA,EAAA,CAAI,CAAC;IACzE;AACF;;;;"}
|
|
@@ -2,10 +2,13 @@ import { Result } from 'ts-data-forge';
|
|
|
2
2
|
import '../../node-global.mjs';
|
|
3
3
|
import { type Package } from './types.mjs';
|
|
4
4
|
/**
|
|
5
|
-
* Executes a npm script across multiple packages in parallel with a concurrency
|
|
5
|
+
* Executes a npm script across multiple packages in parallel with a concurrency
|
|
6
|
+
* limit.
|
|
7
|
+
*
|
|
6
8
|
* @param packages - Array of Package objects to execute the script in
|
|
7
9
|
* @param scriptName - The name of the npm script to execute
|
|
8
|
-
* @param concurrency - Maximum number of packages to process simultaneously
|
|
10
|
+
* @param concurrency - Maximum number of packages to process simultaneously
|
|
11
|
+
* (default: 3)
|
|
9
12
|
* @returns A promise that resolves to an array of execution results
|
|
10
13
|
*/
|
|
11
14
|
export declare const executeParallel: (packages: readonly Package[], scriptName: string, concurrency?: number) => Promise<readonly Result<Readonly<{
|
|
@@ -13,12 +16,14 @@ export declare const executeParallel: (packages: readonly Package[], scriptName:
|
|
|
13
16
|
skipped?: boolean;
|
|
14
17
|
}>, Error>[]>;
|
|
15
18
|
/**
|
|
16
|
-
* Executes a npm script across packages in dependency order stages.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
+
* Executes a npm script across packages in dependency order stages. Packages
|
|
20
|
+
* are grouped into stages where each stage contains packages whose dependencies
|
|
21
|
+
* have been completed in previous stages.
|
|
22
|
+
*
|
|
19
23
|
* @param packages - Array of Package objects to execute the script in
|
|
20
24
|
* @param scriptName - The name of the npm script to execute
|
|
21
|
-
* @param concurrency - Maximum number of packages to process simultaneously
|
|
25
|
+
* @param concurrency - Maximum number of packages to process simultaneously
|
|
26
|
+
* within each stage (default: 3)
|
|
22
27
|
* @returns A promise that resolves when all stages are complete
|
|
23
28
|
*/
|
|
24
29
|
export declare const executeStages: (packages: readonly Package[], scriptName: string, concurrency?: number) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-parallel.d.mts","sourceRoot":"","sources":["../../../src/functions/workspace-utils/execute-parallel.mts"],"names":[],"mappings":"AACA,OAAO,EAML,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAI3C
|
|
1
|
+
{"version":3,"file":"execute-parallel.d.mts","sourceRoot":"","sources":["../../../src/functions/workspace-utils/execute-parallel.mts"],"names":[],"mappings":"AACA,OAAO,EAML,MAAM,EACP,MAAM,eAAe,CAAC;AACvB,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAI3C;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,SAAS,OAAO,EAAE,EAC5B,YAAY,MAAM,EAClB,cAAa,MAAU,KACtB,OAAO,CACR,SAAS,MAAM,CAAC,QAAQ,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,EAAE,KAAK,CAAC,EAAE,CAkCzE,CAAC;AAEF;;;;;;;;;;GAUG;AACH,eAAO,MAAM,aAAa,GACxB,UAAU,SAAS,OAAO,EAAE,EAC5B,YAAY,MAAM,EAClB,cAAa,MAAU,KACtB,OAAO,CAAC,IAAI,CAyCd,CAAC"}
|
|
@@ -3,51 +3,56 @@ import { pipe, createPromise, isRecord, hasKey, Result, isNotUndefined } from 't
|
|
|
3
3
|
import '../../node-global.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Executes a npm script across multiple packages in parallel with a concurrency
|
|
6
|
+
* Executes a npm script across multiple packages in parallel with a concurrency
|
|
7
|
+
* limit.
|
|
8
|
+
*
|
|
7
9
|
* @param packages - Array of Package objects to execute the script in
|
|
8
10
|
* @param scriptName - The name of the npm script to execute
|
|
9
|
-
* @param concurrency - Maximum number of packages to process simultaneously
|
|
11
|
+
* @param concurrency - Maximum number of packages to process simultaneously
|
|
12
|
+
* (default: 3)
|
|
10
13
|
* @returns A promise that resolves to an array of execution results
|
|
11
14
|
*/
|
|
12
15
|
const executeParallel = async (packages, scriptName, concurrency = 3) => {
|
|
13
16
|
const mut_resultPromises = [];
|
|
14
|
-
const
|
|
17
|
+
const mut_executing = new Set();
|
|
15
18
|
for (const pkg of packages) {
|
|
16
19
|
const promise = executeScript(pkg, scriptName);
|
|
17
20
|
mut_resultPromises.push(promise);
|
|
18
21
|
const wrappedPromise = promise.finally(() => {
|
|
19
|
-
|
|
22
|
+
mut_executing.delete(wrappedPromise);
|
|
20
23
|
});
|
|
21
|
-
|
|
24
|
+
mut_executing.add(wrappedPromise);
|
|
22
25
|
// If we reach concurrency limit, wait for one to finish
|
|
23
|
-
if (
|
|
26
|
+
if (mut_executing.size >= concurrency) {
|
|
24
27
|
// eslint-disable-next-line no-await-in-loop
|
|
25
|
-
await Promise.race(
|
|
28
|
+
await Promise.race(mut_executing);
|
|
26
29
|
}
|
|
27
30
|
}
|
|
28
31
|
return Promise.all(mut_resultPromises);
|
|
29
32
|
};
|
|
30
33
|
/**
|
|
31
|
-
* Executes a npm script across packages in dependency order stages.
|
|
32
|
-
*
|
|
33
|
-
*
|
|
34
|
+
* Executes a npm script across packages in dependency order stages. Packages
|
|
35
|
+
* are grouped into stages where each stage contains packages whose dependencies
|
|
36
|
+
* have been completed in previous stages.
|
|
37
|
+
*
|
|
34
38
|
* @param packages - Array of Package objects to execute the script in
|
|
35
39
|
* @param scriptName - The name of the npm script to execute
|
|
36
|
-
* @param concurrency - Maximum number of packages to process simultaneously
|
|
40
|
+
* @param concurrency - Maximum number of packages to process simultaneously
|
|
41
|
+
* within each stage (default: 3)
|
|
37
42
|
* @returns A promise that resolves when all stages are complete
|
|
38
43
|
*/
|
|
39
44
|
const executeStages = async (packages, scriptName, concurrency = 3) => {
|
|
40
45
|
const dependencyGraph = buildDependencyGraph(packages);
|
|
41
46
|
const sorted = topologicalSortPackages(packages, dependencyGraph);
|
|
42
47
|
const mut_stages = [];
|
|
43
|
-
const
|
|
44
|
-
while (
|
|
48
|
+
const mut_completed = new Set();
|
|
49
|
+
while (mut_completed.size < sorted.length) {
|
|
45
50
|
const mut_stage = [];
|
|
46
51
|
for (const pkg of sorted) {
|
|
47
|
-
if (
|
|
52
|
+
if (mut_completed.has(pkg.name))
|
|
48
53
|
continue;
|
|
49
54
|
const deps = dependencyGraph.get(pkg.name) ?? [];
|
|
50
|
-
const depsCompleted = deps.every((dep) =>
|
|
55
|
+
const depsCompleted = deps.every((dep) => mut_completed.has(dep));
|
|
51
56
|
if (depsCompleted) {
|
|
52
57
|
mut_stage.push(pkg);
|
|
53
58
|
}
|
|
@@ -56,8 +61,9 @@ const executeStages = async (packages, scriptName, concurrency = 3) => {
|
|
|
56
61
|
throw new Error('Circular dependency detected');
|
|
57
62
|
}
|
|
58
63
|
mut_stages.push(mut_stage);
|
|
59
|
-
for (const pkg of mut_stage)
|
|
60
|
-
|
|
64
|
+
for (const pkg of mut_stage) {
|
|
65
|
+
mut_completed.add(pkg.name);
|
|
66
|
+
}
|
|
61
67
|
}
|
|
62
68
|
console.log(`\nExecuting ${scriptName} in ${mut_stages.length} stages...\n`);
|
|
63
69
|
for (const [i, stage] of mut_stages.entries()) {
|
|
@@ -70,11 +76,14 @@ const executeStages = async (packages, scriptName, concurrency = 3) => {
|
|
|
70
76
|
};
|
|
71
77
|
/**
|
|
72
78
|
* Executes a npm script in a specific package directory.
|
|
79
|
+
*
|
|
73
80
|
* @param pkg - The package object containing path and metadata
|
|
74
81
|
* @param scriptName - The name of the npm script to execute
|
|
75
82
|
* @param options - Configuration options
|
|
76
|
-
* @param options.prefix - Whether to prefix output with package name (default:
|
|
77
|
-
*
|
|
83
|
+
* @param options.prefix - Whether to prefix output with package name (default:
|
|
84
|
+
* true)
|
|
85
|
+
* @returns A promise that resolves to execution result with exit code or
|
|
86
|
+
* skipped flag
|
|
78
87
|
*/
|
|
79
88
|
const executeScript = (pkg, scriptName, { prefix = true } = {}) => pipe(createPromise((resolve, reject) => {
|
|
80
89
|
const packageJsonScripts = isRecord(pkg.packageJson) && isRecord(pkg.packageJson['scripts'])
|
|
@@ -116,19 +125,20 @@ const executeScript = (pkg, scriptName, { prefix = true } = {}) => pipe(createPr
|
|
|
116
125
|
return err instanceof Error ? err : new Error(errorMessage);
|
|
117
126
|
}))).value;
|
|
118
127
|
/**
|
|
119
|
-
* Performs a topological sort on packages based on their dependencies,
|
|
120
|
-
*
|
|
128
|
+
* Performs a topological sort on packages based on their dependencies, ensuring
|
|
129
|
+
* dependencies are ordered before their dependents.
|
|
130
|
+
*
|
|
121
131
|
* @param packages - Array of Package objects to sort
|
|
122
132
|
* @returns An array of packages in dependency order (dependencies first)
|
|
123
133
|
*/
|
|
124
134
|
const topologicalSortPackages = (packages, dependencyGraph) => {
|
|
125
|
-
const
|
|
135
|
+
const mut_visited = new Set();
|
|
126
136
|
const mut_result = [];
|
|
127
137
|
const packageMap = new Map(packages.map((p) => [p.name, p]));
|
|
128
138
|
const visit = (pkgName) => {
|
|
129
|
-
if (
|
|
139
|
+
if (mut_visited.has(pkgName))
|
|
130
140
|
return;
|
|
131
|
-
|
|
141
|
+
mut_visited.add(pkgName);
|
|
132
142
|
const deps = dependencyGraph.get(pkgName) ?? [];
|
|
133
143
|
for (const dep of deps) {
|
|
134
144
|
visit(dep);
|
|
@@ -145,17 +155,19 @@ const topologicalSortPackages = (packages, dependencyGraph) => {
|
|
|
145
155
|
/**
|
|
146
156
|
* Builds a dependency graph from the given packages, mapping each package name
|
|
147
157
|
* to its internal workspace dependencies.
|
|
158
|
+
*
|
|
148
159
|
* @param packages - Array of Package objects to analyze
|
|
149
|
-
* @returns A readonly map where keys are package names and values are arrays of
|
|
160
|
+
* @returns A readonly map where keys are package names and values are arrays of
|
|
161
|
+
* their dependency package names
|
|
150
162
|
*/
|
|
151
163
|
const buildDependencyGraph = (packages) => {
|
|
152
164
|
const packageMap = new Map(packages.map((p) => [p.name, p]));
|
|
153
|
-
const
|
|
165
|
+
const mut_graph = new Map();
|
|
154
166
|
for (const pkg of packages) {
|
|
155
167
|
const deps = Object.keys(pkg.dependencies).filter((depName) => packageMap.has(depName));
|
|
156
|
-
|
|
168
|
+
mut_graph.set(pkg.name, deps);
|
|
157
169
|
}
|
|
158
|
-
return
|
|
170
|
+
return mut_graph;
|
|
159
171
|
};
|
|
160
172
|
|
|
161
173
|
export { executeParallel, executeStages };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-parallel.mjs","sources":["../../../src/functions/workspace-utils/execute-parallel.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAcA
|
|
1
|
+
{"version":3,"file":"execute-parallel.mjs","sources":["../../../src/functions/workspace-utils/execute-parallel.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAcA;;;;;;;;;AASG;AACI,MAAM,eAAe,GAAG,OAC7B,QAA4B,EAC5B,UAAkB,EAClB,WAAA,GAAsB,CAAC,KAGrB;IACF,MAAM,kBAAkB,GAElB,EAAE;AAER,IAAA,MAAM,aAAa,GAAG,IAAI,GAAG,EAAoB;AAEjD,IAAA,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;QAC1B,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,EAAE,UAAU,CAAC;AAE9C,QAAA,kBAAkB,CAAC,IAAI,CAAC,OAAO,CAAC;AAEhC,QAAA,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC,MAAK;AAC1C,YAAA,aAAa,CAAC,MAAM,CAAC,cAAc,CAAC;AAItC,QAAA,CAAC,CAAC;AAEF,QAAA,aAAa,CAAC,GAAG,CAAC,cAAc,CAAC;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,KACc;IAC1C,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;AAC5D,IAAA,MAAM,SAAS,GAAG,IAAI,GAAG,EAA6B;AAEtD,IAAA,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE;QAC1B,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,KACxD,UAAU,CAAC,GAAG,CAAC,OAAO,CAAC,CACxB;QACD,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;IAC/B;AAEA,IAAA,OAAO,SAAS;AAClB,CAAC;;;;"}
|
|
@@ -2,10 +2,13 @@
|
|
|
2
2
|
import '../../node-global.mjs';
|
|
3
3
|
import { type Package } from './types.mjs';
|
|
4
4
|
/**
|
|
5
|
-
* Retrieves all workspace packages from a monorepo based on the workspace
|
|
6
|
-
* defined in the root package.json file.
|
|
7
|
-
*
|
|
8
|
-
* @
|
|
5
|
+
* Retrieves all workspace packages from a monorepo based on the workspace
|
|
6
|
+
* patterns defined in the root package.json file.
|
|
7
|
+
*
|
|
8
|
+
* @param rootPackageJsonDir - The directory containing the root package.json
|
|
9
|
+
* file
|
|
10
|
+
* @returns A promise that resolves to an array of Package objects containing
|
|
11
|
+
* package metadata
|
|
9
12
|
*/
|
|
10
13
|
export declare const getWorkspacePackages: (rootPackageJsonDir: string) => Promise<readonly Package[]>;
|
|
11
14
|
//# sourceMappingURL=get-workspace-packages.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-workspace-packages.d.mts","sourceRoot":"","sources":["../../../src/functions/workspace-utils/get-workspace-packages.mts"],"names":[],"mappings":";AAUA,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C
|
|
1
|
+
{"version":3,"file":"get-workspace-packages.d.mts","sourceRoot":"","sources":["../../../src/functions/workspace-utils/get-workspace-packages.mts"],"names":[],"mappings":";AAUA,OAAO,uBAAuB,CAAC;AAC/B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,aAAa,CAAC;AAE3C;;;;;;;;GAQG;AACH,eAAO,MAAM,oBAAoB,GAC/B,oBAAoB,MAAM,KACzB,OAAO,CAAC,SAAS,OAAO,EAAE,CA+D5B,CAAC"}
|
|
@@ -3,10 +3,13 @@ import { Result, Json, isNotUndefined, isRecord, hasKey, isString } from 'ts-dat
|
|
|
3
3
|
import '../../node-global.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Retrieves all workspace packages from a monorepo based on the workspace
|
|
7
|
-
* defined in the root package.json file.
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
6
|
+
* Retrieves all workspace packages from a monorepo based on the workspace
|
|
7
|
+
* patterns defined in the root package.json file.
|
|
8
|
+
*
|
|
9
|
+
* @param rootPackageJsonDir - The directory containing the root package.json
|
|
10
|
+
* file
|
|
11
|
+
* @returns A promise that resolves to an array of Package objects containing
|
|
12
|
+
* package metadata
|
|
10
13
|
*/
|
|
11
14
|
const getWorkspacePackages = async (rootPackageJsonDir) => {
|
|
12
15
|
// Read root package.json
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-workspace-packages.mjs","sources":["../../../src/functions/workspace-utils/get-workspace-packages.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAaA
|
|
1
|
+
{"version":3,"file":"get-workspace-packages.mjs","sources":["../../../src/functions/workspace-utils/get-workspace-packages.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAaA;;;;;;;;AAQG;MACU,oBAAoB,GAAG,OAClC,kBAA0B,KACK;;;IAG/B,MAAM,eAAe,GAAc,IAAI,CAAC,KAAK,CAC3C,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,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AAG,GAAG,KAAK,CAAC,GAAG,CAAC;AACtB,IAAA,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE;AAClB,QAAA,OAAO,EAAE;IACX;IACA,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,MAAM,CACxC,CAAC,KAAK,KAAgC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CACzD;AACD,IAAA,OAAO,MAAM,CAAC,WAAW,CAAC,OAAO,CAAC;AACpC,CAAC;;;;"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
#!/usr/bin/env tsx
|
|
2
2
|
/**
|
|
3
3
|
* Executes a npm script command across all workspace packages in parallel.
|
|
4
|
+
*
|
|
4
5
|
* @param options - Configuration options for the parallel execution
|
|
5
|
-
* @param options.rootPackageJsonDir - The directory containing the root
|
|
6
|
+
* @param options.rootPackageJsonDir - The directory containing the root
|
|
7
|
+
* package.json file
|
|
6
8
|
* @param options.cmd - The npm script command to execute in each package
|
|
7
|
-
* @param options.concurrency - Maximum number of packages to process
|
|
8
|
-
*
|
|
9
|
+
* @param options.concurrency - Maximum number of packages to process
|
|
10
|
+
* simultaneously (default: 3)
|
|
11
|
+
* @param options.filterWorkspacePattern - Optional function to filter packages
|
|
12
|
+
* by name
|
|
9
13
|
* @returns A promise that resolves when all packages have completed execution
|
|
10
14
|
*/
|
|
11
15
|
export declare const runCmdInParallelAcrossWorkspaces: ({ rootPackageJsonDir, cmd, concurrency, filterWorkspacePattern, }: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-cmd-in-parallel.d.mts","sourceRoot":"","sources":["../../../src/functions/workspace-utils/run-cmd-in-parallel.mts"],"names":[],"mappings":";AAKA
|
|
1
|
+
{"version":3,"file":"run-cmd-in-parallel.d.mts","sourceRoot":"","sources":["../../../src/functions/workspace-utils/run-cmd-in-parallel.mts"],"names":[],"mappings":";AAKA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,gCAAgC,GAAU,mEAKpD,QAAQ,CAAC;IACV,kBAAkB,EAAE,MAAM,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC;CAC3D,CAAC,KAAG,OAAO,CAAC,IAAI,CAkBhB,CAAC"}
|
|
@@ -4,11 +4,15 @@ import { getWorkspacePackages } from './get-workspace-packages.mjs';
|
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Executes a npm script command across all workspace packages in parallel.
|
|
7
|
+
*
|
|
7
8
|
* @param options - Configuration options for the parallel execution
|
|
8
|
-
* @param options.rootPackageJsonDir - The directory containing the root
|
|
9
|
+
* @param options.rootPackageJsonDir - The directory containing the root
|
|
10
|
+
* package.json file
|
|
9
11
|
* @param options.cmd - The npm script command to execute in each package
|
|
10
|
-
* @param options.concurrency - Maximum number of packages to process
|
|
11
|
-
*
|
|
12
|
+
* @param options.concurrency - Maximum number of packages to process
|
|
13
|
+
* simultaneously (default: 3)
|
|
14
|
+
* @param options.filterWorkspacePattern - Optional function to filter packages
|
|
15
|
+
* by name
|
|
12
16
|
* @returns A promise that resolves when all packages have completed execution
|
|
13
17
|
*/
|
|
14
18
|
const runCmdInParallelAcrossWorkspaces = async ({ rootPackageJsonDir, cmd, concurrency = 3, filterWorkspacePattern, }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-cmd-in-parallel.mjs","sources":["../../../src/functions/workspace-utils/run-cmd-in-parallel.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKA
|
|
1
|
+
{"version":3,"file":"run-cmd-in-parallel.mjs","sources":["../../../src/functions/workspace-utils/run-cmd-in-parallel.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKA;;;;;;;;;;;;AAYG;AACI,MAAM,gCAAgC,GAAG,OAAO,EACrD,kBAAkB,EAClB,GAAG,EACH,WAAW,GAAG,CAAC,EACf,sBAAsB,GAMtB,KAAmB;AACnB,IAAA,IAAI;AACF,QAAA,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,kBAAkB,CAAC;AAE/D,QAAA,MAAM,gBAAgB,GACpB,sBAAsB,KAAK;AACzB,cAAE;AACF,cAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEhE,MAAM,eAAe,CAAC,gBAAgB,EAAE,GAAG,EAAE,WAAW,CAAC;AACzD,QAAA,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,CAAA,uBAAA,CAAyB,CAAC;IAClD;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,OAAO,CAAC,KAAK,CACX,CAAA,IAAA,EAAO,GAAG,CAAA,QAAA,CAAU,EACpB,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CACnE;AACD,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjB;AACF;;;;"}
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
#!/usr/bin/env tsx
|
|
2
2
|
/**
|
|
3
|
-
* Executes a npm script command across all workspace packages in dependency
|
|
4
|
-
* Packages are grouped into stages where each stage contains
|
|
5
|
-
* dependencies have been completed in previous stages.
|
|
3
|
+
* Executes a npm script command across all workspace packages in dependency
|
|
4
|
+
* order stages. Packages are grouped into stages where each stage contains
|
|
5
|
+
* packages whose dependencies have been completed in previous stages.
|
|
6
|
+
*
|
|
6
7
|
* @param options - Configuration options for the staged execution
|
|
7
|
-
* @param options.rootPackageJsonDir - The directory containing the root
|
|
8
|
+
* @param options.rootPackageJsonDir - The directory containing the root
|
|
9
|
+
* package.json file
|
|
8
10
|
* @param options.cmd - The npm script command to execute in each package
|
|
9
|
-
* @param options.concurrency - Maximum number of packages to process
|
|
10
|
-
*
|
|
11
|
+
* @param options.concurrency - Maximum number of packages to process
|
|
12
|
+
* simultaneously within each stage (default: 3)
|
|
13
|
+
* @param options.filterWorkspacePattern - Optional function to filter packages
|
|
14
|
+
* by name
|
|
11
15
|
* @returns A promise that resolves when all stages have completed execution
|
|
12
16
|
*/
|
|
13
17
|
export declare const runCmdInStagesAcrossWorkspaces: ({ rootPackageJsonDir, cmd, concurrency, filterWorkspacePattern, }: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-cmd-in-stages.d.mts","sourceRoot":"","sources":["../../../src/functions/workspace-utils/run-cmd-in-stages.mts"],"names":[],"mappings":";AAKA
|
|
1
|
+
{"version":3,"file":"run-cmd-in-stages.d.mts","sourceRoot":"","sources":["../../../src/functions/workspace-utils/run-cmd-in-stages.mts"],"names":[],"mappings":";AAKA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,8BAA8B,GAAU,mEAKlD,QAAQ,CAAC;IACV,kBAAkB,EAAE,MAAM,CAAC;IAC3B,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,sBAAsB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC;CAC3D,CAAC,KAAG,OAAO,CAAC,IAAI,CAkBhB,CAAC"}
|
|
@@ -3,14 +3,18 @@ import { executeStages } from './execute-parallel.mjs';
|
|
|
3
3
|
import { getWorkspacePackages } from './get-workspace-packages.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Executes a npm script command across all workspace packages in dependency
|
|
7
|
-
* Packages are grouped into stages where each stage contains
|
|
8
|
-
* dependencies have been completed in previous stages.
|
|
6
|
+
* Executes a npm script command across all workspace packages in dependency
|
|
7
|
+
* order stages. Packages are grouped into stages where each stage contains
|
|
8
|
+
* packages whose dependencies have been completed in previous stages.
|
|
9
|
+
*
|
|
9
10
|
* @param options - Configuration options for the staged execution
|
|
10
|
-
* @param options.rootPackageJsonDir - The directory containing the root
|
|
11
|
+
* @param options.rootPackageJsonDir - The directory containing the root
|
|
12
|
+
* package.json file
|
|
11
13
|
* @param options.cmd - The npm script command to execute in each package
|
|
12
|
-
* @param options.concurrency - Maximum number of packages to process
|
|
13
|
-
*
|
|
14
|
+
* @param options.concurrency - Maximum number of packages to process
|
|
15
|
+
* simultaneously within each stage (default: 3)
|
|
16
|
+
* @param options.filterWorkspacePattern - Optional function to filter packages
|
|
17
|
+
* by name
|
|
14
18
|
* @returns A promise that resolves when all stages have completed execution
|
|
15
19
|
*/
|
|
16
20
|
const runCmdInStagesAcrossWorkspaces = async ({ rootPackageJsonDir, cmd, concurrency = 3, filterWorkspacePattern, }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-cmd-in-stages.mjs","sources":["../../../src/functions/workspace-utils/run-cmd-in-stages.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKA
|
|
1
|
+
{"version":3,"file":"run-cmd-in-stages.mjs","sources":["../../../src/functions/workspace-utils/run-cmd-in-stages.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKA;;;;;;;;;;;;;;AAcG;AACI,MAAM,8BAA8B,GAAG,OAAO,EACnD,kBAAkB,EAClB,GAAG,EACH,WAAW,GAAG,CAAC,EACf,sBAAsB,GAMtB,KAAmB;AACnB,IAAA,IAAI;AACF,QAAA,MAAM,QAAQ,GAAG,MAAM,oBAAoB,CAAC,kBAAkB,CAAC;AAE/D,QAAA,MAAM,gBAAgB,GACpB,sBAAsB,KAAK;AACzB,cAAE;AACF,cAAE,QAAQ,CAAC,MAAM,CAAC,CAAC,GAAG,KAAK,sBAAsB,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAEhE,MAAM,aAAa,CAAC,gBAAgB,EAAE,GAAG,EAAE,WAAW,CAAC;AACvD,QAAA,OAAO,CAAC,GAAG,CAAC,OAAO,GAAG,CAAA,uBAAA,CAAyB,CAAC;IAClD;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,OAAO,CAAC,KAAK,CACX,CAAA,IAAA,EAAO,GAAG,CAAA,QAAA,CAAU,EACpB,KAAK,YAAY,KAAK,GAAG,KAAK,CAAC,OAAO,IAAI,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC,CACnE;AACD,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjB;AACF;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-repo-utils",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.2.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript"
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
"eslint": "^9.32.0",
|
|
81
81
|
"eslint-import-resolver-typescript": "4.4.4",
|
|
82
82
|
"eslint-plugin-array-func": "5.0.2",
|
|
83
|
-
"eslint-plugin-functional": "
|
|
83
|
+
"eslint-plugin-functional": "9.0.2",
|
|
84
84
|
"eslint-plugin-import": "2.32.0",
|
|
85
85
|
"eslint-plugin-prefer-arrow-functions": "3.6.2",
|
|
86
86
|
"eslint-plugin-promise": "7.2.1",
|
|
@@ -88,6 +88,7 @@
|
|
|
88
88
|
"eslint-plugin-unicorn": "60.0.0",
|
|
89
89
|
"eslint-plugin-vitest": "0.5.4",
|
|
90
90
|
"markdownlint-cli2": "^0.18.1",
|
|
91
|
+
"prettier-plugin-jsdoc": "^1.3.3",
|
|
91
92
|
"prettier-plugin-organize-imports": "^4.2.0",
|
|
92
93
|
"prettier-plugin-packagejson": "^2.5.19",
|
|
93
94
|
"rollup": "^4.45.1",
|
|
@@ -2,26 +2,31 @@ import { Arr, type IMap, isString } from 'ts-data-forge';
|
|
|
2
2
|
import '../node-global.mjs';
|
|
3
3
|
import { assertPathExists } from './assert-path-exists.mjs';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Configuration for directory extension checking.
|
|
7
|
-
*/
|
|
5
|
+
/** Configuration for directory extension checking. */
|
|
8
6
|
export type CheckExtConfig = DeepReadonly<{
|
|
9
7
|
/** Array of directory paths and their expected extensions */
|
|
10
8
|
directories: {
|
|
11
9
|
/** Directory path to check */
|
|
12
10
|
path: string;
|
|
13
11
|
|
|
14
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Expected file extension(s) (including the dot). Can be a single extension
|
|
14
|
+
* or an array of valid extensions
|
|
15
|
+
*/
|
|
15
16
|
extension: `.${string}` | `.${string}`[];
|
|
16
17
|
|
|
17
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Optional glob patterns to ignore (defaults to ['tsconfig.json',
|
|
20
|
+
* 'globals.d.*'])
|
|
21
|
+
*/
|
|
18
22
|
ignorePatterns?: string[];
|
|
19
23
|
}[];
|
|
20
24
|
}>;
|
|
21
25
|
|
|
22
26
|
/**
|
|
23
|
-
* Validates that all files in specified directories have the correct
|
|
24
|
-
* Exits with code 1 if any files have incorrect extensions.
|
|
27
|
+
* Validates that all files in specified directories have the correct
|
|
28
|
+
* extensions. Exits with code 1 if any files have incorrect extensions.
|
|
29
|
+
*
|
|
25
30
|
* @param config - Configuration specifying directories and expected extensions.
|
|
26
31
|
*/
|
|
27
32
|
export const assertExt = async (config: CheckExtConfig): Promise<void> => {
|
|
@@ -99,6 +104,7 @@ export const assertExt = async (config: CheckExtConfig): Promise<void> => {
|
|
|
99
104
|
|
|
100
105
|
/**
|
|
101
106
|
* Checks if all files in a directory have the expected extension.
|
|
107
|
+
*
|
|
102
108
|
* @param dir - The directory to check.
|
|
103
109
|
* @param expectedExtensions - The expected file extensions.
|
|
104
110
|
* @param ignorePatterns - Optional glob patterns to ignore.
|
|
@@ -2,6 +2,7 @@ import '../node-global.mjs';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Checks if a file or directory exists.
|
|
5
|
+
*
|
|
5
6
|
* @param filePath - The path to check.
|
|
6
7
|
* @returns True if the path exists.
|
|
7
8
|
*/
|
|
@@ -16,6 +17,7 @@ export const pathExists = async (filePath: string): Promise<boolean> => {
|
|
|
16
17
|
|
|
17
18
|
/**
|
|
18
19
|
* Validates that a path exists and exits with code 1 if it doesn't.
|
|
20
|
+
*
|
|
19
21
|
* @param filePath - The path to validate.
|
|
20
22
|
* @param description - Description for error message (defaults to 'Path').
|
|
21
23
|
*/
|
|
@@ -3,6 +3,7 @@ import '../node-global.mjs';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Checks if the repository has uncommitted changes.
|
|
6
|
+
*
|
|
6
7
|
* @returns True if the repo is dirty, false otherwise.
|
|
7
8
|
* @throws Error if git command fails.
|
|
8
9
|
*/
|
|
@@ -14,8 +15,8 @@ export const repoIsDirty = async (
|
|
|
14
15
|
};
|
|
15
16
|
|
|
16
17
|
/**
|
|
17
|
-
* Checks if the repository is clean and exits with code 1 if it is dirty.
|
|
18
|
-
*
|
|
18
|
+
* Checks if the repository is clean and exits with code 1 if it is dirty. Shows
|
|
19
|
+
* git status and diff output before exiting.
|
|
19
20
|
*/
|
|
20
21
|
export const assertRepoIsClean = async (
|
|
21
22
|
options?: Readonly<{ silent?: boolean }>,
|
|
@@ -56,6 +57,7 @@ export const assertRepoIsClean = async (
|
|
|
56
57
|
|
|
57
58
|
/**
|
|
58
59
|
* Gets the git status of the repository.
|
|
60
|
+
*
|
|
59
61
|
* @returns An object containing status information.
|
|
60
62
|
*/
|
|
61
63
|
const getGitStatus = async (
|
package/src/functions/diff.mts
CHANGED
|
@@ -2,9 +2,7 @@ import { type ExecException } from 'node:child_process';
|
|
|
2
2
|
import { Result } from 'ts-data-forge';
|
|
3
3
|
import '../node-global.mjs';
|
|
4
4
|
|
|
5
|
-
/**
|
|
6
|
-
* Get files that have been changed (git status).
|
|
7
|
-
*/
|
|
5
|
+
/** Get files that have been changed (git status). */
|
|
8
6
|
export const getUntrackedFiles = async (
|
|
9
7
|
options?: Readonly<{
|
|
10
8
|
/** @default true */
|
|
@@ -42,9 +40,7 @@ export const getUntrackedFiles = async (
|
|
|
42
40
|
return Result.ok(files);
|
|
43
41
|
};
|
|
44
42
|
|
|
45
|
-
/**
|
|
46
|
-
* Get files that differ from the specified base branch or commit
|
|
47
|
-
*/
|
|
43
|
+
/** Get files that differ from the specified base branch or commit */
|
|
48
44
|
export const getDiffFrom = async (
|
|
49
45
|
base: string,
|
|
50
46
|
options?: Readonly<{
|