ts-repo-utils 7.2.0 → 7.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md 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,46 @@ 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
201
238
 
202
239
  ### Path and File System Utilities
203
240
 
@@ -209,7 +246,7 @@ Checks if a file or directory exists at the specified path.
209
246
  import { pathExists } from 'ts-repo-utils';
210
247
 
211
248
  const exists = await pathExists('./src/index.ts');
212
- console.log(exists); // true or false
249
+ console.log(exists satisfies boolean); // true or false
213
250
  ```
214
251
 
215
252
  #### `assertPathExists(filePath: string, description?: string): Promise<void>`
@@ -223,8 +260,6 @@ import { assertPathExists } from 'ts-repo-utils';
223
260
  await assertPathExists('./src/index.ts', 'Entry point file');
224
261
  ```
225
262
 
226
- ### File Extension Validation
227
-
228
263
  #### `assertExt(config: CheckExtConfig): Promise<void>`
229
264
 
230
265
  Validates that all files in specified directories have the correct extensions. Exits with code 1 if any files have incorrect extensions.
@@ -250,12 +285,12 @@ await assertExt({
250
285
  **Configuration Type:**
251
286
 
252
287
  ```typescript
253
- type CheckExtConfig = DeepReadonly<{
254
- directories: {
288
+ type CheckExtConfig = Readonly<{
289
+ directories: readonly Readonly<{
255
290
  path: string; // Directory path to check
256
291
  extension: string; // Expected file extension (including the dot)
257
- ignorePatterns?: string[]; // Optional glob patterns to ignore
258
- }[];
292
+ ignorePatterns?: readonly string[]; // Optional glob patterns to ignore
293
+ }>[];
259
294
  }>;
260
295
  ```
261
296
 
@@ -276,7 +311,8 @@ if (isDirty) {
276
311
 
277
312
  #### `assertRepoIsClean(): Promise<void>`
278
313
 
279
- Checks if repository is clean and exits with code 1 if it has uncommitted changes (shows changes and diff).
314
+ Checks if the repository is clean and exits with code 1 if it has uncommitted changes (shows changes and diff).
315
+ (Function version of the `assert-repo-is-clean` command)
280
316
 
281
317
  ```typescript
282
318
  import { assertRepoIsClean } from 'ts-repo-utils';
@@ -293,22 +329,22 @@ await assertRepoIsClean();
293
329
 
294
330
  ##### `getUntrackedFiles(options?)`
295
331
 
296
- Get untracked files from the working tree (files not added to git).
332
+ Gets untracked files from the working tree (files not added to git).
297
333
  Runs `git ls-files --others --exclude-standard [--deleted]`
298
334
 
299
335
  ##### `getModifiedFiles(options?)`
300
336
 
301
- Get modified files from the working tree (files that have been changed but not staged).
337
+ Gets modified files from the working tree (files that have been changed but not staged).
302
338
  Runs `git diff --name-only [--diff-filter=d]`
303
339
 
304
340
  ##### `getStagedFiles(options?)`
305
341
 
306
- Get files that are staged for commit (files added with git add).
342
+ Gets files that are staged for commit (files added with git add).
307
343
  Runs `git diff --staged --name-only [--diff-filter=d]`
308
344
 
309
345
  ##### `getDiffFrom(base: string, options?)`
310
346
 
311
- Get files that differ from the specified base branch or commit.
347
+ Gets files that differ from the specified base branch or commit.
312
348
  Runs `git diff --name-only <base> [--diff-filter=d]`
313
349
 
314
350
  **Common options:**
@@ -321,87 +357,7 @@ Runs `git diff --name-only <base> [--diff-filter=d]`
321
357
  ```typescript
322
358
  type Ret = Result<
323
359
  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
- >
360
+ import('node:child_process').ExecException | Readonly<{ message: string }>
405
361
  >;
406
362
  ```
407
363
 
@@ -409,7 +365,7 @@ type Ret = Promise<
409
365
 
410
366
  #### `formatFilesGlob(pathGlob: string, options?): Promise<Result<undefined, unknown>>`
411
367
 
412
- Format files matching a glob pattern using Prettier.
368
+ Formats files matching a glob pattern using Prettier.
413
369
 
414
370
  ```typescript
415
371
  import { formatFilesGlob } from 'ts-repo-utils';
@@ -435,7 +391,8 @@ await formatFilesGlob('src/**/*.ts', {
435
391
 
436
392
  #### `formatUncommittedFiles(options?): Promise<Result>`
437
393
 
438
- Format only files that have been changed according to git status.
394
+ Formats only files that have been changed according to git status.
395
+ (Function version of the `format-uncommitted` command)
439
396
 
440
397
  ```typescript
441
398
  import { formatUncommittedFiles } from 'ts-repo-utils';
@@ -465,14 +422,17 @@ await formatUncommittedFiles({
465
422
  type Ret = Promise<
466
423
  Result<
467
424
  undefined,
468
- ExecException | Readonly<{ message: string }> | readonly unknown[]
425
+ | import('node:child_process').ExecException
426
+ | Readonly<{ message: string }>
427
+ | readonly unknown[]
469
428
  >
470
429
  >;
471
430
  ```
472
431
 
473
432
  #### `formatDiffFrom(base: string, options?): Promise<Result>`
474
433
 
475
- Format only files that differ from the specified base branch or commit.
434
+ Formats only files that differ from the specified base branch or commit.
435
+ (Function version of the `format-diff-from` command)
476
436
 
477
437
  ```typescript
478
438
  import { formatDiffFrom } from 'ts-repo-utils';
@@ -506,26 +466,102 @@ await formatDiffFrom('main', {
506
466
  type Ret = Promise<
507
467
  Result<
508
468
  undefined,
509
- ExecException | Readonly<{ message: string }> | readonly unknown[]
469
+ | import('node:child_process').ExecException
470
+ | Readonly<{ message: string }>
471
+ | readonly unknown[]
510
472
  >
511
473
  >;
512
474
  ```
513
475
 
514
- ### Workspace Management Utilities
476
+ ### Index File Generation
477
+
478
+ #### `genIndex(config: GenIndexConfig): Promise<Result<undefined, unknown>>`
479
+
480
+ Generates index files recursively in target directories with automatic barrel exports.
481
+ (Function version of the `gen-index-ts` command)
482
+
483
+ ```typescript
484
+ import { genIndex } from 'ts-repo-utils';
485
+
486
+ await genIndex({
487
+ targetDirectory: './src',
488
+ exclude: ['*.test.ts', '*.spec.ts'],
489
+ });
490
+ ```
491
+
492
+ **Configuration Type:**
493
+
494
+ ```typescript
495
+ type GenIndexConfig = Readonly<{
496
+ /**
497
+ * Target directories to generate index files for (string or array of
498
+ * strings)
499
+ */
500
+ targetDirectory: string | readonly string[];
501
+
502
+ /**
503
+ * Glob patterns for files or predicate function to exclude from exports
504
+ * (default: excludes `'**\/*.{test,spec}.?(c|m)[jt]s?(x)'` and
505
+ * `'**\/*.d.?(c|m)ts'`)
506
+ */
507
+ exclude?:
508
+ | readonly string[]
509
+ | ((
510
+ args: Readonly<{
511
+ absolutePath: string;
512
+ relativePath: string;
513
+ fileName: string;
514
+ }>,
515
+ ) => boolean);
516
+
517
+ /**
518
+ * File extensions of source files to include in exports (default: ['.ts',
519
+ * '.tsx'])
520
+ */
521
+ targetExtensions?: readonly `.${string}`[];
522
+
523
+ /** File extension of index files to generate (default: '.ts') */
524
+ indexFileExtension?: `.${string}`;
525
+
526
+ /** File extension to use in export statements (default: '.js') */
527
+ exportStatementExtension?: `.${string}` | 'none';
528
+
529
+ /** Command to run for formatting generated files (optional) */
530
+ formatCommand?: string;
531
+
532
+ /** Whether to suppress output during execution (default: false) */
533
+ silent?: boolean;
534
+ }>;
535
+ ```
536
+
537
+ **Features:**
538
+
539
+ - Creates barrel exports for all subdirectories
540
+ - Supports complex glob exclusion patterns (using micromatch)
541
+ - Automatically formats generated files using the project's Prettier config
542
+ - Works with both single directories and directory arrays
543
+ - Respects source and export extension configuration
544
+
545
+ **Benefits:**
546
+
547
+ - Prevents forgetting to export modules
548
+ - TypeScript can detect duplicate variables, type names, etc.
549
+
550
+ ### Monorepo Workspace Management Utilities
515
551
 
516
552
  #### `runCmdInStagesAcrossWorkspaces(options): Promise<void>`
517
553
 
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.
554
+ 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
555
 
520
556
  ```typescript
521
557
  import { runCmdInStagesAcrossWorkspaces } from 'ts-repo-utils';
522
558
 
523
559
  // Run build in dependency order
524
560
  await runCmdInStagesAcrossWorkspaces({
525
- rootPackageJsonDir: '.',
561
+ rootPackageJsonDir: '../',
526
562
  cmd: 'build',
527
563
  concurrency: 3,
528
- filterWorkspacePattern: (name) => !name.includes('deprecated'),
564
+ filterWorkspacePattern: (name) => !name.includes('experimental'),
529
565
  });
530
566
  ```
531
567
 
@@ -538,16 +574,17 @@ await runCmdInStagesAcrossWorkspaces({
538
574
 
539
575
  #### `runCmdInParallelAcrossWorkspaces(options): Promise<void>`
540
576
 
541
- Executes a npm script command across all workspace packages in parallel. Uses fail-fast behavior - stops execution immediately when any package fails.
577
+ Executes an npm script command across all workspace packages in parallel. Uses fail-fast behavior - stops execution immediately when any package fails.
542
578
 
543
579
  ```typescript
544
580
  import { runCmdInParallelAcrossWorkspaces } from 'ts-repo-utils';
545
581
 
546
582
  // Run tests in parallel across all packages
547
583
  await runCmdInParallelAcrossWorkspaces({
548
- rootPackageJsonDir: '.',
584
+ rootPackageJsonDir: '../',
549
585
  cmd: 'test',
550
586
  concurrency: 5,
587
+ filterWorkspacePattern: (name) => !name.includes('experimental'),
551
588
  });
552
589
  ```
553
590
 
@@ -573,17 +610,17 @@ console.log(packages.map((pkg) => pkg.name));
573
610
  **Return Type:**
574
611
 
575
612
  ```typescript
576
- type Package = {
613
+ type Package = Readonly<{
577
614
  name: string;
578
615
  path: string;
579
616
  packageJson: JsonValue;
580
- dependencies: Record<string, string>;
581
- };
617
+ dependencies: Readonly<Record<string, string>>;
618
+ }>;
582
619
  ```
583
620
 
584
621
  #### `executeParallel(packages, scriptName, concurrency?): Promise<readonly Result[]>`
585
622
 
586
- Executes a npm script across multiple packages in parallel with a concurrency limit. Lower-level function used by `runCmdInParallelAcrossWorkspaces`.
623
+ Executes an npm script across multiple packages in parallel with a concurrency limit. Lower-level function used by `runCmdInParallelAcrossWorkspaces`.
587
624
 
588
625
  ```typescript
589
626
  import { executeParallel, getWorkspacePackages } from 'ts-repo-utils';
@@ -594,7 +631,7 @@ await executeParallel(packages, 'lint', 4);
594
631
 
595
632
  #### `executeStages(packages, scriptName, concurrency?): Promise<void>`
596
633
 
597
- Executes a npm script across packages in dependency order stages. Lower-level function used by `runCmdInStagesAcrossWorkspaces`.
634
+ Executes an npm script across packages in dependency order stages. Lower-level function used by `runCmdInStagesAcrossWorkspaces`.
598
635
 
599
636
  ```typescript
600
637
  import { executeStages, getWorkspacePackages } from 'ts-repo-utils';
@@ -611,93 +648,44 @@ await executeStages(packages, 'build', 3);
611
648
  - Fail-fast behavior on errors
612
649
  - Circular dependency detection
613
650
 
614
- ### Index File Generation
651
+ ### Globals
615
652
 
616
- #### `genIndex(config: GenIndexConfig): Promise<Result<undefined, unknown>>`
617
-
618
- Generates index files recursively in target directories with automatic barrel exports.
653
+ 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
654
 
620
655
  ```typescript
621
- import { genIndex } from 'ts-repo-utils';
656
+ import 'ts-repo-utils';
622
657
 
623
- await genIndex({
624
- targetDirectory: './src',
625
- exclude: ['*.test.ts', '*.spec.ts'],
626
- });
627
- ```
658
+ // Now these functions are globally available
628
659
 
629
- **Configuration Type:**
660
+ await $('npm test');
630
661
 
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[];
662
+ echo('Building project...');
638
663
 
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);
653
-
654
- /** File extensions of source files to export (default: ['.ts', '.tsx']) */
655
- targetExtensions?: readonly `.${string}`[];
664
+ const filePath: string = path.join('src', 'index.ts');
656
665
 
657
- /** File extension of index files to generate (default: '.ts') */
658
- indexFileExtension?: `.${string}`;
659
-
660
- /** File extension to use in export statements (default: '.js') */
661
- exportStatementExtension?: `.${string}` | 'none';
662
-
663
- /** Command to run for formatting generated files (optional) */
664
- formatCommand?: string;
666
+ const configJson: string = await fs.readFile('./config.json', {
667
+ encoding: 'utf8',
668
+ });
665
669
 
666
- /** Whether to suppress output during execution (default: false) */
667
- silent?: boolean;
668
- }>;
670
+ const files: readonly string[] = await glob('**/*.ts');
669
671
  ```
670
672
 
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
673
+ - `$` - The command execution utility described above.
674
+ - `echo` - Equivalent to `console.log`
675
+ - `path` - `node:path`
676
+ - `fs` - `node:fs/promises`
677
+ - `glob` - `fast-glob`
694
678
 
695
679
  ## Common Patterns
696
680
 
697
681
  ### Pre-commit Hook
698
682
 
699
683
  ```typescript
700
- import { formatUntracked, assertExt, assertRepoIsClean } from 'ts-repo-utils';
684
+ import {
685
+ assertExt,
686
+ assertRepoIsClean,
687
+ formatUncommittedFiles,
688
+ } from 'ts-repo-utils';
701
689
 
702
690
  // Validate file extensions
703
691
  await assertExt({
@@ -714,15 +702,7 @@ await assertRepoIsClean();
714
702
  ### Build Pipeline
715
703
 
716
704
  ```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
- });
705
+ import { formatFilesGlob, genIndex } from 'ts-repo-utils';
726
706
 
727
707
  // Generate barrel exports
728
708
  await genIndex({ targetDirectory: './src' });
@@ -740,12 +720,20 @@ await formatFilesGlob('dist/**/*.js');
740
720
  ### Project Validation
741
721
 
742
722
  ```typescript
743
- import { pathExists, assertPathExists, assertRepoIsClean } from 'ts-repo-utils';
723
+ import { assertExt, assertPathExists, assertRepoIsClean } from 'ts-repo-utils';
744
724
 
745
725
  // Check required files exist (exits with code 1 if files don't exist)
746
726
  await assertPathExists('./package.json', 'Package manifest');
747
727
  await assertPathExists('./tsconfig.json', 'TypeScript config');
748
728
 
729
+ // Validate extensions
730
+ await assertExt({
731
+ directories: [
732
+ { path: './src', extension: '.ts' },
733
+ { path: './scripts', extension: '.mjs' },
734
+ ],
735
+ });
736
+
749
737
  // Verify clean repository state (exits with code 1 if repo is dirty)
750
738
  await assertRepoIsClean();
751
739
  ```
@@ -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.0',
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.0',
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.0',
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;SACt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CAAC;AACF,CAAA,CAAC;AAEF,MAAM,IAAI,GAAG,OACX,IAOE,KACe;IACjB,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,IAAI,CAAC,IAAI,EAAE;AAC7C,QAAA,gBAAgB,EAAE,CAAC,IAAI,CAAC,gBAAgB;AACxC,QAAA,eAAe,EAAE,CAAC,IAAI,CAAC,eAAe;AACtC,QAAA,aAAa,EAAE,CAAC,IAAI,CAAC,aAAa;QAClC,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,MAAM,EAAE,IAAI,CAAC,MAAM;AACpB,KAAA,CAAC;AAEF,IAAA,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACxB,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,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.0',
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,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ACjB,QAAA,CAAC,CAAC;IACJ,CAAC;AACF,CAAA,CAAC;AAEF,MAAM,IAAI,GAAG,OACX,IAME,KACe;AACjB,IAAA,MAAM,MAAM,GAAG,MAAM,sBAAsB,CAAC;AAC1C,QAAA,SAAS,EAAE,CAAC,IAAI,CAAC,gBAAgB;AACjC,QAAA,QAAQ,EAAE,CAAC,IAAI,CAAC,eAAe;AAC/B,QAAA,MAAM,EAAE,CAAC,IAAI,CAAC,aAAa;QAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;QACjC,MAAM,EAAE,IAAI,CAAC,MAAM;AACpB,KAAA,CAAC;AACF,IAAA,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACxB,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.0',
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,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Q,CAAC;AACb,QAAA,eAAe,EAAE,eAAe,CAAC,QAAQ,CAAC,GAAG;AAC3C,cAAE,eAAe,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,GAAG,CAAC,IAAI,EAAE;AACpD,cAAE,eAAe;QACnB,wBAAwB;QACxB,gBAAgB;QAChB,OAAO;QACP,kBAAkB;QAClB,aAAa;QACb,MAAM;AACP,KAAA,CAAC;AACJ,CAAC;AAED,MAAM,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC"}
@@ -5,6 +5,7 @@ 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';
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":";;;;;;;;;;;;;"}
@@ -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;AAgBrD,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;CAE1B"}
@@ -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.0",
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.0',
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.0',
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.0',
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.0',
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.0',
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
  }