ts-repo-utils 7.2.0 → 7.3.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.
Files changed (34) hide show
  1. package/README.md +271 -245
  2. package/dist/cmd/assert-repo-is-clean.mjs +2 -1
  3. package/dist/cmd/assert-repo-is-clean.mjs.map +1 -1
  4. package/dist/cmd/check-should-run-type-checks.mjs +2 -1
  5. package/dist/cmd/check-should-run-type-checks.mjs.map +1 -1
  6. package/dist/cmd/format-diff-from.mjs +2 -1
  7. package/dist/cmd/format-diff-from.mjs.map +1 -1
  8. package/dist/cmd/format-uncommitted.mjs +2 -1
  9. package/dist/cmd/format-uncommitted.mjs.map +1 -1
  10. package/dist/cmd/gen-index-ts.mjs +2 -1
  11. package/dist/cmd/gen-index-ts.mjs.map +1 -1
  12. package/dist/functions/index.d.mts +1 -0
  13. package/dist/functions/index.d.mts.map +1 -1
  14. package/dist/functions/index.mjs +1 -0
  15. package/dist/functions/index.mjs.map +1 -1
  16. package/dist/functions/is-directly-executed.d.mts +2 -0
  17. package/dist/functions/is-directly-executed.d.mts.map +1 -0
  18. package/dist/functions/is-directly-executed.mjs +6 -0
  19. package/dist/functions/is-directly-executed.mjs.map +1 -0
  20. package/dist/index.mjs +1 -0
  21. package/dist/index.mjs.map +1 -1
  22. package/dist/node-global.d.mts +2 -0
  23. package/dist/node-global.d.mts.map +1 -1
  24. package/dist/node-global.mjs +3 -0
  25. package/dist/node-global.mjs.map +1 -1
  26. package/package.json +6 -6
  27. package/src/cmd/assert-repo-is-clean.mts +1 -1
  28. package/src/cmd/check-should-run-type-checks.mts +1 -1
  29. package/src/cmd/format-diff-from.mts +1 -1
  30. package/src/cmd/format-uncommitted.mts +1 -1
  31. package/src/cmd/gen-index-ts.mts +1 -1
  32. package/src/functions/index.mts +1 -0
  33. package/src/functions/is-directly-executed.mts +4 -0
  34. package/src/node-global.mts +4 -2
package/README.md CHANGED
@@ -12,47 +12,24 @@ A comprehensive toolkit for managing TypeScript projects with strict ESM support
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- npm install ts-repo-utils
15
+ npm add --save-dev ts-repo-utils
16
16
  ```
17
17
 
18
- ## CLI Commands
19
-
20
- `ts-repo-utils` provides several CLI commands that can be used directly or through npm scripts.
21
-
22
- ### `gen-index-ts`
23
-
24
- Generates index.ts files recursively in target directories with automatic barrel exports.
25
-
26
18
  ```bash
27
- # Basic usage with required options
28
- npm exec -- gen-index-ts ./src --target-ext .mts --index-ext .mts --export-ext .mjs
29
-
30
- # With formatting command
31
- npm exec -- gen-index-ts ./src --target-ext .mts --index-ext .mts --export-ext .mjs --fmt 'npm run fmt'
32
-
33
- # Multiple target extensions
34
- npm exec -- gen-index-ts ./src --target-ext .mts --target-ext .tsx --index-ext .mts --export-ext .mjs
35
-
36
- # With exclude patterns
37
- npm exec -- gen-index-ts ./src --target-ext .ts --index-ext .ts --export-ext .js --exclude '*.test.ts' --exclude '*.spec.ts'
19
+ yarn add --dev ts-repo-utils
20
+ ```
38
21
 
39
- # Example in npm scripts
40
- "gi": "gen-index-ts ./src --index-ext .mts --export-ext .mjs --target-ext .mts --target-ext .tsx --fmt 'npm run fmt'"
22
+ ```bash
23
+ pnpm add --save-dev ts-repo-utils
41
24
  ```
42
25
 
43
- **Options:**
26
+ ## CLI Commands
44
27
 
45
- - `<target-directory>` - Directory where the index file will be generated (comma-separated list can be used)
46
- - `--target-ext` - File extensions to include in the index file (required, can be specified multiple times)
47
- - `--index-ext` - Extension of the index file to be generated (required)
48
- - `--export-ext` - Extension of the export statements in the index file (required, or 'none')
49
- - `--exclude` - Glob patterns of files to exclude (optional, can be specified multiple times)
50
- - `--fmt` - Command to format after generating the index file (optional)
51
- - `--silent` - Suppress output messages (optional)
28
+ `ts-repo-utils` provides several CLI commands that can be used directly or through npm scripts.
52
29
 
53
30
  ### `assert-repo-is-clean`
54
31
 
55
- Checks if repository is clean and exits with code 1 if it has uncommitted changes.
32
+ Checks if the repository is clean (i.e., there are no uncommitted changes, untracked files, or staged files) and exits with code 1 if any are present.
56
33
 
57
34
  ```bash
58
35
  # Basic usage
@@ -64,6 +41,8 @@ npm exec -- assert-repo-is-clean --silent
64
41
 
65
42
  ```yaml
66
43
  # Example in GitHub Actions
44
+ - name: Format check
45
+ run: npm run fmt
67
46
  - name: Check if there is no file diff
68
47
  run: npm exec -- assert-repo-is-clean
69
48
  ```
@@ -108,9 +87,16 @@ npm exec -- format-diff-from main --exclude-untracked
108
87
 
109
88
  # Silent mode
110
89
  npm exec -- format-diff-from main --silent
