ts-repo-utils 7.7.2 → 7.8.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 +197 -144
- package/dist/cmd/assert-repo-is-clean.d.mts +1 -1
- package/dist/cmd/assert-repo-is-clean.mjs +2 -2
- package/dist/cmd/assert-repo-is-clean.mjs.map +1 -1
- package/dist/cmd/check-should-run-type-checks.d.mts +1 -1
- package/dist/cmd/check-should-run-type-checks.mjs +2 -2
- package/dist/cmd/check-should-run-type-checks.mjs.map +1 -1
- package/dist/cmd/format-diff-from.d.mts +1 -1
- package/dist/cmd/format-diff-from.mjs +2 -2
- package/dist/cmd/format-diff-from.mjs.map +1 -1
- package/dist/cmd/format-uncommitted.d.mts +1 -1
- package/dist/cmd/format-uncommitted.mjs +2 -2
- package/dist/cmd/format-uncommitted.mjs.map +1 -1
- package/dist/cmd/gen-index-ts.d.mts +1 -1
- package/dist/cmd/gen-index-ts.mjs +2 -2
- package/dist/cmd/gen-index-ts.mjs.map +1 -1
- package/dist/entry-point.mjs +2 -1
- package/dist/entry-point.mjs.map +1 -1
- package/dist/functions/assert-ext.d.mts +20 -1
- package/dist/functions/assert-ext.d.mts.map +1 -1
- package/dist/functions/assert-ext.mjs +52 -35
- package/dist/functions/assert-ext.mjs.map +1 -1
- package/dist/functions/create-result-assert.d.mts +18 -0
- package/dist/functions/create-result-assert.d.mts.map +1 -0
- package/dist/functions/create-result-assert.mjs +40 -0
- package/dist/functions/create-result-assert.mjs.map +1 -0
- package/dist/functions/exec-async.d.mts +5 -6
- package/dist/functions/exec-async.d.mts.map +1 -1
- package/dist/functions/exec-async.mjs +26 -7
- package/dist/functions/exec-async.mjs.map +1 -1
- package/dist/functions/index.d.mts +1 -0
- package/dist/functions/index.d.mts.map +1 -1
- package/dist/functions/index.mjs +2 -1
- package/dist/functions/index.mjs.map +1 -1
- package/dist/functions/should-run.d.mts +1 -1
- package/dist/functions/should-run.mjs +1 -1
- package/dist/functions/workspace-utils/execute-parallel.mjs.map +1 -1
- package/dist/functions/workspace-utils/get-workspace-packages.d.mts.map +1 -1
- package/dist/functions/workspace-utils/get-workspace-packages.mjs +2 -2
- package/dist/functions/workspace-utils/get-workspace-packages.mjs.map +1 -1
- package/dist/index.mjs +2 -1
- package/dist/index.mjs.map +1 -1
- package/dist/node-global.d.mts +2 -0
- package/dist/node-global.d.mts.map +1 -1
- package/dist/node-global.mjs +3 -1
- package/dist/node-global.mjs.map +1 -1
- package/package.json +50 -38
- package/src/cmd/assert-repo-is-clean.mts +3 -3
- package/src/cmd/check-should-run-type-checks.mts +3 -3
- package/src/cmd/format-diff-from.mts +3 -3
- package/src/cmd/format-uncommitted.mts +3 -3
- package/src/cmd/gen-index-ts.mts +4 -4
- package/src/functions/assert-ext.mts +78 -52
- package/src/functions/create-result-assert.mts +59 -0
- package/src/functions/exec-async.mts +71 -14
- package/src/functions/exec-async.test.mts +5 -5
- package/src/functions/index.mts +1 -0
- package/src/functions/should-run.mts +1 -1
- package/src/functions/workspace-utils/execute-parallel.mts +1 -1
- package/src/functions/workspace-utils/get-workspace-packages.mts +12 -14
- package/src/functions/workspace-utils/run-cmd-in-stages.test.mts +5 -8
- package/src/node-global.mts +4 -1
|
@@ -32,7 +32,7 @@ import { getDiffFrom } from './diff.mjs';
|
|
|
32
32
|
* ```yaml
|
|
33
33
|
* - name: Check if type checks should run
|
|
34
34
|
* id: check_diff
|
|
35
|
-
* run:
|
|
35
|
+
* run: npm exec check-should-run-type-checks
|
|
36
36
|
*
|
|
37
37
|
* - name: Run type checks
|
|
38
38
|
* if: steps.check_diff.outputs.should_run == 'true'
|
|
@@ -57,7 +57,7 @@ export const executeParallel = async (
|
|
|
57
57
|
|
|
58
58
|
const wrappedPromise = promise
|
|
59
59
|
// eslint-disable-next-line @typescript-eslint/no-loop-func
|
|
60
|
-
.catch((error) => {
|
|
60
|
+
.catch((error: unknown) => {
|
|
61
61
|
mut_failed = true;
|
|
62
62
|
throw error; // Re-throw to ensure fail-fast propagation
|
|
63
63
|
})
|
|
@@ -63,20 +63,18 @@ export const getWorkspacePackages = async (
|
|
|
63
63
|
}),
|
|
64
64
|
);
|
|
65
65
|
|
|
66
|
-
const packageInfos: readonly Package[] =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
dependencies
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
})),
|
|
79
|
-
);
|
|
66
|
+
const packageInfos: readonly Package[] = packageJsonList
|
|
67
|
+
.filter(isNotUndefined)
|
|
68
|
+
.map(([packagePath, packageJson]) => ({
|
|
69
|
+
name: getStrFromJsonValue(packageJson, 'name'),
|
|
70
|
+
path: path.dirname(packagePath),
|
|
71
|
+
packageJson,
|
|
72
|
+
dependencies: {
|
|
73
|
+
...getKeyValueRecordFromJsonValue(packageJson, 'dependencies'),
|
|
74
|
+
...getKeyValueRecordFromJsonValue(packageJson, 'devDependencies'),
|
|
75
|
+
...getKeyValueRecordFromJsonValue(packageJson, 'peerDependencies'),
|
|
76
|
+
},
|
|
77
|
+
}));
|
|
80
78
|
|
|
81
79
|
return packageInfos;
|
|
82
80
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/* eslint-disable vitest/no-restricted-vi-methods */
|
|
2
|
+
import { type MockInstance } from 'vitest';
|
|
2
3
|
import '../../node-global.mjs';
|
|
3
4
|
import { executeStages } from './execute-parallel.mjs';
|
|
4
5
|
import { getWorkspacePackages } from './get-workspace-packages.mjs';
|
|
@@ -16,9 +17,9 @@ vi.mock('./get-workspace-packages.mjs', () => ({
|
|
|
16
17
|
|
|
17
18
|
describe('runCmdInStagesAcrossWorkspaces', () => {
|
|
18
19
|
type MockedSpies = Readonly<{
|
|
19
|
-
consoleLogSpy:
|
|
20
|
-
consoleErrorSpy:
|
|
21
|
-
processExitSpy:
|
|
20
|
+
consoleLogSpy: MockInstance<typeof console.log>;
|
|
21
|
+
consoleErrorSpy: MockInstance<typeof console.error>;
|
|
22
|
+
processExitSpy: MockInstance<typeof process.exit>;
|
|
22
23
|
}>;
|
|
23
24
|
|
|
24
25
|
const setupSpies = (): MockedSpies => {
|
|
@@ -30,14 +31,10 @@ describe('runCmdInStagesAcrossWorkspaces', () => {
|
|
|
30
31
|
.spyOn(console, 'error')
|
|
31
32
|
.mockImplementation((): void => {});
|
|
32
33
|
|
|
33
|
-
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
34
34
|
const processExitSpy = vi
|
|
35
35
|
.spyOn(process, 'exit')
|
|
36
|
-
|
|
37
36
|
// eslint-disable-next-line total-functions/no-unsafe-type-assertion
|
|
38
|
-
.mockImplementation((): never => undefined as never)
|
|
39
|
-
typeof vi.spyOn
|
|
40
|
-
>;
|
|
37
|
+
.mockImplementation((): never => undefined as never);
|
|
41
38
|
|
|
42
39
|
return { consoleLogSpy, consoleErrorSpy, processExitSpy };
|
|
43
40
|
};
|
package/src/node-global.mts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
/* eslint-disable import/no-internal-modules */
|
|
1
|
+
/* eslint-disable import-x/no-internal-modules */
|
|
2
2
|
import glob_ from 'fast-glob';
|
|
3
3
|
import * as fs_ from 'node:fs/promises';
|
|
4
4
|
import * as os_ from 'node:os';
|
|
5
5
|
import * as path_ from 'node:path';
|
|
6
|
+
import { chdir as chdir_ } from 'node:process';
|
|
6
7
|
import { Result as Result_ } from 'ts-data-forge';
|
|
7
8
|
import { $ as $_ } from './functions/exec-async.mjs';
|
|
8
9
|
import { isDirectlyExecuted as isDirectlyExecuted_ } from './functions/is-directly-executed.mjs';
|
|
@@ -19,6 +20,7 @@ const globalsDef = {
|
|
|
19
20
|
$: $_,
|
|
20
21
|
Result: Result_,
|
|
21
22
|
echo: console.log,
|
|
23
|
+
cd: chdir_,
|
|
22
24
|
isDirectlyExecuted: isDirectlyExecuted_,
|
|
23
25
|
} as const;
|
|
24
26
|
|
|
@@ -35,5 +37,6 @@ declare global {
|
|
|
35
37
|
const Result: typeof Result_;
|
|
36
38
|
type Result<S, E> = Result_<S, E>;
|
|
37
39
|
const echo: typeof console.log;
|
|
40
|
+
const cd: typeof chdir_;
|
|
38
41
|
const isDirectlyExecuted: typeof isDirectlyExecuted_;
|
|
39
42
|
}
|