ts-repo-utils 6.2.0 → 7.0.1
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 +148 -32
- package/dist/cmd/assert-repo-is-clean.mjs +1 -1
- package/dist/cmd/check-should-run-type-checks.mjs +1 -1
- package/dist/cmd/format-diff-from.mjs +1 -1
- package/dist/cmd/format-uncommitted.mjs +1 -1
- package/dist/cmd/gen-index-ts.mjs +1 -1
- package/dist/functions/assert-repo-is-clean.d.mts.map +1 -1
- package/dist/functions/assert-repo-is-clean.mjs +30 -30
- package/dist/functions/assert-repo-is-clean.mjs.map +1 -1
- package/dist/functions/diff.d.mts +2 -2
- package/dist/functions/diff.mjs +4 -4
- package/dist/functions/diff.mjs.map +1 -1
- package/dist/functions/exec-async.d.mts +7 -8
- package/dist/functions/exec-async.d.mts.map +1 -1
- package/dist/functions/exec-async.mjs +5 -5
- package/dist/functions/exec-async.mjs.map +1 -1
- package/dist/functions/format.d.mts.map +1 -1
- package/dist/functions/format.mjs +12 -25
- package/dist/functions/format.mjs.map +1 -1
- package/dist/functions/gen-index.d.mts +2 -1
- package/dist/functions/gen-index.d.mts.map +1 -1
- package/dist/functions/gen-index.mjs +10 -8
- package/dist/functions/gen-index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/cmd/assert-repo-is-clean.mts +1 -1
- package/src/cmd/check-should-run-type-checks.mts +1 -1
- package/src/cmd/format-diff-from.mts +1 -1
- package/src/cmd/format-uncommitted.mts +1 -1
- package/src/cmd/gen-index-ts.mts +1 -1
- package/src/functions/assert-repo-is-clean.mts +43 -34
- package/src/functions/diff.mts +4 -4
- package/src/functions/exec-async.mts +25 -35
- package/src/functions/format.mts +14 -25
- package/src/functions/gen-index.mts +16 -10
|
@@ -71,12 +71,16 @@ type GenIndexConfigInternal = DeepReadonly<{
|
|
|
71
71
|
* @param config - Configuration for index file generation
|
|
72
72
|
* @throws Error if any step fails.
|
|
73
73
|
*/
|
|
74
|
-
export const genIndex = async (
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
export const genIndex = async (
|
|
75
|
+
config: GenIndexConfig,
|
|
76
|
+
): Promise<Result<undefined, unknown>> => {
|
|
77
77
|
// Merge config with defaults
|
|
78
78
|
const filledConfig: GenIndexConfigInternal = fillConfig(config);
|
|
79
79
|
|
|
80
|
+
const conditionalEcho = filledConfig.silent ? () => {} : echo;
|
|
81
|
+
|
|
82
|
+
conditionalEcho('Starting index file generation...\n');
|
|
83
|
+
|
|
80
84
|
// Normalize target directories to array
|
|
81
85
|
const targetDirs =
|
|
82
86
|
typeof config.targetDirectory === 'string'
|
|
@@ -92,30 +96,32 @@ export const genIndex = async (config: GenIndexConfig): Promise<void> => {
|
|
|
92
96
|
}
|
|
93
97
|
|
|
94
98
|
// Step 2: Generate index files
|
|
95
|
-
|
|
99
|
+
conditionalEcho('Generating index files...');
|
|
96
100
|
for (const dir of targetDirs) {
|
|
97
101
|
const resolvedDir = path.resolve(dir);
|
|
98
102
|
// eslint-disable-next-line no-await-in-loop
|
|
99
103
|
await generateIndexFileForDir(resolvedDir, filledConfig);
|
|
100
104
|
}
|
|
101
|
-
|
|
105
|
+
conditionalEcho('✓ Index files generated\n');
|
|
102
106
|
|
|
103
107
|
// Step 3: Format generated files
|
|
104
108
|
if (filledConfig.formatCommand !== undefined) {
|
|
105
|
-
|
|
109
|
+
conditionalEcho('Formatting generated files...');
|
|
106
110
|
const fmtResult = await $(filledConfig.formatCommand, {
|
|
107
111
|
silent: filledConfig.silent,
|
|
108
112
|
});
|
|
109
113
|
if (Result.isErr(fmtResult)) {
|
|
110
114
|
throw new Error(`Formatting failed: ${fmtResult.value.message}`);
|
|
111
115
|
}
|
|
112
|
-
|
|
116
|
+
conditionalEcho('✓ Formatting completed\n');
|
|
113
117
|
}
|
|
114
118
|
|
|
115
|
-
|
|
119
|
+
conditionalEcho('✅ Index file generation completed successfully!\n');
|
|
120
|
+
|
|
121
|
+
return Result.ok(undefined);
|
|
116
122
|
} catch (error) {
|
|
117
|
-
|
|
118
|
-
|
|
123
|
+
conditionalEcho(`❌ Index generation failed: ${String(error)}\n`);
|
|
124
|
+
return Result.err(error);
|
|
119
125
|
}
|
|
120
126
|
};
|
|
121
127
|
|