90
+ ```
111
91
 
112
- # Example in npm scripts
113
- "fmt": "format-diff-from origin/main"
92
+ Example in npm scripts:
93
+
94
+ ```json
95
+ {
96
+ "scripts": {
97
+ "fmt": "npm exec -- format-diff-from origin/main"
98
+ }
99
+ }
114
100
  ```
115
101
 
116
102
  **Options:**
@@ -122,9 +108,53 @@ npm exec -- format-diff-from main --silent
122
108
  - `--silent` - Suppress output messages (default: false)
123
109
  - `--ignore-unknown` - Skip files without a Prettier parser instead of erroring (default: true)
124
110
 
111
+ ### `gen-index-ts`
112
+
113
+ Generates index.ts files recursively in target directories with automatic barrel exports.
114
+
115
+ ```bash
116
+ # Basic usage with required options
117
+ npm exec -- gen-index-ts ./src --target-ext .mts --index-ext .mts --export-ext .mjs
118
+
119
+ # With formatting command
120
+ npm exec -- gen-index-ts ./src --target-ext .mts --index-ext .mts --export-ext .mjs --fmt 'npm run fmt'
121
+
122
+ # Multiple target extensions
123
+ npm exec -- gen-index-ts ./src --target-ext .mts --target-ext .tsx --index-ext .mts --export-ext .mjs
124
+
125
+ # With exclude patterns
126
+ npm exec -- gen-index-ts ./src --target-ext .ts --index-ext .ts --export-ext .js --exclude '*.test.ts' --exclude '*.spec.ts'
127
+
128
+ # Example in npm scripts
129
+ "gi": "gen-index-ts ./src --index-ext .mts --export-ext .mjs --target-ext .mts --target-ext .tsx --fmt 'npm run fmt'"
130
+ ```
131
+
132
+ **Features:**
133
+
134
+ - Creates barrel exports for all subdirectories
135
+ - Supports complex glob exclusion patterns (using micromatch)
136
+ - Automatically formats generated files using the project's Prettier config
137
+ - Works with both single directories and directory arrays
138
+ - Respects source and export extension configuration
139
+
140
+ **Benefits:**
141
+
142
+ - Prevents forgetting to export modules
143
+ - TypeScript can detect duplicate variables, type names, etc.
144
+
145
+ **Options:**
146
+
147
+ - `<target-directory>` - Directory where the index file will be generated (comma-separated list can be used)
148
+ - `--target-ext` - File extensions to include in the index file (required, can be specified multiple times)
149
+ - `--index-ext` - Extension of the index file to be generated (required)
150
+ - `--export-ext` - Extension of the export statements in the index file (required, or 'none')
151
+ - `--exclude` - Glob patterns of files to exclude (optional, can be specified multiple times)
152
+ - `--fmt` - Command to format after generating the index file (optional)
153
+ - `--silent` - Suppress output messages (optional)
154
+
125
155
  ### `check-should-run-type-checks`
126
156
 
127
- Checks if TypeScript type checks should run based on the diff from a base branch. Optimizes CI/CD pipelines by skipping type checks when only non-TypeScript files are changed.
157
+ Checks whether TypeScript type checks should run based on file changes from the base branch. Optimizes CI/CD pipelines by skipping type checks when only non-TypeScript files have changed. The determination of "non-TypeScript files" is based on configurable ignore patterns, which can be specified using the `--paths-ignore` option.
128
158
 
129
159
  ```bash
130
160
  # Basic usage (compares against origin/main)
@@ -165,39 +195,79 @@ npm exec -- check-should-run-type-checks \
165
195
 
166
196
  When running in GitHub Actions, the command sets the `GITHUB_OUTPUT` environment variable with `should_run=true` or `should_run=false`, which can be used in subsequent steps.
167
197
 
168
- ### Usage in npm scripts
198
+ ## API Reference
169
199
 
170
- The CLI commands are commonly used in npm scripts for automation:
200
+ ### Command Execution
171
201
 
172
- ```json
173
- {
174
- "scripts": {
175
- "fmt": "format-diff-from origin/main",
176
- "gi": "gen-index-ts ./src --index-ext .mts --export-ext .mjs --target-ext .mts --target-ext .tsx --fmt 'npm run fmt'",
177
- "check:clean": "assert-repo-is-clean"
178
- }
202
+ #### `$(command: string, options?: ExecOptions): Promise<ExecResult>`
203
+
204
+ Executes a shell command asynchronously with type-safe results.
205
+
206
+ ```typescript
207
+ import { $, Result } from 'ts-repo-utils';
208
+
209
+ // or
210
+ // import "ts-repo-utils"; // $ and Result are globally defined in ts-repo-utils
211
+
212
+ const result = await $('npm test');
213
+
214
+ if (Result.isOk(result)) {
215
+ console.log('Tests passed:', result.value.stdout);
216
+ } else {
217
+ console.error('Tests failed:', result.value.message);
179
218
  }
180
219
  ```
181
220
 
182
- ### Usage in CI/CD
221
+ **Options:**
183
222
 
184
- These commands are particularly useful in CI/CD pipelines:
223
+ - `silent?: boolean` - Don't log command/output (default: false)
224
+ - `'node:child_process'` `exec` function options
185
225
 
186
- ```yaml
187
- # GitHub Actions example
188
- - name: Format check
189
- run: |
190
- npm run fmt
191
- npm exec -- assert-repo-is-clean
226
+ **Return Type:**
192
227
 
193
- # Check for uncommitted changes after build
194
- - name: Build
195
- run: npm run build
196
- - name: Check if there is no file diff
197
- run: npm exec -- assert-repo-is-clean
228
+ ```typescript
229
+ type Ret = Promise<
230
+ Result<
231
+ Readonly<{ stdout: string | Buffer; stderr: string | Buffer }>,
232
+ import('node:child_process').ExecException
233
+ >
234
+ >;
198
235
  ```
199
236
 
