ts-repo-utils 5.0.2 → 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 +17 -12
- 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 +2 -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 +19 -6
- package/dist/functions/gen-index.d.mts.map +1 -1
- package/dist/functions/gen-index.mjs +63 -42
- 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 +50 -38
- 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 +9 -5
- 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 +12 -8
- package/dist/functions/workspace-utils/run-cmd-in-stages.mjs.map +1 -1
- package/dist/globals.d.mts +1 -0
- package/dist/node-global.d.mts.map +1 -1
- package/dist/node-global.mjs +1 -0
- package/dist/node-global.mjs.map +1 -1
- package/package.json +19 -8
- package/src/functions/assert-ext.mts +38 -19
- 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 +31 -24
- package/src/functions/exec-async.mts +2 -0
- package/src/functions/format.mts +10 -3
- package/src/functions/format.test.mts +8 -4
- package/src/functions/gen-index.mts +146 -62
- package/src/functions/should-run.mts +8 -5
- package/src/functions/workspace-utils/execute-parallel.mts +52 -39
- package/src/functions/workspace-utils/get-workspace-packages.mts +7 -4
- package/src/functions/workspace-utils/run-cmd-in-parallel.mts +9 -5
- package/src/functions/workspace-utils/run-cmd-in-stages.mts +12 -8
- package/src/globals.d.mts +1 -0
- package/src/node-global.mts +3 -0
- package/src/functions/gen-index.test.mts +0 -18
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import micromatch from 'micromatch';
|
|
2
|
-
import { Result, ISet, Arr, isString } from 'ts-data-forge';
|
|
2
|
+
import { Result, ISet, pipe, Arr, isString } from 'ts-data-forge';
|
|
3
3
|
import '../node-global.mjs';
|
|
4
4
|
import { assertPathExists } from './assert-path-exists.mjs';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Generates index.ts files recursively in `config.targetDirectory`.
|
|
8
|
+
*
|
|
8
9
|
* @param config - Configuration for index file generation
|
|
9
10
|
* @throws Error if any step fails.
|
|
10
11
|
*/
|
|
@@ -24,7 +25,7 @@ const genIndex = async (config) => {
|
|
|
24
25
|
await assertPathExists(resolvedDir, `Target directory: ${dir}`);
|
|
25
26
|
}
|
|
26
27
|
// Step 2: Generate index files
|
|
27
|
-
echo('
|
|
28
|
+
echo('Generating index files...');
|
|
28
29
|
for (const dir of targetDirs) {
|
|
29
30
|
const resolvedDir = path.resolve(dir);
|
|
30
31
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -33,7 +34,7 @@ const genIndex = async (config) => {
|
|
|
33
34
|
echo('✓ Index files generated\n');
|
|
34
35
|
// Step 3: Format generated files
|
|
35
36
|
if (filledConfig.formatCommand !== undefined) {
|
|
36
|
-
echo('
|
|
37
|
+
echo('Formatting generated files...');
|
|
37
38
|
const fmtResult = await $(filledConfig.formatCommand, {
|
|
38
39
|
silent: filledConfig.silent,
|
|
39
40
|
});
|
|
@@ -49,17 +50,6 @@ const genIndex = async (config) => {
|
|
|
49
50
|
throw error;
|
|
50
51
|
}
|
|
51
52
|
};
|
|
52
|
-
/**
|
|
53
|
-
* Fills the configuration with default values.
|
|
54
|
-
* Default values:
|
|
55
|
-
* - sourceExtensions: ['.ts']
|
|
56
|
-
* - indexExtension: '.ts'
|
|
57
|
-
* - exportExtension: '.js'
|
|
58
|
-
* - excludePatterns: ['**\/*.{test,spec}.?(c|m)[jt]s?(x)']
|
|
59
|
-
* - silent: false
|
|
60
|
-
* @param config - The input configuration object.
|
|
61
|
-
* @returns The configuration object with all required properties filled with defaults.
|
|
62
|
-
*/
|
|
63
53
|
const fillConfig = (config) => {
|
|
64
54
|
const sourceExtensions = config.sourceExtensions ?? ['.ts'];
|
|
65
55
|
const exportExtension = config.exportExtension ?? '.js'; // For ESM imports, .mts resolves to .mjs
|
|
@@ -68,12 +58,23 @@ const fillConfig = (config) => {
|
|
|
68
58
|
targetDirectory: ISet.create(isString(config.targetDirectory)
|
|
69
59
|
? [config.targetDirectory]
|
|
70
60
|
: config.targetDirectory),
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
61
|
+
// eslint-disable-next-line @typescript-eslint/no-deprecated
|
|
62
|
+
exclude: pipe(config.exclude ?? config.excludePatterns).map((exclude) => typeof exclude === 'function'
|
|
63
|
+
? exclude
|
|
64
|
+
: pipe(ISet.create(Arr.generate(function* () {
|
|
65
|
+
if (exclude !== undefined && Array.isArray(exclude)) {
|
|
66
|
+
yield* exclude;
|
|
67
|
+
}
|
|
68
|
+
yield '**/*.{test,spec}.?(c|m)[jt]s?(x)';
|
|
69
|
+
}))).map((set) => ({ relativePath, fileName, }) => {
|
|
70
|
+
for (const pattern of set.values()) {
|
|
71
|
+
if (micromatch.isMatch(relativePath, pattern) ||
|
|
72
|
+
micromatch.isMatch(fileName, pattern)) {
|
|
73
|
+
return true;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return false;
|
|
77
|
+
}).value).value,
|
|
77
78
|
sourceExtensions: ISet.create(sourceExtensions),
|
|
78
79
|
indexExtension: config.indexExtension ?? '.ts',
|
|
79
80
|
exportExtension,
|
|
@@ -81,38 +82,48 @@ const fillConfig = (config) => {
|
|
|
81
82
|
};
|
|
82
83
|
};
|
|
83
84
|
/**
|
|
84
|
-
* Generates an index.ts file for the given directory.
|
|
85
|
-
*
|
|
85
|
+
* Generates an index.ts file for the given directory. Recursively calls itself
|
|
86
|
+
* for subdirectories.
|
|
87
|
+
*
|
|
86
88
|
* @param dirPath - The absolute path to the directory to process.
|
|
87
89
|
* @param config - The merged configuration object.
|
|
88
|
-
* @param baseDir - The base directory path for calculating relative paths
|
|
90
|
+
* @param baseDir - The base directory path for calculating relative paths
|
|
91
|
+
* (optional, defaults to dirPath).
|
|
89
92
|
* @throws Error if directory processing fails.
|
|
90
93
|
*/
|
|
91
94
|
const generateIndexFileForDir = async (dirPath, config, baseDir) => {
|
|
92
95
|
try {
|
|
93
96
|
const actualBaseDir = baseDir ?? dirPath;
|
|
94
97
|
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
95
|
-
const
|
|
96
|
-
const
|
|
98
|
+
const mut_subDirectories = [];
|
|
99
|
+
const mut_filesToExport = [];
|
|
97
100
|
for (const entry of entries) {
|
|
98
101
|
const entryName = entry.name;
|
|
99
102
|
const entryPath = path.join(dirPath, entryName);
|
|
100
103
|
const relativePath = path.relative(actualBaseDir, entryPath);
|
|
101
|
-
if (config.
|
|
102
|
-
|
|
104
|
+
if (config.exclude({
|
|
105
|
+
absolutePath: entryPath,
|
|
106
|
+
relativePath,
|
|
107
|
+
fileName: entryName,
|
|
108
|
+
})) {
|
|
103
109
|
continue; // Skip excluded directories/files
|
|
104
110
|
}
|
|
105
111
|
if (entry.isDirectory()) {
|
|
106
|
-
|
|
112
|
+
mut_subDirectories.push(entryName);
|
|
107
113
|
// Recursively call for subdirectories first
|
|
108
114
|
// eslint-disable-next-line no-await-in-loop
|
|
109
115
|
await generateIndexFileForDir(entryPath, config, actualBaseDir);
|
|
110
116
|
}
|
|
111
|
-
else if (entry.isFile() &&
|
|
112
|
-
|
|
117
|
+
else if (entry.isFile() &&
|
|
118
|
+
shouldExportFile({
|
|
119
|
+
absolutePath: entryPath,
|
|
120
|
+
filePath: relativePath,
|
|
121
|
+
config,
|
|
122
|
+
})) {
|
|
123
|
+
mut_filesToExport.push(entryName);
|
|
113
124
|
}
|
|
114
125
|
}
|
|
115
|
-
const indexContent = generateIndexContent(
|
|
126
|
+
const indexContent = generateIndexContent(mut_subDirectories, mut_filesToExport, config);
|
|
116
127
|
const indexPath = path.join(dirPath, `index${config.indexExtension}`);
|
|
117
128
|
await fs.writeFile(indexPath, indexContent);
|
|
118
129
|
echo(`Generated: ${path.relative(process.cwd(), indexPath)}`);
|
|
@@ -121,17 +132,21 @@ const generateIndexFileForDir = async (dirPath, config, baseDir) => {
|
|
|
121
132
|
throw new Error(`Failed to generate index for directory ${dirPath}: ${String(error)}`);
|
|
122
133
|
}
|
|
123
134
|
};
|
|
135
|
+
const indexRegex = /^index\.[cm]?[jt]s[x]?$/u;
|
|
124
136
|
/**
|
|
125
|
-
* Determines if a file should be exported in the index file.
|
|
126
|
-
*
|
|
137
|
+
* Determines if a file should be exported in the index file. A file is exported
|
|
138
|
+
* if:
|
|
139
|
+
*
|
|
127
140
|
* - It has one of the configured source extensions
|
|
128
141
|
* - It's not an index file itself
|
|
129
142
|
* - It doesn't match any exclusion patterns
|
|
143
|
+
*
|
|
130
144
|
* @param filePath - The relative path to the file from the target directory.
|
|
145
|
+
* @param absolutePath - The absolute path to the file.
|
|
131
146
|
* @param config - The merged configuration object.
|
|
132
147
|
* @returns True if the file should be exported.
|
|
133
148
|
*/
|
|
134
|
-
const shouldExportFile = (filePath, config) => {
|
|
149
|
+
const shouldExportFile = ({ absolutePath, filePath, config, }) => {
|
|
135
150
|
const fileName = path.basename(filePath);
|
|
136
151
|
const ext = path.extname(fileName);
|
|
137
152
|
// Must have the correct source extension
|
|
@@ -139,21 +154,23 @@ const shouldExportFile = (filePath, config) => {
|
|
|
139
154
|
return false;
|
|
140
155
|
}
|
|
141
156
|
// Don't export the index file itself
|
|
142
|
-
if (
|
|
157
|
+
if (indexRegex.test(fileName) // Matches index.ts, index.mts, index.js, index.tsx
|
|
143
158
|
) {
|
|
144
159
|
return false;
|
|
145
160
|
}
|
|
146
161
|
// Check against exclusion patterns
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
162
|
+
if (config.exclude({
|
|
163
|
+
absolutePath,
|
|
164
|
+
relativePath: filePath,
|
|
165
|
+
fileName,
|
|
166
|
+
})) {
|
|
167
|
+
return false;
|
|
152
168
|
}
|
|
153
169
|
return true;
|
|
154
170
|
};
|
|
155
171
|
/**
|
|
156
172
|
* Generates the content for an index file.
|
|
173
|
+
*
|
|
157
174
|
* @param subDirectories - Array of subdirectory names.
|
|
158
175
|
* @param filesToExport - Array of file names to export.
|
|
159
176
|
* @param config - The merged configuration object.
|
|
@@ -161,10 +178,14 @@ const shouldExportFile = (filePath, config) => {
|
|
|
161
178
|
*/
|
|
162
179
|
const generateIndexContent = (subDirectories, filesToExport, config) => {
|
|
163
180
|
const exportStatements = [
|
|
164
|
-
...subDirectories.map((subDir) =>
|
|
181
|
+
...subDirectories.map((subDir) => config.exportExtension === 'none'
|
|
182
|
+
? `export * from "./${subDir}";`
|
|
183
|
+
: `export * from "./${subDir}/index${config.exportExtension}";`),
|
|
165
184
|
...filesToExport.map((file) => {
|
|
166
185
|
const fileNameWithoutExt = path.basename(file, path.extname(file));
|
|
167
|
-
return
|
|
186
|
+
return config.exportExtension === 'none'
|
|
187
|
+
? `export * from "./${fileNameWithoutExt}";`
|
|
188
|
+
: `export * from "./${fileNameWithoutExt}${config.exportExtension}";`;
|
|
168
189
|
}),
|
|
169
190
|
];
|
|
170
191
|
return exportStatements.length === 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gen-index.mjs","sources":["../../src/functions/gen-index.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"gen-index.mjs","sources":["../../src/functions/gen-index.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAgEA;;;;;AAKG;MACU,QAAQ,GAAG,OAAO,MAAsB,KAAmB;IACtE,IAAI,CAAC,qCAAqC,CAAC;;AAG3C,IAAA,MAAM,YAAY,GAA2B,UAAU,CAAC,MAAM,CAAC;;AAG/D,IAAA,MAAM,UAAU,GACd,OAAO,MAAM,CAAC,eAAe,KAAK;AAChC,UAAE,CAAC,MAAM,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C,eAAe,KAAK;cACvB,CAAA,iBAAA,EAAoB,MAAM,CAAA,EAAA;cAC1B,oBAAoB,MAAM,CAAA,MAAA,EAAS,MAAM,CAAC,eAAe,IAAI,CAClE;AACD,QAAA,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,KAAI;AAC5B,YAAA,MAAM,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAElE,YAAA,OAAO,MAAM,CAAC,eAAe,KAAK;kBAC9B,CAAA,iBAAA,EAAoB,kBAAkB,CAAA,EAAA;kBACtC,oBAAoB,kBAAkB,CAAA,EAAG,MAAM,CAAC,eAAe,IAAI;AACzE,QAAA,CAAC,CAAC;KACH;AAED,IAAA,OAAO,gBAAgB,CAAC,MAAM,KAAK;AACjC,UAAE;AACF,UAAE,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC;;;;"}
|
|
@@ -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,64 +3,70 @@ 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
|
-
const
|
|
43
|
-
const
|
|
44
|
-
while (
|
|
45
|
-
const
|
|
47
|
+
const mut_stages = [];
|
|
48
|
+
const mut_completed = new Set();
|
|
49
|
+
while (mut_completed.size < sorted.length) {
|
|
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
|
}
|
|
54
59
|
}
|
|
55
|
-
if (
|
|
60
|
+
if (mut_stage.length === 0) {
|
|
56
61
|
throw new Error('Circular dependency detected');
|
|
57
62
|
}
|
|
58
|
-
|
|
59
|
-
for (const pkg of
|
|
60
|
-
|
|
63
|
+
mut_stages.push(mut_stage);
|
|
64
|
+
for (const pkg of mut_stage) {
|
|
65
|
+
mut_completed.add(pkg.name);
|
|
66
|
+
}
|
|
61
67
|
}
|
|
62
|
-
console.log(`\nExecuting ${scriptName} in ${
|
|
63
|
-
for (const [i, stage] of
|
|
68
|
+
console.log(`\nExecuting ${scriptName} in ${mut_stages.length} stages...\n`);
|
|
69
|
+
for (const [i, stage] of mut_stages.entries()) {
|
|
64
70
|
if (stage.length > 0) {
|
|
65
71
|
console.log(`Stage ${i + 1}: ${stage.map((p) => p.name).join(', ')}`);
|
|
66
72
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -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,46 +125,49 @@ 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
|
|
126
|
-
const
|
|
135
|
+
const mut_visited = new Set();
|
|
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);
|
|
135
145
|
}
|
|
136
|
-
|
|
146
|
+
mut_result.push(pkgName);
|
|
137
147
|
};
|
|
138
148
|
for (const pkg of packages) {
|
|
139
149
|
visit(pkg.name);
|
|
140
150
|
}
|
|
141
|
-
return
|
|
151
|
+
return mut_result
|
|
142
152
|
.map((pkgName) => packageMap.get(pkgName))
|
|
143
153
|
.filter(isNotUndefined);
|
|
144
154
|
};
|
|
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,C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;SACxC,MAAM,CAAC,cAAc,CAAC;AAC3B,CAAC;AAED;;;;;;;AAOG;AACH,MAAM,oBAAoB,GAAG,CAC3B,QAA4B,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,kB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AAI,CAAC,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;AAC3C,QAAA,OAAO,EAAE;IACX;AACA,IAAA,MAAM,GAAG,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"}
|