ts-repo-utils 5.0.1 → 5.1.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.map +1 -1
- package/dist/functions/assert-ext.mjs +13 -10
- package/dist/functions/assert-ext.mjs.map +1 -1
- 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/gen-index.d.mts +1 -1
- package/dist/functions/gen-index.d.mts.map +1 -1
- package/dist/functions/gen-index.mjs +15 -10
- package/dist/functions/gen-index.mjs.map +1 -1
- package/dist/functions/workspace-utils/execute-parallel.mjs +11 -11
- package/dist/functions/workspace-utils/execute-parallel.mjs.map +1 -1
- package/dist/functions/workspace-utils/run-cmd-in-parallel.mjs +2 -2
- package/dist/functions/workspace-utils/run-cmd-in-parallel.mjs.map +1 -1
- package/dist/functions/workspace-utils/run-cmd-in-stages.mjs +2 -2
- package/dist/functions/workspace-utils/run-cmd-in-stages.mjs.map +1 -1
- package/dist/globals.d.mts +2 -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/dist/types.d.mts +2 -0
- package/package.json +27 -17
- package/src/functions/assert-ext.mts +25 -12
- package/src/functions/diff.test.mts +28 -21
- package/src/functions/exec-async.mts +1 -0
- package/src/functions/format.test.mts +8 -4
- package/src/functions/gen-index.mts +39 -14
- package/src/functions/workspace-utils/execute-parallel.mts +11 -11
- package/src/functions/workspace-utils/run-cmd-in-parallel.mts +2 -2
- package/src/functions/workspace-utils/run-cmd-in-stages.mts +2 -2
- package/src/globals.d.mts +2 -0
- package/src/node-global.mts +3 -0
- package/src/functions/gen-index.test.mts +0 -18
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert-ext.d.mts","sourceRoot":"","sources":["../../src/functions/assert-ext.mts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAG5B;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC;IACxC,6DAA6D;IAC7D,WAAW,EAAE;QACX,8BAA8B;QAC9B,IAAI,EAAE,MAAM,CAAC;QAEb,gHAAgH;QAChH,SAAS,EAAE,IAAI,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,EAAE,CAAC;QAEzC,sFAAsF;QACtF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;KAC3B,EAAE,CAAC;CACL,CAAC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAU,QAAQ,cAAc,KAAG,OAAO,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"assert-ext.d.mts","sourceRoot":"","sources":["../../src/functions/assert-ext.mts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAG5B;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC;IACxC,6DAA6D;IAC7D,WAAW,EAAE;QACX,8BAA8B;QAC9B,IAAI,EAAE,MAAM,CAAC;QAEb,gHAAgH;QAChH,SAAS,EAAE,IAAI,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,EAAE,CAAC;QAEzC,sFAAsF;QACtF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;KAC3B,EAAE,CAAC;CACL,CAAC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAU,QAAQ,cAAc,KAAG,OAAO,CAAC,IAAI,CAuEpE,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isString } from 'ts-data-forge';
|
|
1
|
+
import { isString, Arr } from 'ts-data-forge';
|
|
2
2
|
import '../node-global.mjs';
|
|
3
3
|
import { assertPathExists } from './assert-path-exists.mjs';
|
|
4
4
|
|
|
@@ -23,18 +23,21 @@ const assertExt = async (config) => {
|
|
|
23
23
|
if (allIncorrectFiles.length > 0) {
|
|
24
24
|
const generateErrorMessage = () => {
|
|
25
25
|
// Group directories by extension for a cleaner message
|
|
26
|
-
const extensionGroups =
|
|
27
|
-
for (const { path: dirPath, extension } of config.directories) {
|
|
26
|
+
const extensionGroups = Arr.groupBy(config.directories.map(({ path: dirPath, extension }) => {
|
|
28
27
|
const relativePath = path.relative(process.cwd(), dirPath);
|
|
29
|
-
const extKey = isString(extension)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
const extKey = isString(extension)
|
|
29
|
+
? extension
|
|
30
|
+
: extension.join(' or ');
|
|
31
|
+
return {
|
|
32
|
+
relativePath,
|
|
33
|
+
extKey,
|
|
34
|
+
};
|
|
35
|
+
}), ({ extKey }) => extKey);
|
|
35
36
|
// Generate message parts for each extension
|
|
36
37
|
const messageParts = Array.from(extensionGroups.entries(), ([ext, dirs]) => {
|
|
37
|
-
const dirList = dirs.length === 1
|
|
38
|
+
const dirList = dirs.length === 1
|
|
39
|
+
? dirs[0]?.relativePath
|
|
40
|
+
: dirs.map((d) => d.relativePath).join(', ');
|
|
38
41
|
return `${dirList} should have ${ext} extension`;
|
|
39
42
|
});
|
|
40
43
|
return `All files in ${messageParts.join(' and ')}.`;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert-ext.mjs","sources":["../../src/functions/assert-ext.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAqBA;;;;AAIG;MACU,SAAS,GAAG,OAAO,MAAsB,KAAmB;;IAEvE,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,cAAc,EAAE,KAAI;AACxE,QAAA,IAAI;YACF,OAAO,MAAM,8BAA8B,CACzC,GAAG,EACH,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,SAAS,EAC7C,cAAc,CACf;QACH;QAAE,OAAO,KAAK,EAAE;AACd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E,aAAa,CAAC,
|
|
1
|
+
{"version":3,"file":"exec-async.d.mts","sourceRoot":"","sources":["../../src/functions/exec-async.mts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;;;;GAKG;AACH,eAAO,MAAM,CAAC,GACZ,KAAK,MAAM,EACX,UAAS,QAAQ,CAAC;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAM,KAC7D,OAAO,CACR,MAAM,CAAC,QAAQ,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,aAAa,CAAC,CA6BpE,CAAC"}
|
|
@@ -14,6 +14,7 @@ const $ = (cmd, options = {}) => {
|
|
|
14
14
|
}
|
|
15
15
|
return new Promise((resolve) => {
|
|
16
16
|
const execOptions = { timeout };
|
|
17
|
+
// eslint-disable-next-line security/detect-child-process
|
|
17
18
|
exec(cmd, execOptions, (error, stdout, stderr) => {
|
|
18
19
|
if (!silent) {
|
|
19
20
|
if (stdout !== '') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec-async.mjs","sources":["../../src/functions/exec-async.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAGA;;;;;AAKG;AACI,MAAM,CAAC,GAAG,CACf,GAAW,EACX,OAAA,GAA4D,EAAE,KAG5D;IACF,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,OAAO;IAEnD,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,IAAI,CAAC,CAAA,EAAA,EAAK,GAAG,CAAA,CAAE,CAAC;IAClB;AAEA,IAAA,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI;AAC7B,QAAA,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE
|
|
1
|
+
{"version":3,"file":"exec-async.mjs","sources":["../../src/functions/exec-async.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAGA;;;;;AAKG;AACI,MAAM,CAAC,GAAG,CACf,GAAW,EACX,OAAA,GAA4D,EAAE,KAG5D;IACF,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,OAAO;IAEnD,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,IAAI,CAAC,CAAA,EAAA,EAAK,GAAG,CAAA,CAAE,CAAC;IAClB;AAEA,IAAA,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI;AAC7B,QAAA,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE;;AAG/B,QAAA,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,KAAI;YAC/C,IAAI,CAAC,MAAM,EAAE;AACX,gBAAA,IAAI,MAAM,KAAK,EAAE,EAAE;oBACjB,IAAI,CAAC,MAAM,CAAC;gBACd;AACA,gBAAA,IAAI,MAAM,KAAK,EAAE,EAAE;AACjB,oBAAA,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;gBACvB;YACF;AAEA,YAAA,IAAI,KAAK,KAAK,IAAI,EAAE;gBAClB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC5B;iBAAO;AACL,gBAAA,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACxC;AACF,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC,CAAC;AACJ;;;;"}
|
|
@@ -12,7 +12,7 @@ export type GenIndexConfig = DeepReadonly<{
|
|
|
12
12
|
/** File extension of index files to generate (default: '.ts') */
|
|
13
13
|
indexExtension?: `.${string}`;
|
|
14
14
|
/** File extension to use in export statements (default: '.js') */
|
|
15
|
-
exportExtension?: `.${string}
|
|
15
|
+
exportExtension?: `.${string}` | 'none';
|
|
16
16
|
/** Command to run for formatting generated files (default: 'npm run fmt') */
|
|
17
17
|
formatCommand?: string;
|
|
18
18
|
/** Whether to suppress output during execution (default: false) */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gen-index.d.mts","sourceRoot":"","sources":["../../src/functions/gen-index.mts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,CAAC;AAG5B;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC;IACxC,kFAAkF;IAClF,eAAe,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IAE5C,+GAA+G;IAC/G,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAEpC,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,SAAS,IAAI,MAAM,EAAE,EAAE,CAAC;IAE3C,iEAAiE;IACjE,cAAc,CAAC,EAAE,IAAI,MAAM,EAAE,CAAC;IAE9B,kEAAkE;IAClE,eAAe,CAAC,EAAE,IAAI,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"gen-index.d.mts","sourceRoot":"","sources":["../../src/functions/gen-index.mts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,CAAC;AAG5B;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC;IACxC,kFAAkF;IAClF,eAAe,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IAE5C,+GAA+G;IAC/G,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAEpC,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,SAAS,IAAI,MAAM,EAAE,EAAE,CAAC;IAE3C,iEAAiE;IACjE,cAAc,CAAC,EAAE,IAAI,MAAM,EAAE,CAAC;IAE9B,kEAAkE;IAClE,eAAe,CAAC,EAAE,IAAI,MAAM,EAAE,GAAG,MAAM,CAAC;IAExC,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC,CAAC;AAYH;;;;GAIG;AACH,eAAO,MAAM,QAAQ,GAAU,QAAQ,cAAc,KAAG,OAAO,CAAC,IAAI,CA8CnE,CAAC"}
|
|
@@ -24,7 +24,7 @@ const genIndex = async (config) => {
|
|
|
24
24
|
await assertPathExists(resolvedDir, `Target directory: ${dir}`);
|
|
25
25
|
}
|
|
26
26
|
// Step 2: Generate index files
|
|
27
|
-
echo('
|
|
27
|
+
echo('Generating index files...');
|
|
28
28
|
for (const dir of targetDirs) {
|
|
29
29
|
const resolvedDir = path.resolve(dir);
|
|
30
30
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -33,7 +33,7 @@ const genIndex = async (config) => {
|
|
|
33
33
|
echo('✓ Index files generated\n');
|
|
34
34
|
// Step 3: Format generated files
|
|
35
35
|
if (filledConfig.formatCommand !== undefined) {
|
|
36
|
-
echo('
|
|
36
|
+
echo('Formatting generated files...');
|
|
37
37
|
const fmtResult = await $(filledConfig.formatCommand, {
|
|
38
38
|
silent: filledConfig.silent,
|
|
39
39
|
});
|
|
@@ -92,8 +92,8 @@ const generateIndexFileForDir = async (dirPath, config, baseDir) => {
|
|
|
92
92
|
try {
|
|
93
93
|
const actualBaseDir = baseDir ?? dirPath;
|
|
94
94
|
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
95
|
-
const
|
|
96
|
-
const
|
|
95
|
+
const mut_subDirectories = [];
|
|
96
|
+
const mut_filesToExport = [];
|
|
97
97
|
for (const entry of entries) {
|
|
98
98
|
const entryName = entry.name;
|
|
99
99
|
const entryPath = path.join(dirPath, entryName);
|
|
@@ -103,16 +103,16 @@ const generateIndexFileForDir = async (dirPath, config, baseDir) => {
|
|
|
103
103
|
continue; // Skip excluded directories/files
|
|
104
104
|
}
|
|
105
105
|
if (entry.isDirectory()) {
|
|
106
|
-
|
|
106
|
+
mut_subDirectories.push(entryName);
|
|
107
107
|
// Recursively call for subdirectories first
|
|
108
108
|
// eslint-disable-next-line no-await-in-loop
|
|
109
109
|
await generateIndexFileForDir(entryPath, config, actualBaseDir);
|
|
110
110
|
}
|
|
111
111
|
else if (entry.isFile() && shouldExportFile(relativePath, config)) {
|
|
112
|
-
|
|
112
|
+
mut_filesToExport.push(entryName);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
const indexContent = generateIndexContent(
|
|
115
|
+
const indexContent = generateIndexContent(mut_subDirectories, mut_filesToExport, config);
|
|
116
116
|
const indexPath = path.join(dirPath, `index${config.indexExtension}`);
|
|
117
117
|
await fs.writeFile(indexPath, indexContent);
|
|
118
118
|
echo(`Generated: ${path.relative(process.cwd(), indexPath)}`);
|
|
@@ -121,6 +121,7 @@ const generateIndexFileForDir = async (dirPath, config, baseDir) => {
|
|
|
121
121
|
throw new Error(`Failed to generate index for directory ${dirPath}: ${String(error)}`);
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
|
+
const indexRegex = /^index\.[cm]?[jt]s[x]?$/u;
|
|
124
125
|
/**
|
|
125
126
|
* Determines if a file should be exported in the index file.
|
|
126
127
|
* A file is exported if:
|
|
@@ -139,7 +140,7 @@ const shouldExportFile = (filePath, config) => {
|
|
|
139
140
|
return false;
|
|
140
141
|
}
|
|
141
142
|
// Don't export the index file itself
|
|
142
|
-
if (
|
|
143
|
+
if (indexRegex.test(fileName) // Matches index.ts, index.mts, index.js, index.tsx
|
|
143
144
|
) {
|
|
144
145
|
return false;
|
|
145
146
|
}
|
|
@@ -161,10 +162,14 @@ const shouldExportFile = (filePath, config) => {
|
|
|
161
162
|
*/
|
|
162
163
|
const generateIndexContent = (subDirectories, filesToExport, config) => {
|
|
163
164
|
const exportStatements = [
|
|
164
|
-
...subDirectories.map((subDir) =>
|
|
165
|
+
...subDirectories.map((subDir) => config.exportExtension === 'none'
|
|
166
|
+
? `export * from "./${subDir}";`
|
|
167
|
+
: `export * from "./${subDir}/index${config.exportExtension}";`),
|
|
165
168
|
...filesToExport.map((file) => {
|
|
166
169
|
const fileNameWithoutExt = path.basename(file, path.extname(file));
|
|
167
|
-
return
|
|
170
|
+
return config.exportExtension === 'none'
|
|
171
|
+
? `export * from "./${fileNameWithoutExt}";`
|
|
172
|
+
: `export * from "./${fileNameWithoutExt}${config.exportExtension}";`;
|
|
168
173
|
}),
|
|
169
174
|
];
|
|
170
175
|
return exportStatements.length === 0
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gen-index.mjs","sources":["../../src/functions/gen-index.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAyCA;;;;AAIG;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,CAAC,eAAe;AACzB,UAAE,MAAM,CAAC,eAAe;AAE5B,IAAA,IAAI;;AAEF,QAAA,KAAK,MAAM,GAAG,IAAI,UAAU,EAAE;YAC5B,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC;;YAErC,MAAM,gBAAgB,CAAC,WAAW,EAAE,qBAAqB,GAAG,CAAA,CAAE,CAAC;QACjE;;QAGA,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"gen-index.mjs","sources":["../../src/functions/gen-index.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAyCA;;;;AAIG;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,CAAC,eAAe;AACzB,UAAE,MAAM,CAAC,eAAe;AAE5B,I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AAK;AACjC,UAAE;AACF,UAAE,gBAAgB,CAAC,IAAI,CAAC,IAAI,CAAC;AACjC,CAAC;;;;"}
|
|
@@ -39,28 +39,28 @@ const executeParallel = async (packages, scriptName, concurrency = 3) => {
|
|
|
39
39
|
const executeStages = async (packages, scriptName, concurrency = 3) => {
|
|
40
40
|
const dependencyGraph = buildDependencyGraph(packages);
|
|
41
41
|
const sorted = topologicalSortPackages(packages, dependencyGraph);
|
|
42
|
-
const
|
|
42
|
+
const mut_stages = [];
|
|
43
43
|
const completed = new Set();
|
|
44
44
|
while (completed.size < sorted.length) {
|
|
45
|
-
const
|
|
45
|
+
const mut_stage = [];
|
|
46
46
|
for (const pkg of sorted) {
|
|
47
47
|
if (completed.has(pkg.name))
|
|
48
48
|
continue;
|
|
49
49
|
const deps = dependencyGraph.get(pkg.name) ?? [];
|
|
50
50
|
const depsCompleted = deps.every((dep) => completed.has(dep));
|
|
51
51
|
if (depsCompleted) {
|
|
52
|
-
|
|
52
|
+
mut_stage.push(pkg);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
|
-
if (
|
|
55
|
+
if (mut_stage.length === 0) {
|
|
56
56
|
throw new Error('Circular dependency detected');
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
for (const pkg of
|
|
58
|
+
mut_stages.push(mut_stage);
|
|
59
|
+
for (const pkg of mut_stage)
|
|
60
60
|
completed.add(pkg.name);
|
|
61
61
|
}
|
|
62
|
-
console.log(`\nExecuting ${scriptName} in ${
|
|
63
|
-
for (const [i, stage] of
|
|
62
|
+
console.log(`\nExecuting ${scriptName} in ${mut_stages.length} stages...\n`);
|
|
63
|
+
for (const [i, stage] of mut_stages.entries()) {
|
|
64
64
|
if (stage.length > 0) {
|
|
65
65
|
console.log(`Stage ${i + 1}: ${stage.map((p) => p.name).join(', ')}`);
|
|
66
66
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -123,7 +123,7 @@ const executeScript = (pkg, scriptName, { prefix = true } = {}) => pipe(createPr
|
|
|
123
123
|
*/
|
|
124
124
|
const topologicalSortPackages = (packages, dependencyGraph) => {
|
|
125
125
|
const visited = new Set();
|
|
126
|
-
const
|
|
126
|
+
const mut_result = [];
|
|
127
127
|
const packageMap = new Map(packages.map((p) => [p.name, p]));
|
|
128
128
|
const visit = (pkgName) => {
|
|
129
129
|
if (visited.has(pkgName))
|
|
@@ -133,12 +133,12 @@ const topologicalSortPackages = (packages, dependencyGraph) => {
|
|
|
133
133
|
for (const dep of deps) {
|
|
134
134
|
visit(dep);
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
mut_result.push(pkgName);
|
|
137
137
|
};
|
|
138
138
|
for (const pkg of packages) {
|
|
139
139
|
visit(pkg.name);
|
|
140
140
|
}
|
|
141
|
-
return
|
|
141
|
+
return mut_result
|
|
142
142
|
.map((pkgName) => packageMap.get(pkgName))
|
|
143
143
|
.filter(isNotUndefined);
|
|
144
144
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execute-parallel.mjs","sources":["../../../src/functions/workspace-utils/execute-parallel.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAcA;;;;;;AAMG;AACI,MAAM,eAAe,GAAG,OAC7B,QAA4B,EAC5B,UAAkB,EAClB,WAAA,GAAsB,CAAC,KAGrB;IACF,MAAM,kBAAkB,GAElB,EAAE;AAER,IAAA,MAAM,SAAS,GAAG,IAAI,GAAG,EAAoB;AAE7C,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,SAAS,CAAC,MAAM,CAAC,cAAc,CAAC;AAIlC,QAAA,CAAC,CAAC;AAEF,QAAA,SAAS,CAAC,GAAG,CAAC,cAAc,CAAC;;AAO7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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,KAAK,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC;IAC3B;AAEA,IAAA,OAAO,KAAK;AACd,CAAC;;;;"}
|
|
@@ -20,8 +20,8 @@ const runCmdInParallelAcrossWorkspaces = async ({ rootPackageJsonDir, cmd, concu
|
|
|
20
20
|
await executeParallel(filteredPackages, cmd, concurrency);
|
|
21
21
|
console.log(`\n✅ ${cmd} completed successfully`);
|
|
22
22
|
}
|
|
23
|
-
catch (
|
|
24
|
-
console.error(`\n❌ ${cmd} failed:`,
|
|
23
|
+
catch (error) {
|
|
24
|
+
console.error(`\n❌ ${cmd} failed:`, error instanceof Error ? error.message : (error?.toString() ?? ''));
|
|
25
25
|
process.exit(1);
|
|
26
26
|
}
|
|
27
27
|
};
|
|
@@ -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;;;;;;;;AAQG;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,
|
|
1
|
+
{"version":3,"file":"run-cmd-in-parallel.mjs","sources":["../../../src/functions/workspace-utils/run-cmd-in-parallel.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKA;;;;;;;;AAQG;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;;;;"}
|
|
@@ -22,8 +22,8 @@ const runCmdInStagesAcrossWorkspaces = async ({ rootPackageJsonDir, cmd, concurr
|
|
|
22
22
|
await executeStages(filteredPackages, cmd, concurrency);
|
|
23
23
|
console.log(`\n✅ ${cmd} completed successfully`);
|
|
24
24
|
}
|
|
25
|
-
catch (
|
|
26
|
-
console.error(`\n❌ ${cmd} failed:`,
|
|
25
|
+
catch (error) {
|
|
26
|
+
console.error(`\n❌ ${cmd} failed:`, error instanceof Error ? error.message : (error?.toString() ?? ''));
|
|
27
27
|
process.exit(1);
|
|
28
28
|
}
|
|
29
29
|
};
|
|
@@ -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;;;;;;;;;;AAUG;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,
|
|
1
|
+
{"version":3,"file":"run-cmd-in-stages.mjs","sources":["../../../src/functions/workspace-utils/run-cmd-in-stages.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAKA;;;;;;;;;;AAUG;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;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-global.d.mts","sourceRoot":"","sources":["../src/node-global.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"node-global.d.mts","sourceRoot":"","sources":["../src/node-global.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,WAAW,CAAC;AAGnC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,4BAA4B,CAAC;AAcrD,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,OAAO,EAAE,CAAC;IACnB,MAAM,IAAI,EAAE,OAAO,OAAO,CAAC,GAAG,CAAC;IAE/B,MAAM,IAAI,EAAE,OAAO,KAAK,CAAC;IACzB,MAAM,EAAE,EAAE,OAAO,GAAG,CAAC;IACrB,MAAM,IAAI,EAAE,OAAO,KAAK,CAAC;CAC1B"}
|
package/dist/node-global.mjs
CHANGED
package/dist/node-global.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"node-global.mjs","sources":["../src/node-global.mts"],"sourcesContent":[null],"names":["$_"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"node-global.mjs","sources":["../src/node-global.mts"],"sourcesContent":[null],"names":["$_"],"mappings":";;;;;AAOA,MAAM,UAAU,GAAG;AACjB,IAAA,CAAC,EAAEA,CAAE;IACL,IAAI,EAAE,OAAO,CAAC,GAAG;AAEjB,IAAA,IAAI,EAAE,KAAK;AACX,IAAA,EAAE,EAAE,GAAG;AACP,IAAA,IAAI,EAAE,KAAK;CACH;AAEV;AACA,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC"}
|
package/dist/types.d.mts
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-repo-utils",
|
|
3
|
-
"version": "5.0
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript"
|
|
@@ -16,13 +16,13 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
18
|
"import": {
|
|
19
|
-
"types": "./dist/
|
|
19
|
+
"types": "./dist/type.d.mts",
|
|
20
20
|
"default": "./dist/index.mjs"
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"module": "./dist/index.mjs",
|
|
25
|
-
"types": "./dist/
|
|
25
|
+
"types": "./dist/type.d.mts",
|
|
26
26
|
"files": [
|
|
27
27
|
"src",
|
|
28
28
|
"dist",
|
|
@@ -47,9 +47,9 @@
|
|
|
47
47
|
"test:ui": "npm run z:vitest -- --ui",
|
|
48
48
|
"testw": "npm run z:vitest -- watch",
|
|
49
49
|
"tsc": "tsc --noEmit",
|
|
50
|
-
"tscw": "tsc --noEmit --watch",
|
|
50
|
+
"tscw": "tsc --noEmit --watch -p ./tsconfig.json",
|
|
51
51
|
"type-check": "tsc --noEmit",
|
|
52
|
-
"update-packages": "npx npm-check-updates -u --install always
|
|
52
|
+
"update-packages": "npx npm-check-updates -u --install always",
|
|
53
53
|
"z:vitest": "vitest --config ./configs/vitest.config.ts"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
@@ -57,38 +57,48 @@
|
|
|
57
57
|
"fast-glob": "^3.3.3",
|
|
58
58
|
"micromatch": "^4.0.8",
|
|
59
59
|
"prettier": "^3.6.2",
|
|
60
|
-
"ts-data-forge": "^3.0.
|
|
60
|
+
"ts-data-forge": "^3.0.4"
|
|
61
61
|
},
|
|
62
62
|
"devDependencies": {
|
|
63
63
|
"@eslint/js": "^9.31.0",
|
|
64
64
|
"@rollup/plugin-replace": "^6.0.2",
|
|
65
65
|
"@rollup/plugin-strip": "^3.0.4",
|
|
66
|
-
"@rollup/plugin-typescript": "^12.1.
|
|
66
|
+
"@rollup/plugin-typescript": "^12.1.4",
|
|
67
67
|
"@semantic-release/changelog": "^6.0.3",
|
|
68
68
|
"@semantic-release/commit-analyzer": "^13.0.1",
|
|
69
69
|
"@semantic-release/exec": "^7.1.0",
|
|
70
70
|
"@semantic-release/git": "^10.0.1",
|
|
71
71
|
"@semantic-release/github": "^11.0.3",
|
|
72
|
-
"@semantic-release/npm": "^12.0.
|
|
72
|
+
"@semantic-release/npm": "^12.0.2",
|
|
73
73
|
"@semantic-release/release-notes-generator": "^14.0.3",
|
|
74
|
-
"@types/node": "^
|
|
74
|
+
"@types/node": "^24.1.0",
|
|
75
75
|
"@vitest/coverage-v8": "^3.2.4",
|
|
76
76
|
"@vitest/ui": "^3.2.4",
|
|
77
77
|
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
78
|
-
"cspell": "^9.
|
|
78
|
+
"cspell": "^9.2.0",
|
|
79
79
|
"dedent": "^1.6.0",
|
|
80
|
-
"eslint": "^9.
|
|
80
|
+
"eslint": "^9.32.0",
|
|
81
|
+
"eslint-import-resolver-typescript": "4.4.4",
|
|
82
|
+
"eslint-plugin-array-func": "5.0.2",
|
|
83
|
+
"eslint-plugin-functional": "7.1.0",
|
|
84
|
+
"eslint-plugin-import": "2.32.0",
|
|
85
|
+
"eslint-plugin-prefer-arrow-functions": "3.6.2",
|
|
86
|
+
"eslint-plugin-promise": "7.2.1",
|
|
87
|
+
"eslint-plugin-security": "3.0.1",
|
|
88
|
+
"eslint-plugin-unicorn": "60.0.0",
|
|
89
|
+
"eslint-plugin-vitest": "0.5.4",
|
|
81
90
|
"markdownlint-cli2": "^0.18.1",
|
|
82
|
-
"prettier-plugin-organize-imports": "^4.
|
|
83
|
-
"prettier-plugin-packagejson": "^2.5.
|
|
84
|
-
"rollup": "^4.45.
|
|
91
|
+
"prettier-plugin-organize-imports": "^4.2.0",
|
|
92
|
+
"prettier-plugin-packagejson": "^2.5.19",
|
|
93
|
+
"rollup": "^4.45.1",
|
|
85
94
|
"semantic-release": "^24.2.7",
|
|
86
|
-
"ts-type-forge": "^2.
|
|
95
|
+
"ts-type-forge": "^2.1.1",
|
|
96
|
+
"tslib": "^2.8.1",
|
|
87
97
|
"tsx": "^4.20.3",
|
|
88
98
|
"typedoc": "^0.28.7",
|
|
89
|
-
"typedoc-plugin-markdown": "^4.7.
|
|
99
|
+
"typedoc-plugin-markdown": "^4.7.1",
|
|
90
100
|
"typescript": "^5.8.3",
|
|
91
|
-
"typescript-eslint": "^8.
|
|
101
|
+
"typescript-eslint": "^8.38.0",
|
|
92
102
|
"vitest": "^3.2.4"
|
|
93
103
|
},
|
|
94
104
|
"engines": {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isString } from 'ts-data-forge';
|
|
1
|
+
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
|
|
|
@@ -47,22 +47,35 @@ export const assertExt = async (config: CheckExtConfig): Promise<void> => {
|
|
|
47
47
|
if (allIncorrectFiles.length > 0) {
|
|
48
48
|
const generateErrorMessage = (): string => {
|
|
49
49
|
// Group directories by extension for a cleaner message
|
|
50
|
-
const extensionGroups
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
|
|
50
|
+
const extensionGroups: IMap<
|
|
51
|
+
string,
|
|
52
|
+
readonly Readonly<{
|
|
53
|
+
relativePath: string;
|
|
54
|
+
extKey: string;
|
|
55
|
+
}>[]
|
|
56
|
+
> = Arr.groupBy(
|
|
57
|
+
config.directories.map(({ path: dirPath, extension }) => {
|
|
58
|
+
const relativePath = path.relative(process.cwd(), dirPath);
|
|
59
|
+
const extKey = isString(extension)
|
|
60
|
+
? extension
|
|
61
|
+
: extension.join(' or ');
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
relativePath,
|
|
65
|
+
extKey,
|
|
66
|
+
};
|
|
67
|
+
}),
|
|
68
|
+
({ extKey }) => extKey,
|
|
69
|
+
);
|
|
60
70
|
|
|
61
71
|
// Generate message parts for each extension
|
|
62
72
|
const messageParts = Array.from(
|
|
63
73
|
extensionGroups.entries(),
|
|
64
74
|
([ext, dirs]) => {
|
|
65
|
-
const dirList =
|
|
75
|
+
const dirList =
|
|
76
|
+
dirs.length === 1
|
|
77
|
+
? dirs[0]?.relativePath
|
|
78
|
+
: dirs.map((d) => d.relativePath).join(', ');
|
|
66
79
|
return `${dirList} should have ${ext} extension`;
|
|
67
80
|
},
|
|
68
81
|
);
|
|
@@ -3,12 +3,9 @@ import '../node-global.mjs';
|
|
|
3
3
|
import { getDiffFrom, getUntrackedFiles } from './diff.mjs';
|
|
4
4
|
|
|
5
5
|
describe('diff', () => {
|
|
6
|
-
//
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
afterEach(async () => {
|
|
10
|
-
// Clean up test files
|
|
11
|
-
for (const file of testFiles) {
|
|
6
|
+
// Helper function to clean up test files
|
|
7
|
+
const cleanupTestFiles = async (files: Set<string>): Promise<void> => {
|
|
8
|
+
for (const file of files) {
|
|
12
9
|
try {
|
|
13
10
|
// eslint-disable-next-line no-await-in-loop
|
|
14
11
|
await fs.rm(file, { force: true });
|
|
@@ -16,8 +13,7 @@ describe('diff', () => {
|
|
|
16
13
|
// Ignore cleanup errors
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
|
|
20
|
-
});
|
|
16
|
+
};
|
|
21
17
|
|
|
22
18
|
describe('getUntrackedFiles', () => {
|
|
23
19
|
test('should return empty array when no files are changed', async () => {
|
|
@@ -30,10 +26,12 @@ describe('diff', () => {
|
|
|
30
26
|
});
|
|
31
27
|
|
|
32
28
|
test('should detect newly created files', async () => {
|
|
29
|
+
const testFiles = new Set<string>();
|
|
30
|
+
|
|
33
31
|
// Create a new file in project root
|
|
34
32
|
const testFileName = 'test-new-file.tmp';
|
|
35
33
|
const testFilePath = path.join(process.cwd(), testFileName);
|
|
36
|
-
testFiles.
|
|
34
|
+
testFiles.add(testFilePath);
|
|
37
35
|
|
|
38
36
|
await fs.writeFile(testFilePath, 'test content');
|
|
39
37
|
|
|
@@ -42,15 +40,19 @@ describe('diff', () => {
|
|
|
42
40
|
expect(Result.isOk(result)).toBe(true);
|
|
43
41
|
if (Result.isOk(result)) {
|
|
44
42
|
const files = result.value;
|
|
45
|
-
expect(files.
|
|
43
|
+
expect(files).toContain(testFileName);
|
|
46
44
|
}
|
|
45
|
+
|
|
46
|
+
await cleanupTestFiles(testFiles);
|
|
47
47
|
});
|
|
48
48
|
|
|
49
49
|
test('should detect modified existing files', async () => {
|
|
50
|
+
const testFiles = new Set<string>();
|
|
51
|
+
|
|
50
52
|
// Use an existing file in the project that we can modify safely
|
|
51
53
|
const testFileName = 'test-modify-file.tmp';
|
|
52
54
|
const testFilePath = path.join(process.cwd(), testFileName);
|
|
53
|
-
testFiles.
|
|
55
|
+
testFiles.add(testFilePath);
|
|
54
56
|
|
|
55
57
|
// Create and commit the file first
|
|
56
58
|
await fs.writeFile(testFilePath, 'initial content');
|
|
@@ -66,18 +68,23 @@ describe('diff', () => {
|
|
|
66
68
|
expect(Result.isOk(result)).toBe(true);
|
|
67
69
|
if (Result.isOk(result)) {
|
|
68
70
|
const files = result.value;
|
|
69
|
-
expect(files.
|
|
71
|
+
expect(files).not.toContain(testFileName);
|
|
70
72
|
}
|
|
71
73
|
|
|
72
74
|
// Reset git state
|
|
73
75
|
await $(`git reset HEAD ${testFileName}`, { silent: true });
|
|
76
|
+
|
|
77
|
+
await cleanupTestFiles(testFiles);
|
|
74
78
|
});
|
|
75
79
|
|
|
76
80
|
test('should detect multiple types of changes', async () => {
|
|
81
|
+
const testFiles = new Set<string>();
|
|
82
|
+
|
|
77
83
|
// Create multiple test files
|
|
78
84
|
const newFile = path.join(process.cwd(), 'test-new-file.tmp');
|
|
79
85
|
const modifyFile = path.join(process.cwd(), 'test-modify-file.tmp');
|
|
80
|
-
testFiles.
|
|
86
|
+
testFiles.add(newFile);
|
|
87
|
+
testFiles.add(modifyFile);
|
|
81
88
|
|
|
82
89
|
// Create new file
|
|
83
90
|
await fs.writeFile(newFile, 'new file content');
|
|
@@ -94,14 +101,14 @@ describe('diff', () => {
|
|
|
94
101
|
expect(Result.isOk(result)).toBe(true);
|
|
95
102
|
if (Result.isOk(result)) {
|
|
96
103
|
const files = result.value;
|
|
97
|
-
expect(files.
|
|
98
|
-
expect(files.
|
|
99
|
-
false,
|
|
100
|
-
);
|
|
104
|
+
expect(files).toContain('test-new-file.tmp');
|
|
105
|
+
expect(files).not.toContain('test-modify-file.tmp');
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
// Reset git state
|
|
104
109
|
await $(`git reset HEAD test-modify-file.tmp`, { silent: true });
|
|
110
|
+
|
|
111
|
+
await cleanupTestFiles(testFiles);
|
|
105
112
|
});
|
|
106
113
|
|
|
107
114
|
test('should exclude deleted files from results', async () => {
|
|
@@ -113,10 +120,10 @@ describe('diff', () => {
|
|
|
113
120
|
if (Result.isOk(result)) {
|
|
114
121
|
const files = result.value;
|
|
115
122
|
// Verify no deleted files are included (status 'D')
|
|
116
|
-
|
|
123
|
+
for (const file of files) {
|
|
117
124
|
expect(typeof file).toBe('string');
|
|
118
125
|
expect(file.length).toBeGreaterThan(0);
|
|
119
|
-
}
|
|
126
|
+
}
|
|
120
127
|
}
|
|
121
128
|
});
|
|
122
129
|
|
|
@@ -137,11 +144,11 @@ describe('diff', () => {
|
|
|
137
144
|
const files = result.value;
|
|
138
145
|
|
|
139
146
|
// Each file should be a non-empty string
|
|
140
|
-
|
|
147
|
+
for (const file of files) {
|
|
141
148
|
expect(typeof file).toBe('string');
|
|
142
149
|
expect(file.trim()).toBe(file); // No leading/trailing whitespace
|
|
143
150
|
expect(file.length).toBeGreaterThan(0);
|
|
144
|
-
}
|
|
151
|
+
}
|
|
145
152
|
}
|
|
146
153
|
});
|
|
147
154
|
|
|
@@ -27,6 +27,7 @@ describe('formatFiles', () => {
|
|
|
27
27
|
fs.readFile(filePath, 'utf8');
|
|
28
28
|
|
|
29
29
|
test('should format files matching glob pattern', async () => {
|
|
30
|
+
vi.clearAllMocks();
|
|
30
31
|
// Setup test directory
|
|
31
32
|
await fs.mkdir(testDir, { recursive: true });
|
|
32
33
|
|
|
@@ -84,6 +85,7 @@ describe('formatFiles', () => {
|
|
|
84
85
|
});
|
|
85
86
|
|
|
86
87
|
test('should return ok when no files match pattern', async () => {
|
|
88
|
+
vi.clearAllMocks();
|
|
87
89
|
const result = await formatFiles('/non-existent-path/*.ts', {
|
|
88
90
|
silent: true,
|
|
89
91
|
});
|
|
@@ -91,6 +93,7 @@ describe('formatFiles', () => {
|
|
|
91
93
|
});
|
|
92
94
|
|
|
93
95
|
test('should handle nested directories with glob pattern', async () => {
|
|
96
|
+
vi.clearAllMocks();
|
|
94
97
|
// Setup test directory with nested structure
|
|
95
98
|
await fs.mkdir(path.join(testDir, 'src', 'utils'), { recursive: true });
|
|
96
99
|
|
|
@@ -143,6 +146,7 @@ describe('formatFilesList', () => {
|
|
|
143
146
|
fs.readFile(filePath, 'utf8');
|
|
144
147
|
|
|
145
148
|
test('should format a list of files', async () => {
|
|
149
|
+
vi.clearAllMocks();
|
|
146
150
|
await fs.mkdir(testDir, { recursive: true });
|
|
147
151
|
|
|
148
152
|
try {
|
|
@@ -189,6 +193,7 @@ describe('formatFilesList', () => {
|
|
|
189
193
|
});
|
|
190
194
|
|
|
191
195
|
test('should return ok for empty file list', async () => {
|
|
196
|
+
vi.clearAllMocks();
|
|
192
197
|
const result = await formatFilesList([], {
|
|
193
198
|
silent: true,
|
|
194
199
|
});
|
|
@@ -211,11 +216,8 @@ describe('formatDiffFrom', () => {
|
|
|
211
216
|
const readTestFile = async (filePath: string): Promise<string> =>
|
|
212
217
|
fs.readFile(filePath, 'utf8');
|
|
213
218
|
|
|
214
|
-
beforeEach(() => {
|
|
215
|
-
vi.clearAllMocks();
|
|
216
|
-
});
|
|
217
|
-
|
|
218
219
|
test('should format files from diff', async () => {
|
|
220
|
+
vi.clearAllMocks();
|
|
219
221
|
await fs.mkdir(testDir, { recursive: true });
|
|
220
222
|
|
|
221
223
|
try {
|
|
@@ -250,6 +252,7 @@ describe('formatDiffFrom', () => {
|
|
|
250
252
|
});
|
|
251
253
|
|
|
252
254
|
test('should include untracked files when option is set', async () => {
|
|
255
|
+
vi.clearAllMocks();
|
|
253
256
|
await fs.mkdir(testDir, { recursive: true });
|
|
254
257
|
|
|
255
258
|
try {
|
|
@@ -302,6 +305,7 @@ describe('formatDiffFrom', () => {
|
|
|
302
305
|
});
|
|
303
306
|
|
|
304
307
|
test('should deduplicate files when including untracked', async () => {
|
|
308
|
+
vi.clearAllMocks();
|
|
305
309
|
await fs.mkdir(testDir, { recursive: true });
|
|
306
310
|
|
|
307
311
|
try {
|
|
@@ -20,7 +20,7 @@ export type GenIndexConfig = DeepReadonly<{
|
|
|
20
20
|
indexExtension?: `.${string}`;
|
|
21
21
|
|
|
22
22
|
/** File extension to use in export statements (default: '.js') */
|
|
23
|
-
exportExtension?: `.${string}
|
|
23
|
+
exportExtension?: `.${string}` | 'none';
|
|
24
24
|
|
|
25
25
|
/** Command to run for formatting generated files (default: 'npm run fmt') */
|
|
26
26
|
formatCommand?: string;
|
|
@@ -35,7 +35,7 @@ type GenIndexConfigInternal = DeepReadonly<{
|
|
|
35
35
|
excludePatterns: ISet<string>;
|
|
36
36
|
sourceExtensions: ISet<`.${string}`>;
|
|
37
37
|
indexExtension: `.${string}`;
|
|
38
|
-
exportExtension: `.${string}
|
|
38
|
+
exportExtension: `.${string}` | 'none';
|
|
39
39
|
silent: boolean;
|
|
40
40
|
}>;
|
|
41
41
|
|
|
@@ -65,7 +65,7 @@ export const genIndex = async (config: GenIndexConfig): Promise<void> => {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
// Step 2: Generate index files
|
|
68
|
-
echo('
|
|
68
|
+
echo('Generating index files...');
|
|
69
69
|
for (const dir of targetDirs) {
|
|
70
70
|
const resolvedDir = path.resolve(dir);
|
|
71
71
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -75,7 +75,7 @@ export const genIndex = async (config: GenIndexConfig): Promise<void> => {
|
|
|
75
75
|
|
|
76
76
|
// Step 3: Format generated files
|
|
77
77
|
if (filledConfig.formatCommand !== undefined) {
|
|
78
|
-
echo('
|
|
78
|
+
echo('Formatting generated files...');
|
|
79
79
|
const fmtResult = await $(filledConfig.formatCommand, {
|
|
80
80
|
silent: filledConfig.silent,
|
|
81
81
|
});
|
|
@@ -146,8 +146,8 @@ const generateIndexFileForDir = async (
|
|
|
146
146
|
const actualBaseDir = baseDir ?? dirPath;
|
|
147
147
|
const entries = await fs.readdir(dirPath, { withFileTypes: true });
|
|
148
148
|
|
|
149
|
-
const
|
|
150
|
-
const
|
|
149
|
+
const mut_subDirectories: string[] = [];
|
|
150
|
+
const mut_filesToExport: string[] = [];
|
|
151
151
|
|
|
152
152
|
for (const entry of entries) {
|
|
153
153
|
const entryName = entry.name;
|
|
@@ -165,18 +165,18 @@ const generateIndexFileForDir = async (
|
|
|
165
165
|
}
|
|
166
166
|
|
|
167
167
|
if (entry.isDirectory()) {
|
|
168
|
-
|
|
168
|
+
mut_subDirectories.push(entryName);
|
|
169
169
|
// Recursively call for subdirectories first
|
|
170
170
|
// eslint-disable-next-line no-await-in-loop
|
|
171
171
|
await generateIndexFileForDir(entryPath, config, actualBaseDir);
|
|
172
172
|
} else if (entry.isFile() && shouldExportFile(relativePath, config)) {
|
|
173
|
-
|
|
173
|
+
mut_filesToExport.push(entryName);
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
|
|
177
177
|
const indexContent = generateIndexContent(
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
mut_subDirectories,
|
|
179
|
+
mut_filesToExport,
|
|
180
180
|
config,
|
|
181
181
|
);
|
|
182
182
|
|
|
@@ -191,6 +191,8 @@ const generateIndexFileForDir = async (
|
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
193
|
|
|
194
|
+
const indexRegex = /^index\.[cm]?[jt]s[x]?$/u;
|
|
195
|
+
|
|
194
196
|
/**
|
|
195
197
|
* Determines if a file should be exported in the index file.
|
|
196
198
|
* A file is exported if:
|
|
@@ -216,7 +218,7 @@ const shouldExportFile = (
|
|
|
216
218
|
|
|
217
219
|
// Don't export the index file itself
|
|
218
220
|
if (
|
|
219
|
-
|
|
221
|
+
indexRegex.test(fileName) // Matches index.ts, index.mts, index.js, index.tsx
|
|
220
222
|
) {
|
|
221
223
|
return false;
|
|
222
224
|
}
|
|
@@ -234,6 +236,25 @@ const shouldExportFile = (
|
|
|
234
236
|
return true;
|
|
235
237
|
};
|
|
236
238
|
|
|
239
|
+
if (import.meta.vitest !== undefined) {
|
|
240
|
+
describe('index file regex', () => {
|
|
241
|
+
test.each([
|
|
242
|
+
['index.ts', true],
|
|
243
|
+
['index.js', true],
|
|
244
|
+
['index.mts', true],
|
|
245
|
+
['index.mjs', true],
|
|
246
|
+
['index.cts', true],
|
|
247
|
+
['index.cjs', true],
|
|
248
|
+
['index.tsx', true],
|
|
249
|
+
['index.jsx', true],
|
|
250
|
+
['not-index.ts', false],
|
|
251
|
+
['index.txt', false],
|
|
252
|
+
] as const)('indexRegex.test($0) to be $1', (fileName, expected) => {
|
|
253
|
+
expect(indexRegex.test(fileName)).toBe(expected);
|
|
254
|
+
});
|
|
255
|
+
});
|
|
256
|
+
}
|
|
257
|
+
|
|
237
258
|
/**
|
|
238
259
|
* Generates the content for an index file.
|
|
239
260
|
* @param subDirectories - Array of subdirectory names.
|
|
@@ -247,13 +268,17 @@ const generateIndexContent = (
|
|
|
247
268
|
config: GenIndexConfigInternal,
|
|
248
269
|
): string => {
|
|
249
270
|
const exportStatements = [
|
|
250
|
-
...subDirectories.map(
|
|
251
|
-
|
|
271
|
+
...subDirectories.map((subDir) =>
|
|
272
|
+
config.exportExtension === 'none'
|
|
273
|
+
? `export * from "./${subDir}";`
|
|
274
|
+
: `export * from "./${subDir}/index${config.exportExtension}";`,
|
|
252
275
|
),
|
|
253
276
|
...filesToExport.map((file) => {
|
|
254
277
|
const fileNameWithoutExt = path.basename(file, path.extname(file));
|
|
255
278
|
|
|
256
|
-
return
|
|
279
|
+
return config.exportExtension === 'none'
|
|
280
|
+
? `export * from "./${fileNameWithoutExt}";`
|
|
281
|
+
: `export * from "./${fileNameWithoutExt}${config.exportExtension}";`;
|
|
257
282
|
}),
|
|
258
283
|
];
|
|
259
284
|
|
|
@@ -78,11 +78,11 @@ export const executeStages = async (
|
|
|
78
78
|
|
|
79
79
|
const sorted = topologicalSortPackages(packages, dependencyGraph);
|
|
80
80
|
|
|
81
|
-
const
|
|
81
|
+
const mut_stages: (readonly Package[])[] = [];
|
|
82
82
|
const completed = new Set<string>();
|
|
83
83
|
|
|
84
84
|
while (completed.size < sorted.length) {
|
|
85
|
-
const
|
|
85
|
+
const mut_stage: Package[] = [];
|
|
86
86
|
|
|
87
87
|
for (const pkg of sorted) {
|
|
88
88
|
if (completed.has(pkg.name)) continue;
|
|
@@ -91,21 +91,21 @@ export const executeStages = async (
|
|
|
91
91
|
const depsCompleted = deps.every((dep) => completed.has(dep));
|
|
92
92
|
|
|
93
93
|
if (depsCompleted) {
|
|
94
|
-
|
|
94
|
+
mut_stage.push(pkg);
|
|
95
95
|
}
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
if (
|
|
98
|
+
if (mut_stage.length === 0) {
|
|
99
99
|
throw new Error('Circular dependency detected');
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
for (const pkg of
|
|
102
|
+
mut_stages.push(mut_stage);
|
|
103
|
+
for (const pkg of mut_stage) completed.add(pkg.name);
|
|
104
104
|
}
|
|
105
105
|
|
|
106
|
-
console.log(`\nExecuting ${scriptName} in ${
|
|
106
|
+
console.log(`\nExecuting ${scriptName} in ${mut_stages.length} stages...\n`);
|
|
107
107
|
|
|
108
|
-
for (const [i, stage] of
|
|
108
|
+
for (const [i, stage] of mut_stages.entries()) {
|
|
109
109
|
if (stage.length > 0) {
|
|
110
110
|
console.log(`Stage ${i + 1}: ${stage.map((p) => p.name).join(', ')}`);
|
|
111
111
|
// eslint-disable-next-line no-await-in-loop
|
|
@@ -199,7 +199,7 @@ const topologicalSortPackages = (
|
|
|
199
199
|
dependencyGraph: ReadonlyMap<string, readonly string[]>,
|
|
200
200
|
): readonly Package[] => {
|
|
201
201
|
const visited = new Set<string>();
|
|
202
|
-
const
|
|
202
|
+
const mut_result: string[] = [];
|
|
203
203
|
|
|
204
204
|
const packageMap = new Map(packages.map((p) => [p.name, p]));
|
|
205
205
|
|
|
@@ -212,14 +212,14 @@ const topologicalSortPackages = (
|
|
|
212
212
|
visit(dep);
|
|
213
213
|
}
|
|
214
214
|
|
|
215
|
-
|
|
215
|
+
mut_result.push(pkgName);
|
|
216
216
|
};
|
|
217
217
|
|
|
218
218
|
for (const pkg of packages) {
|
|
219
219
|
visit(pkg.name);
|
|
220
220
|
}
|
|
221
221
|
|
|
222
|
-
return
|
|
222
|
+
return mut_result
|
|
223
223
|
.map((pkgName) => packageMap.get(pkgName))
|
|
224
224
|
.filter(isNotUndefined);
|
|
225
225
|
};
|
|
@@ -33,10 +33,10 @@ export const runCmdInParallelAcrossWorkspaces = async ({
|
|
|
33
33
|
|
|
34
34
|
await executeParallel(filteredPackages, cmd, concurrency);
|
|
35
35
|
console.log(`\n✅ ${cmd} completed successfully`);
|
|
36
|
-
} catch (
|
|
36
|
+
} catch (error) {
|
|
37
37
|
console.error(
|
|
38
38
|
`\n❌ ${cmd} failed:`,
|
|
39
|
-
|
|
39
|
+
error instanceof Error ? error.message : (error?.toString() ?? ''),
|
|
40
40
|
);
|
|
41
41
|
process.exit(1);
|
|
42
42
|
}
|
|
@@ -35,10 +35,10 @@ export const runCmdInStagesAcrossWorkspaces = async ({
|
|
|
35
35
|
|
|
36
36
|
await executeStages(filteredPackages, cmd, concurrency);
|
|
37
37
|
console.log(`\n✅ ${cmd} completed successfully`);
|
|
38
|
-
} catch (
|
|
38
|
+
} catch (error) {
|
|
39
39
|
console.error(
|
|
40
40
|
`\n❌ ${cmd} failed:`,
|
|
41
|
-
|
|
41
|
+
error instanceof Error ? error.message : (error?.toString() ?? ''),
|
|
42
42
|
);
|
|
43
43
|
process.exit(1);
|
|
44
44
|
}
|
package/src/node-global.mts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { default as glob_ } from 'fast-glob';
|
|
2
2
|
import * as fs_ from 'node:fs/promises';
|
|
3
3
|
import * as path_ from 'node:path';
|
|
4
|
+
|
|
5
|
+
// eslint-disable-next-line import/no-internal-modules
|
|
4
6
|
import { $ as $_ } from './functions/exec-async.mjs';
|
|
5
7
|
|
|
6
8
|
const globalsDef = {
|
|
@@ -12,6 +14,7 @@ const globalsDef = {
|
|
|
12
14
|
glob: glob_,
|
|
13
15
|
} as const;
|
|
14
16
|
|
|
17
|
+
// eslint-disable-next-line functional/immutable-data
|
|
15
18
|
Object.assign(globalThis, globalsDef);
|
|
16
19
|
|
|
17
20
|
declare global {
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
describe('index file regex', () => {
|
|
2
|
-
const reg = /^index\.[cm]?[jt]s[x]?$/u;
|
|
3
|
-
|
|
4
|
-
test.each([
|
|
5
|
-
['index.ts', true],
|
|
6
|
-
['index.js', true],
|
|
7
|
-
['index.mts', true],
|
|
8
|
-
['index.mjs', true],
|
|
9
|
-
['index.cts', true],
|
|
10
|
-
['index.cjs', true],
|
|
11
|
-
['index.tsx', true],
|
|
12
|
-
['index.jsx', true],
|
|
13
|
-
['not-index.ts', false],
|
|
14
|
-
['index.txt', false],
|
|
15
|
-
] as const)('reg.test($0) to be $1', (fileName, expected) => {
|
|
16
|
-
expect(reg.test(fileName)).toBe(expected);
|
|
17
|
-
});
|
|
18
|
-
});
|