200
- ## API Reference
237
+ ### Script Execution Utilities
238
+
239
+ #### `isDirectlyExecuted(fileUrl: string): boolean`
240
+
241
+ Determines whether a script is being executed directly via CLI or imported as a module. This is useful for creating scripts that can both be imported as libraries and executed directly.
242
+
243
+ ```typescript
244
+ import { isDirectlyExecuted } from 'ts-repo-utils';
245
+
246
+ // or
247
+ // import "ts-repo-utils"; // isDirectlyExecuted is globally defined in ts-repo-utils
248
+
249
+ // calculator.mjs
250
+ export const add = (a: number, b: number): number => a + b;
251
+ export const multiply = (a: number, b: number): number => a * b;
252
+
253
+ // Only run main logic when executed directly: node calculator.mjs (or tsx calculator.mts)
254
+ // When imported elsewhere, only the functions are available
255
+ if (isDirectlyExecuted(import.meta.url)) {
256
+ console.log('Calculator CLI');
257
+ console.log('2 + 3 =', add(2, 3));
258
+ console.log('4 × 5 =', multiply(4, 5));
259
+ }
260
+ ```
261
+
262
+ When executed directly (`node calculator.mjs`), it runs the main function and prints the results. When imported (`import { add } from './calculator.mjs'`), it only provides the functions without executing the main logic.
263
+
264
+ NOTE: If you use [tsx](https://www.npmjs.com/package/tsx) or [ts-node](https://www.npmjs.com/package/ts-node), run your scripts with the extension `.(m)ts` instead of `.(m)js` so that `isDirectlyExecuted` can correctly determine if the script is executed directly.
265
+
266
+ **Use Cases:**
267
+
268
+ - Creating CLI tools that can also be used as libraries
269
+ - Preventing automatic execution when a file is imported
270
+ - Running initialization code only during direct execution
201
271
 
202
272
  ### Path and File System Utilities
203
273
 
@@ -209,7 +279,7 @@ Checks if a file or directory exists at the specified path.
209
279
  import { pathExists } from 'ts-repo-utils';
210
280
 
211
281
  const exists = await pathExists('./src/index.ts');
212
- console.log(exists); // true or false
282
+ console.log(exists satisfies boolean); // true or false
213
283
  ```
214
284
 
215
285
  #### `assertPathExists(filePath: string, description?: string): Promise<void>`
@@ -223,8 +293,6 @@ import { assertPathExists } from 'ts-repo-utils';
223
293
  await assertPathExists('./src/index.ts', 'Entry point file');
224
294
  ```
225
295
 
226
- ### File Extension Validation
227
-
228
296
  #### `assertExt(config: CheckExtConfig): Promise<void>`
229
297
 
230
298
  Validates that all files in specified directories have the correct extensions. Exits with code 1 if any files have incorrect extensions.
@@ -250,12 +318,12 @@ await assertExt({
250
318
  **Configuration Type:**
251
319
 
252
320
  ```typescript
253
- type CheckExtConfig = DeepReadonly<{
254
- directories: {
321
+ type CheckExtConfig = Readonly<{
322
+ directories: readonly Readonly<{
255
323
  path: string; // Directory path to check
256
324
  extension: string; // Expected file extension (including the dot)
257
- ignorePatterns?: string[]; // Optional glob patterns to ignore
258
- }[];
325
+ ignorePatterns?: readonly string[]; // Optional glob patterns to ignore
326
+ }>[];
259
327
  }>;
260
328
  ```
261
329
 
@@ -276,7 +344,8 @@ if (isDirty) {
276
344
 
277
345
  #### `assertRepoIsClean(): Promise<void>`
278
346
 
279
- Checks if repository is clean and exits with code 1 if it has uncommitted changes (shows changes and diff).
347
+ Checks if the repository is clean and exits with code 1 if it has uncommitted changes (shows changes and diff).
348
+ (Function version of the `assert-repo-is-clean` command)
280
349
 
281
350
  ```typescript
282
351
  import { assertRepoIsClean } from 'ts-repo-utils';
@@ -293,22 +362,22 @@ await assertRepoIsClean();
293
362
 
294
363
  ##### `getUntrackedFiles(options?)`
295
364
 
296
- Get untracked files from the working tree (files not added to git).
365
+ Gets untracked files from the working tree (files not added to git).
297
366
  Runs `git ls-files --others --exclude-standard [--deleted]`
298
367
 
299
368
  ##### `getModifiedFiles(options?)`
300
369
 
301
- Get modified files from the working tree (files that have been changed but not staged).
370
+ Gets modified files from the working tree (files that have been changed but not staged).
302
371
  Runs `git diff --name-only [--diff-filter=d]`
303
372
 
304
373
  ##### `getStagedFiles(options?)`
305
374
 
306
- Get files that are staged for commit (files added with git add).
375
+ Gets files that are staged for commit (files added with git add).
307
376
  Runs `git diff --staged --name-only [--diff-filter=d]`
308
377
 
309
378
  ##### `getDiffFrom(base: string, options?)`
310
379
 
311
- Get files that differ from the specified base branch or commit.
380
+ Gets files that differ from the specified base branch or commit.
312
381
  Runs `git diff --name-only <base> [--diff-filter=d]`
313
382
 
314
383
  **Common options:**
@@ -321,87 +390,7 @@ Runs `git diff --name-only <base> [--diff-filter=d]`
321
390
  ```typescript
322
391
  type Ret = Result<
323
392
  readonly string[],
324
- ExecException | Readonly<{ message: string }>
325
- >;
326
- ```
327
-
328
- ### Build Optimization Utilities
329
-
330
- #### `checkShouldRunTypeChecks(options?): Promise<boolean>`
331
-
332
- Checks if TypeScript type checks should run based on the diff from a base branch. Optimizes CI/CD pipelines by skipping type checks when only non-TypeScript files are changed.
333
-
334
- ```typescript
335
- import { checkShouldRunTypeChecks } from 'ts-repo-utils';
336
-
337
- // Use default settings (compare against origin/main)
338
- const shouldRun = await checkShouldRunTypeChecks();
339
-
340
- if (shouldRun) {
341
- await $('npm run type-check');
342
- }
343
-
344
- // Custom ignore patterns and base branch
345
- const shouldRun = await checkShouldRunTypeChecks({
346
- pathsIgnore: ['.eslintrc.json', 'docs/', '**.md', 'scripts/'],
347
- baseBranch: 'origin/develop',
348
- });
349
- ```
350
-
351
- **Options:**
352
-
353
- - `pathsIgnore?` - Patterns to ignore when checking if type checks should run:
354
- - Exact file matches: `.cspell.json`
355
- - Directory prefixes: `docs/` (matches any file in docs directory)
356
- - File extensions: `**.md` (matches any markdown file)
357
- - Default: `['LICENSE', '.editorconfig', '.gitignore', '.cspell.json', '.markdownlint-cli2.mjs', '.npmignore', '.prettierignore', '.prettierrc', 'docs/', '**.md', '**.txt']`
358
- - `baseBranch?` - Base branch to compare against (default: `origin/main`)
359
-
360
- **GitHub Actions Integration:**
361
-
362
- When running in GitHub Actions, sets `GITHUB_OUTPUT` with `should_run=true/false`:
363
-
364
- ```yaml
365
- - name: Check if type checks should run
366
- id: check_diff
367
- run: npx check-should-run-type-checks
368
-
369
- - name: Run type checks
370
- if: steps.check_diff.outputs.should_run == 'true'
371
- run: npm run type-check
372
- ```
373
-
374
- ### Command Execution
375
-
376
- #### `$(command: string, options?: ExecOptions): Promise<ExecResult>`
377
-
378
- Executes a shell command asynchronously with timeout support and type-safe results.
379
-
380
- ```typescript
381
- import { $ } from 'ts-repo-utils';
382
-
383
- const result = await $('npm test', { timeout: 60000 });
384
-
385
- if (result.type === 'ok') {
386
- console.log('Tests passed:', result.stdout);
387
- } else {
388
- console.error('Tests failed:', result.exception.message);
389
- }
390
- ```
391
-
392
- **Options:**
393
-
394
- - `silent?: boolean` - Don't log command/output (default: false)
395
- - `'node:child_process'` `exec` function options
396
-
397
- **Return Type:**
398
-
399
- ```typescript
400
- type Ret = Promise<
401
- Result<
402
- Readonly<{ stdout: string | Buffer; stderr: string | Buffer }>,
403
- import('node:child_process').ExecException
404
- >
393
+ import('node:child_process').ExecException | Readonly<{ message: string }>
405
394
  >;
406
395
  ```
407
396
 
@@ -409,7 +398,7 @@ type Ret = Promise<
409
398
 
410
399
  #### `formatFilesGlob(pathGlob: string, options?): Promise<Result<undefined, unknown>>`
411
400
 
412
- Format files matching a glob pattern using Prettier.
401
+ Formats files matching a glob pattern using Prettier.
413
402
 
414
403
  ```typescript
415
404
  import { formatFilesGlob } from 'ts-repo-utils';
@@ -435,7 +424,8 @@ await formatFilesGlob('src/**/*.ts', {
435
424
 
436
425
  #### `formatUncommittedFiles(options?): Promise<Result>`
437
426
 
438
- Format only files that have been changed according to git status.
427
+ Formats only files that have been changed according to git status.
428
+ (Function version of the `format-uncommitted` command)
439
429
 
440
430
  ```typescript
441
431
  import { formatUncommittedFiles } from 'ts-repo-utils';
@@ -465,14 +455,17 @@ await formatUncommittedFiles({
465
455
  type Ret = Promise<
466
456
  Result<
467
457
  undefined,
468
- ExecException | Readonly<{ message: string }> | readonly unknown[]
458
+ | import('node:child_process').ExecException
459
+ | Readonly<{ message: string }>
460
+ | readonly unknown[]
469
461
  >
470
462
  >;
471
463
  ```
472
464
 
473
465
  #### `formatDiffFrom(base: string, options?): Promise<Result>`
474
466
 
475
- Format only files that differ from the specified base branch or commit.
467
+ Formats only files that differ from the specified base branch or commit.
468
+ (Function version of the `format-diff-from` command)
476
469
 
477
470
  ```typescript
478
471
  import { formatDiffFrom } from 'ts-repo-utils';
@@ -506,26 +499,102 @@ await formatDiffFrom('main', {
506
499
  type Ret = Promise<
507
500
  Result<
508
501
  undefined,
509
- ExecException | Readonly<{ message: string }> | readonly unknown[]
502
+ | import('node:child_process').ExecException
503
+ | Readonly<{ message: string }>
504
+ | readonly unknown[]
510
505
  >
511
506
  >;
512
507
  ```
513
508
 
514
- ### Workspace Management Utilities
509
+ ### Index File Generation
510
+
511
+ #### `genIndex(config: GenIndexConfig): Promise<Result<undefined, unknown>>`
512
+
513
+ Generates index files recursively in target directories with automatic barrel exports.
514
+ (Function version of the `gen-index-ts` command)
515
+
516
+ ```typescript
517
+ import { genIndex } from 'ts-repo-utils';
518
+
519
+ await genIndex({
520
+ targetDirectory: './src',
521
+ exclude: ['*.test.ts', '*.spec.ts'],
522
+ });
523
+ ```
524
+
525
+ **Configuration Type:**
526
+
527
+ ```typescript
528
+ type GenIndexConfig = Readonly<{
529
+ /**
530
+ * Target directories to generate index files for (string or array of
531
+ * strings)
532
+ */
533
+ targetDirectory: string | readonly string[];
534
+
535
+ /**
536
+ * Glob patterns for files or predicate function to exclude from exports
537
+ * (default: excludes `'**\/*.{test,spec}.?(c|m)[jt]s?(x)'` and
538
+ * `'**\/*.d.?(c|m)ts'`)
539
+ */
540
+ exclude?:
541
+ | readonly string[]
542
+ | ((
543
+ args: Readonly<{
544
+ absolutePath: string;
545
+ relativePath: string;
546
+ fileName: string;
547
+ }>,
548
+ ) => boolean);
549
+
550
+ /**
551
+ * File extensions of source files to include in exports (default: ['.ts',
552
+ * '.tsx'])
553
+ */
554
+ targetExtensions?: readonly `.${string}`[];
555
+
556
+ /** File extension of index files to generate (default: '.ts') */
557
+ indexFileExtension?: `.${string}`;
558
+
559
+ /** File extension to use in export statements (default: '.js') */
560
+ exportStatementExtension?: `.${string}` | 'none';
561
+
562
+ /** Command to run for formatting generated files (optional) */
563
+ formatCommand?: string;
564
+
565
+ /** Whether to suppress output during execution (default: false) */
566
+ silent?: boolean;
567
+ }>;
568
+ ```
569
+
570
+ **Features:**
571
+
572
+ - Creates barrel exports for all subdirectories
573
+ - Supports complex glob exclusion patterns (using micromatch)
574
+ - Automatically formats generated files using the project's Prettier config
575
+ - Works with both single directories and directory arrays
576
+ - Respects source and export extension configuration
577
+
578
+ **Benefits:**
579
+
580
+ - Prevents forgetting to export modules
581
+ - TypeScript can detect duplicate variables, type names, etc.
582
+
583
+ ### Monorepo Workspace Management Utilities
515
584
 
516
585
  #### `runCmdInStagesAcrossWorkspaces(options): Promise<void>`
517
586
 
518
- Executes a npm script command across all workspace packages in dependency order stages. Packages are grouped into stages where each stage contains packages whose dependencies have been completed in previous stages. Uses fail-fast behavior.
587
+ Executes an npm script command across all workspace packages in dependency order stages. Packages are grouped into stages where each stage contains packages whose dependencies have been completed in previous stages. Uses fail-fast behavior.
519
588
 
520
589
  ```typescript
521
590
  import { runCmdInStagesAcrossWorkspaces } from 'ts-repo-utils';
522
591
 
523
592
  // Run build in dependency order
524
593
  await runCmdInStagesAcrossWorkspaces({
525
- rootPackageJsonDir: '.',
594
+ rootPackageJsonDir: '../',
526
595
  cmd: 'build',
527
596
  concurrency: 3,
528
- filterWorkspacePattern: (name) => !name.includes('deprecated'),
597
+ filterWorkspacePattern: (name) => !name.includes('experimental'),
529
598
  });
530
599
  ```
531
600
 
@@ -538,16 +607,17 @@ await runCmdInStagesAcrossWorkspaces({
538
607
 
539
608
  #### `runCmdInParallelAcrossWorkspaces(options): Promise<void>`
540
609
 
541
- Executes a npm script command across all workspace packages in parallel. Uses fail-fast behavior - stops execution immediately when any package fails.
610
+ Executes an npm script command across all workspace packages in parallel. Uses fail-fast behavior - stops execution immediately when any package fails.
542
611
 
543
612
  ```typescript
544
613
  import { runCmdInParallelAcrossWorkspaces } from 'ts-repo-utils';
545
614
 
546
615
  // Run tests in parallel across all packages
547
616
  await runCmdInParallelAcrossWorkspaces({
548
- rootPackageJsonDir: '.',
617
+ rootPackageJsonDir: '../',
549
618
  cmd: 'test',
550
619
  concurrency: 5,
620
+ filterWorkspacePattern: (name) => !name.includes('experimental'),
551
621
  });
552
622
  ```
553
623
 
@@ -573,17 +643,17 @@ console.log(packages.map((pkg) => pkg.name));
573
643
  **Return Type:**
574
644
 
575
645
  ```typescript
576
- type Package = {
646
+ type Package = Readonly<{
577
647
  name: string;
578
648
  path: string;
579
649
  packageJson: JsonValue;
580
- dependencies: Record<string, string>;
581
- };
650
+ dependencies: Readonly<Record<string, string>>;
651
+ }>;
582
652
  ```
583
653
 
584
654
  #### `executeParallel(packages, scriptName, concurrency?): Promise<readonly Result[]>`
585
655
 
586
- Executes a npm script across multiple packages in parallel with a concurrency limit. Lower-level function used by `runCmdInParallelAcrossWorkspaces`.
656
+ Executes an npm script across multiple packages in parallel with a concurrency limit. Lower-level function used by `runCmdInParallelAcrossWorkspaces`.
587
657
 
588
658
  ```typescript
589
659
  import { executeParallel, getWorkspacePackages } from 'ts-repo-utils';
@@ -594,7 +664,7 @@ await executeParallel(packages, 'lint', 4);
594
664
 
595
665
  #### `executeStages(packages, scriptName, concurrency?): Promise<void>`
596
666
 
597
- Executes a npm script across packages in dependency order stages. Lower-level function used by `runCmdInStagesAcrossWorkspaces`.
667
+ Executes an npm script across packages in dependency order stages. Lower-level function used by `runCmdInStagesAcrossWorkspaces`.
598
668
 
599
669
  ```typescript
600
670
  import { executeStages, getWorkspacePackages } from 'ts-repo-utils';
@@ -611,93 +681,49 @@ await executeStages(packages, 'build', 3);
611
681
  - Fail-fast behavior on errors
612
682
  - Circular dependency detection
613
683
 
614
- ### Index File Generation
615
-
616
- #### `genIndex(config: GenIndexConfig): Promise<Result<undefined, unknown>>`
684
+ ### Globals
617
685
 
618
- Generates index files recursively in target directories with automatic barrel exports.
686
+ When you import `ts-repo-utils` without destructuring, several utilities become globally available. This is useful for scripts where you want quick access to common functions without explicit imports.
619
687
 
620
688
  ```typescript
621
- import { genIndex } from 'ts-repo-utils';
622
-
623
- await genIndex({
624
- targetDirectory: './src',
625
- exclude: ['*.test.ts', '*.spec.ts'],
626
- });
627
- ```
689
+ import 'ts-repo-utils';
628
690
 
629
- **Configuration Type:**
630
-
631
- ```typescript
632
- type GenIndexConfig = DeepReadonly<{
633
- /**
634
- * Target directories to generate index files for (string or array of
635
- * strings)
636
- */
637
- targetDirectory: string | readonly string[];
691
+ // Now these functions are globally available
638
692
 
639
- /**
640
- * Glob patterns of files or predicate function to exclude from exports
641
- * (default: excludes `'**\/*.{test,spec}.?(c|m)[jt]s?(x)'` and
642
- * `'**\/*.d.?(c|m)ts'`)
643
- */
644
- exclude?:
645
- | readonly string[]
646
- | ((
647
- args: Readonly<{
648
- absolutePath: string;
649
- relativePath: string;
650
- fileName: string;
651
- }>,
652
- ) => boolean);
693
+ await $('npm test');
653
694
 
654
- /** File extensions of source files to export (default: ['.ts', '.tsx']) */
655
- targetExtensions?: readonly `.${string}`[];
695
+ echo('Building project...');
656
696
 
657
- /** File extension of index files to generate (default: '.ts') */
658
- indexFileExtension?: `.${string}`;
697
+ const filePath: string = path.join('src', 'index.ts');
659
698
 
660
- /** File extension to use in export statements (default: '.js') */
661
- exportStatementExtension?: `.${string}` | 'none';
699
+ const configJson: string = await fs.readFile('./config.json', {
700
+ encoding: 'utf8',
701
+ });
662
702
 
663
- /** Command to run for formatting generated files (optional) */
664
- formatCommand?: string;
703
+ const files: readonly string[] = await glob('**/*.ts');
665
704
 
666
- /** Whether to suppress output during execution (default: false) */
667
- silent?: boolean;
668
- }>;
705
+ if (isDirectlyExecuted(import.meta.url)) {
706
+ echo('Running as CLI');
707
+ }
669
708
  ```
670
709
 
671
- **Features:**
672
-
673
- - Creates barrel exports for all subdirectories
674
- - Supports complex glob exclusion patterns (using micromatch)
675
- - Automatically formats generated files using project's prettier config
676
- - Works with both single directories and directory arrays
677
- - Respects source and export extension configuration
678
-
679
- **Benefits:**
680
-
681
- - Prevents forgetting to export libraries
682
- - tsc can detect duplicate variables, type names, etc.
683
-
684
- ## Key Features
685
-
686
- - **Type Safety**: All functions use strict TypeScript types with readonly parameters
687
- - **Error Handling**: Comprehensive error handling with descriptive messages
688
- - **Git Integration**: Built-in git status and diff utilities
689
- - **Formatting**: Prettier integration with configuration resolution
690
- - **ESM Support**: Designed for ES modules with .mts/.mjs extension handling
691
- - **Concurrent Processing**: Uses Promise.all for performance optimization
692
- - **Configurable**: Flexible configuration options with sensible defaults
693
- - **Console Feedback**: Informative logging throughout operations
710
+ - `$` - The command execution utility described above.
711
+ - `echo` - Equivalent to `console.log`
712
+ - `path` - `node:path`
713
+ - `fs` - `node:fs/promises`
714
+ - `glob` - `fast-glob`
715
+ - `isDirectlyExecuted` - The script execution utility described above.
694
716
 
695
717
  ## Common Patterns
696
718
 
697
719
  ### Pre-commit Hook
698
720
 
699
721
  ```typescript
700
- import { formatUntracked, assertExt, assertRepoIsClean } from 'ts-repo-utils';
722
+ import {
723
+ assertExt,
724
+ assertRepoIsClean,
725
+ formatUncommittedFiles,
726
+ } from 'ts-repo-utils';
701
727
 
702
728
  // Validate file extensions
703
729
  await assertExt({
@@ -714,15 +740,7 @@ await assertRepoIsClean();
714
740
  ### Build Pipeline
715
741
 
716
742
  ```typescript
717
- import { assertExt, genIndex, $, formatFilesGlob } from 'ts-repo-utils';
718
-
719
- // Validate extensions
720
- await assertExt({
721
- directories: [
722
- { path: './src', extension: '.ts' },
723
- { path: './scripts', extension: '.mjs' },
724
- ],
725
- });
743
+ import { formatFilesGlob, genIndex } from 'ts-repo-utils';
726
744
 
727
745
  // Generate barrel exports
728
746
  await genIndex({ targetDirectory: './src' });
@@ -740,12 +758,20 @@ await formatFilesGlob('dist/**/*.js');
740
758
  ### Project Validation
741
759
 
742
760
  ```typescript
743
- import { pathExists, assertPathExists, assertRepoIsClean } from 'ts-repo-utils';
761
+ import { assertExt, assertPathExists, assertRepoIsClean } from 'ts-repo-utils';
744
762
 
745
763
  // Check required files exist (exits with code 1 if files don't exist)
746
764
  await assertPathExists('./package.json', 'Package manifest');
747
765
  await assertPathExists('./tsconfig.json', 'TypeScript config');
748
766
 
767
+ // Validate extensions
768
+ await assertExt({
769
+ directories: [
770
+ { path: './src', extension: '.ts' },
771
+ { path: './scripts', extension: '.mjs' },
772
+ ],
773
+ });
774
+
749
775
  // Verify clean repository state (exits with code 1 if repo is dirty)
750
776
  await assertRepoIsClean();
751
777
  ```
@@ -6,11 +6,12 @@ import { assertRepoIsClean } from '../functions/assert-repo-is-clean.mjs';
6
6
  import 'node:child_process';
7
7
  import 'prettier';
8
8
  import 'micromatch';
9
+ import 'node:url';
9
10
  import 'child_process';
10
11
 
11
12
  const cmdDef = cmd.command({
12
13
  name: 'assert-repo-is-clean-cli',
13
- version: '7.2.0',
14
+ version: '7.3.1',
14
15
  args: {
15
16
  silent: cmd.flag({
16
17
  long: 'silent',
@@ -1 +1 @@
1
- {"version":3,"file":"assert-repo-is-clean.mjs","sources":["../../src/cmd/assert-repo-is-clean.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAKA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;AACzB,IAAA,IAAI,EAAE,0BAA0B;AAChC,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ,QAAA,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC;AACf,YAAA,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EAAE,sDAAsD;SACpE,CAAC;AACH,KAAA;AACD,IAAA,OAAO,EAAE,CAAC,IAAI,KAAI;QAChB,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAI;AACzB,YAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC;AAC1C,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ,CAAC;AACF,CAAA,CAAC;AAEF,MAAM,IAAI,GAAG,OAAO,IAAoC,KAAmB;IACzE,MAAM,iBAAiB,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"assert-repo-is-clean.mjs","sources":["../../src/cmd/assert-repo-is-clean.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;AAKA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;AACzB,IAAA,IAAI,EAAE,0BAA0B;AAChC,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ,QAAA,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC;AACf,YAAA,IAAI,EAAE,QAAQ;YACd,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EAAE,sDAAsD;SACpE,CAAC;AACH,KAAA;AACD,IAAA,OAAO,EAAE,CAAC,IAAI,KAAI;QAChB,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAI;AACzB,YAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC;AAC1C,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ,CAAC;AACF,CAAA,CAAC;AAEF,MAAM,IAAI,GAAG,OAAO,IAAoC,KAAmB;IACzE,MAAM,iBAAiB,CAAC,EAAE,MAAM,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
@@ -5,12 +5,13 @@ import '../node-global.mjs';
5
5
  import 'node:child_process';
6
6
  import 'prettier';
7
7
  import 'micromatch';
8
+ import 'node:url';
8
9
  import { checkShouldRunTypeChecks } from '../functions/should-run.mjs';
9
10
  import 'child_process';
10
11
 
11
12
  const cmdDef = cmd.command({
12
13
  name: 'check-should-run-type-checks-cli',
13
- version: '7.2.0',
14
+ version: '7.3.1',
14
15
  args: {
15
16
  pathsIgnore: cmd.multioption({
16
17
  long: 'paths-ignore',
@@ -1 +1 @@
1
- {"version":3,"file":"check-should-run-type-checks.mjs","sources":["../../src/cmd/check-should-run-type-checks.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;AAKA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;AACzB,IAAA,IAAI,EAAE,kCAAkC;AACxC,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ,QAAA,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC;AAC3B,YAAA,IAAI,EAAE,cAAc;AACpB,YAAA,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACzC,YAAA,WAAW,EACT,0KAA0K;SAC7K,CAAC;AACF,QAAA,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC;AACrB,YAAA,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;AAC9B,YAAA,WAAW,EACT,yFAAyF;SAC5F,CAAC;AACH,KAAA;AACD,IAAA,OAAO,EAAE,CAAC,IAAI,KAAI;QAChB,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAI;AACzB,YAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC;AAC1C,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ,CAAC;AACF,CAAA,CAAC;AAEF,MAAM,IAAI,GAAG,OACX,IAGE,KACe;AACjB,IAAA,MAAM,wBAAwB,CAAC;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;AAC5B,KAAA,CAAC;AACJ,CAAC;AAED,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
1
+ {"version":3,"file":"check-should-run-type-checks.mjs","sources":["../../src/cmd/check-should-run-type-checks.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;AAKA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;AACzB,IAAA,IAAI,EAAE,kCAAkC;AACxC,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ,QAAA,WAAW,EAAE,GAAG,CAAC,WAAW,CAAC;AAC3B,YAAA,IAAI,EAAE,cAAc;AACpB,YAAA,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AACzC,YAAA,WAAW,EACT,0KAA0K;SAC7K,CAAC;AACF,QAAA,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC;AACrB,YAAA,IAAI,EAAE,aAAa;YACnB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC;AAC9B,YAAA,WAAW,EACT,yFAAyF;SAC5F,CAAC;AACH,KAAA;AACD,IAAA,OAAO,EAAE,CAAC,IAAI,KAAI;QAChB,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,KAAI;AACzB,YAAA,OAAO,CAAC,KAAK,CAAC,oBAAoB,EAAE,KAAK,CAAC;AAC1C,YAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;AACjB,QAAA,CAAC,CAAC;IACJ,CAAC;AACF,CAAA,CAAC;AAEF,MAAM,IAAI,GAAG,OACX,IAGE,KACe;AACjB,IAAA,MAAM,wBAAwB,CAAC;QAC7B,WAAW,EAAE,IAAI,CAAC,WAAW;QAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;AAC5B,KAAA,CAAC;AACJ,CAAC;AAED,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
@@ -5,11 +5,12 @@ import '../node-global.mjs';
5
5
  import 'node:child_process';
6
6
  import { formatDiffFrom } from '../functions/format.mjs';
7
7
  import 'micromatch';
8
+ import 'node:url';
8
9
  import 'child_process';
9
10
 
10
11
  const cmdDef = cmd.command({
11
12
  name: 'format-diff-from-cli',
12
- version: '7.2.0',
13
+ version: '7.3.1',
13
14
  args: {
14
15
  base: cmd.positional({
15
16
  type: cmd.string,
@@ -1 +1 @@
1
- {"version":3,"file":"format-diff-from.mjs","sources":["../../src/cmd/format-diff-from.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAMA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;AACzB,IAAA,IAAI,EAAE,sBAAsB;AAC5B,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ,QAAA,IAAI,EAAE,GAAG,CAAC,UAAU,CAAC;YACnB,IAAI,EAAE,GAAG,CAAC,MAAM;AAChB,YAAA,WAAW,EAAE,MAAM;AACnB,YAAA,WAAW,EAAE,oDAAoD;SAClE,CAAC;AACF,QAAA,gBAAgB,EAAE,GAAG,CAAC,IAAI,CAAC;AACzB,YAAA,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EACT,oEAAoE;SACvE,CAAC;AACF,QAAA,eAAe,EAAE,GAAG,CAAC,IAAI,CAAC;AACxB,YAAA,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EACT,mEAAmE;SACtE,CAAC;AACF,QAAA,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC;AACtB,YAAA,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EACT,iEAAiE;SACpE,CAAC;AACF,QAAA,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC;AACtB,YAAA,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EAAE,sCAAsC;SACpD,CAAC;AACF,QAAA,MAAM,EAAE,GAAG,CAAC,IAAI,CAAC;AACf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AAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjB;AACF,CAAC;AAED,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
@@ -5,11 +5,12 @@ import '../node-global.mjs';
5
5
  import 'node:child_process';
6
6
  import { formatUncommittedFiles } from '../functions/format.mjs';
7
7
  import 'micromatch';
8
+ import 'node:url';
8
9
  import 'child_process';
9
10
 
10
11
  const cmdDef = cmd.command({
11
12
  name: 'format-uncommitted-cli',
12
- version: '7.2.0',
13
+ version: '7.3.1',
13
14
  args: {
14
15
  excludeUntracked: cmd.flag({
15
16
  long: 'exclude-untracked',
@@ -1 +1 @@
1
- {"version":3,"file":"format-uncommitted.mjs","sources":["../../src/cmd/format-uncommitted.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAMA,MAAM,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC;AACzB,IAAA,IAAI,EAAE,wBAAwB;AAC9B,IAAA,OAAO,EAAE,OAAO;AAChB,IAAA,IAAI,EAAE;AACJ,QAAA,gBAAgB,EAAE,GAAG,CAAC,IAAI,CAAC;AACzB,YAAA,IAAI,EAAE,mBAAmB;YACzB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EACT,oEAAoE;SACvE,CAAC;AACF,QAAA,eAAe,EAAE,GAAG,CAAC,IAAI,CAAC;AACxB,YAAA,IAAI,EAAE,kBAAkB;YACxB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAAW,EACT,mEAAmE;SACtE,CAAC;AACF,QAAA,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC;AACtB,YAAA,IAAI,EAAE,gBAAgB;YACtB,IAAI,EAAE,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,OAAO,CAAC;AAC/B,YAAA,WAA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ACxB,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjB;AACF,CAAC;AAED,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
@@ -5,6 +5,7 @@ import '../node-global.mjs';
5
5
  import 'node:child_process';
6
6
  import 'prettier';
7
7
  import { genIndex } from '../functions/gen-index.mjs';
8
+ import 'node:url';
8
9
  import 'child_process';
9
10
 
10
11
  const extensionType = cmd.extendType(cmd.string, {
@@ -28,7 +29,7 @@ const nonEmptyArray = (t, commandName) => cmd.extendType(cmd.array(t), {
28
29
  });
29
30
  const cmdDef = cmd.command({
30
31
  name: 'gen-index-ts-cli',
31
- version: '7.2.0',
32
+ version: '7.3.1',
32
33
  args: {
33
34
  // required args
34
35
  targetDirectory: cmd.positional({
@@ -1 +1 @@
1
- {"version":3,"file":"gen-index-ts.mjs","sources":["../../src/cmd/gen-index-ts.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;AAWA,MAAM,aAAa,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,MAAM,EAAE;AAC/C,IAAA,IAAI,EAAE,CAAC,CAAC,KAAI;QACV,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE;AACtB,YAAA,MAAM,IAAI,KAAK,CAAC,CAAA,yBAAA,CAA2B,CAAC;;;AAG9C,QAAA,OAAO,OAAO,CAAC,OAAO,CAAC,CAAQ,CAAC;KACjC;AACF,CAAA,CAAC;AAEF;AACA,MAAM,aAAa,GAAG,CACpB,CAAI,EACJ,WAAmB,KAEnB,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;AAC3B,IAAA,IAAI,EAAE,CAAC,GAAG,KAAI;AACZ,QAAA,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,EAAE;AACpB,YAAA,MAAM,IAAI,KAAK,CACb,2BAA2B,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from './exec-async.mjs';
6
6
  export * from './format.mjs';
7
7
  export * from './gen-index.mjs';
8
+ export * from './is-directly-executed.mjs';
8
9
  export * from './should-run.mjs';
9
10
  export * from './workspace-utils/index.mjs';
10
11
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/functions/index.mts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/functions/index.mts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,iBAAiB,CAAC;AAChC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC;AACjC,cAAc,6BAA6B,CAAC"}
@@ -5,6 +5,7 @@ export { getDiffFrom, getModifiedFiles, getStagedFiles, getUntrackedFiles } from
5
5
  export { $ } from './exec-async.mjs';
6
6
  export { formatDiffFrom, formatFiles, formatFilesGlob, formatUncommittedFiles } from './format.mjs';
7
7
  export { genIndex } from './gen-index.mjs';
8
+ export { isDirectlyExecuted } from './is-directly-executed.mjs';
8
9
  export { checkShouldRunTypeChecks } from './should-run.mjs';
9
10
  export { executeParallel, executeStages } from './workspace-utils/execute-parallel.mjs';
10
11
  export { getWorkspacePackages } from './workspace-utils/get-workspace-packages.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export declare const isDirectlyExecuted: (fileUrl: string) => boolean;
2
+ //# sourceMappingURL=is-directly-executed.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-directly-executed.d.mts","sourceRoot":"","sources":["../../src/functions/is-directly-executed.mts"],"names":[],"mappings":"AAEA,eAAO,MAAM,kBAAkB,GAAI,SAAS,MAAM,KAAG,OACT,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { fileURLToPath } from 'node:url';
2
+
3
+ const isDirectlyExecuted = (fileUrl) => fileURLToPath(fileUrl) === process.argv[1];
4
+
5
+ export { isDirectlyExecuted };
6
+ //# sourceMappingURL=is-directly-executed.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"is-directly-executed.mjs","sources":["../../src/functions/is-directly-executed.mts"],"sourcesContent":[null],"names":[],"mappings":";;MAEa,kBAAkB,GAAG,CAAC,OAAe,KAChD,aAAa,CAAC,OAAO,CAAC,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;;;;"}
package/dist/index.mjs CHANGED
@@ -5,6 +5,7 @@ export { getDiffFrom, getModifiedFiles, getStagedFiles, getUntrackedFiles } from
5
5
  export { $ } from './functions/exec-async.mjs';
6
6
  export { formatDiffFrom, formatFiles, formatFilesGlob, formatUncommittedFiles } from './functions/format.mjs';
7
7
  export { genIndex } from './functions/gen-index.mjs';
8
+ export { isDirectlyExecuted } from './functions/is-directly-executed.mjs';
8
9
  export { checkShouldRunTypeChecks } from './functions/should-run.mjs';
9
10
  export { executeParallel, executeStages } from './functions/workspace-utils/execute-parallel.mjs';
10
11
  export { getWorkspacePackages } from './functions/workspace-utils/get-workspace-packages.mjs';
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;"}
@@ -2,11 +2,13 @@ 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
4
  import { $ as $_ } from './functions/exec-async.mjs';
5
+ import { isDirectlyExecuted as isDirectlyExecuted_ } from './functions/is-directly-executed.mjs';
5
6
  declare global {
6
7
  const $: typeof $_;
7
8
  const echo: typeof console.log;
8
9
  const path: typeof path_;
9
10
  const fs: typeof fs_;
10
11
  const glob: typeof glob_;
12
+ const isDirectlyExecuted: typeof isDirectlyExecuted_;
11
13
  }
12
14
  //# sourceMappingURL=node-global.d.mts.map
@@ -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;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"}
1
+ {"version":3,"file":"node-global.d.mts","sourceRoot":"","sources":["../src/node-global.mts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,GAAG,MAAM,kBAAkB,CAAC;AACxC,OAAO,KAAK,KAAK,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,4BAA4B,CAAC;AACrD,OAAO,EAAE,kBAAkB,IAAI,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAejG,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;IACzB,MAAM,kBAAkB,EAAE,OAAO,mBAAmB,CAAC;CACtD"}
@@ -2,13 +2,16 @@ import glob_ from 'fast-glob';
2
2
  import * as fs_ from 'node:fs/promises';
3
3
  import * as path_ from 'node:path';
4
4
  import { $ } from './functions/exec-async.mjs';
5
+ import { isDirectlyExecuted } from './functions/is-directly-executed.mjs';
5
6
 
7
+ /* eslint-disable import/no-internal-modules */
6
8
  const globalsDef = {
7
9
  $: $,
8
10
  echo: console.log,
9
11
  path: path_,
10
12
  fs: fs_,
11
13
  glob: glob_,
14
+ isDirectlyExecuted: isDirectlyExecuted,
12
15
  };
13
16
  // eslint-disable-next-line functional/immutable-data
14
17
  Object.assign(globalThis, globalsDef);
@@ -1 +1 @@
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"}
1
+ {"version":3,"file":"node-global.mjs","sources":["../src/node-global.mts"],"sourcesContent":[null],"names":["$_","isDirectlyExecuted_"],"mappings":";;;;;;AAAA;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;AACX,IAAA,kBAAkB,EAAEC,kBAAmB;CAC/B;AAEV;AACA,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE,UAAU,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-repo-utils",
3
- "version": "7.2.0",
3
+ "version": "7.3.1",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "typescript"
@@ -79,15 +79,15 @@
79
79
  "@semantic-release/commit-analyzer": "^13.0.1",
80
80
  "@semantic-release/exec": "^7.1.0",
81
81
  "@semantic-release/git": "^10.0.1",
82
- "@semantic-release/github": "^11.0.5",
82
+ "@semantic-release/github": "^11.0.6",
83
83
  "@semantic-release/npm": "^12.0.2",
84
84
  "@semantic-release/release-notes-generator": "^14.1.0",
85
- "@types/node": "^24.3.0",
85
+ "@types/node": "^24.3.3",
86
86
  "@vitest/coverage-v8": "^3.2.4",
87
87
  "@vitest/ui": "^3.2.4",
88
88
  "conventional-changelog-conventionalcommits": "^9.1.0",
89
89
  "cspell": "^9.2.0",
90
- "dedent": "^1.6.0",
90
+ "dedent": "^1.7.0",
91
91
  "eslint": "^9.35.0",
92
92
  "eslint-import-resolver-typescript": "4.4.4",
93
93
  "eslint-plugin-array-func": "5.0.2",
@@ -96,7 +96,7 @@
96
96
  "eslint-plugin-prefer-arrow-functions": "3.6.2",
97
97
  "eslint-plugin-promise": "7.2.1",
98
98
  "eslint-plugin-security": "3.0.1",
99
- "eslint-plugin-unicorn": "61.0.1",
99
+ "eslint-plugin-unicorn": "61.0.2",
100
100
  "eslint-plugin-vitest": "0.5.4",
101
101
  "markdownlint-cli2": "^0.18.1",
102
102
  "npm-run-all2": "^8.0.4",
@@ -111,7 +111,7 @@
111
111
  "typedoc": "^0.28.12",
112
112
  "typedoc-plugin-markdown": "^4.8.1",
113
113
  "typescript": "^5.9.2",
114
- "typescript-eslint": "^8.42.0",
114
+ "typescript-eslint": "^8.43.0",
115
115
  "vitest": "^3.2.4"
116
116
  },
117
117
  "peerDependencies": {
@@ -5,7 +5,7 @@ import { assertRepoIsClean } from '../functions/index.mjs';
5
5
 
6
6
  const cmdDef = cmd.command({
7
7
  name: 'assert-repo-is-clean-cli',
8
- version: '7.2.0',
8
+ version: '7.3.1',
9
9
  args: {
10
10
  silent: cmd.flag({
11
11
  long: 'silent',
@@ -5,7 +5,7 @@ import { checkShouldRunTypeChecks } from '../functions/index.mjs';
5
5
 
6
6
  const cmdDef = cmd.command({
7
7
  name: 'check-should-run-type-checks-cli',
8
- version: '7.2.0',
8
+ version: '7.3.1',
9
9
  args: {
10
10
  pathsIgnore: cmd.multioption({
11
11
  long: 'paths-ignore',
@@ -6,7 +6,7 @@ import { formatDiffFrom } from '../functions/index.mjs';
6
6
 
7
7
  const cmdDef = cmd.command({
8
8
  name: 'format-diff-from-cli',
9
- version: '7.2.0',
9
+ version: '7.3.1',
10
10
  args: {
11
11
  base: cmd.positional({
12
12
  type: cmd.string,
@@ -6,7 +6,7 @@ import { formatUncommittedFiles } from '../functions/index.mjs';
6
6
 
7
7
  const cmdDef = cmd.command({
8
8
  name: 'format-uncommitted-cli',
9
- version: '7.2.0',
9
+ version: '7.3.1',
10
10
  args: {
11
11
  excludeUntracked: cmd.flag({
12
12
  long: 'exclude-untracked',
@@ -38,7 +38,7 @@ const nonEmptyArray = <T extends cmd.Type<any, any>>(
38
38
 
39
39
  const cmdDef = cmd.command({
40
40
  name: 'gen-index-ts-cli',
41
- version: '7.2.0',
41
+ version: '7.3.1',
42
42
  args: {
43
43
  // required args
44
44
  targetDirectory: cmd.positional({
@@ -5,5 +5,6 @@ export * from './diff.mjs';
5
5
  export * from './exec-async.mjs';
6
6
  export * from './format.mjs';
7
7
  export * from './gen-index.mjs';
8
+ export * from './is-directly-executed.mjs';
8
9
  export * from './should-run.mjs';
9
10
  export * from './workspace-utils/index.mjs';
@@ -0,0 +1,4 @@
1
+ import { fileURLToPath } from 'node:url';
2
+
3
+ export const isDirectlyExecuted = (fileUrl: string): boolean =>
4
+ fileURLToPath(fileUrl) === process.argv[1];
@@ -1,9 +1,9 @@
1
+ /* eslint-disable import/no-internal-modules */
1
2
  import { default as glob_ } from 'fast-glob';
2
3
  import * as fs_ from 'node:fs/promises';
3
4
  import * as path_ from 'node:path';
4
-
5
- // eslint-disable-next-line import/no-internal-modules
6
5
  import { $ as $_ } from './functions/exec-async.mjs';
6
+ import { isDirectlyExecuted as isDirectlyExecuted_ } from './functions/is-directly-executed.mjs';
7
7
 
8
8
  const globalsDef = {
9
9
  $: $_,
@@ -12,6 +12,7 @@ const globalsDef = {
12
12
  path: path_,
13
13
  fs: fs_,
14
14
  glob: glob_,
15
+ isDirectlyExecuted: isDirectlyExecuted_,
15
16
  } as const;
16
17
 
17
18
  // eslint-disable-next-line functional/immutable-data
@@ -24,4 +25,5 @@ declare global {
24
25
  const path: typeof path_;
25
26
  const fs: typeof fs_;
26
27
  const glob: typeof glob_;
28
+ const isDirectlyExecuted: typeof isDirectlyExecuted_;
27
29
  }