ts-repo-utils 1.0.1 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -27,23 +27,20 @@ console.log(exists); // true or false
27
27
 
28
28
  #### `assertPathExists(filePath: string, description?: string): Promise<void>`
29
29
 
30
- Validates that a path exists and throws an error if it doesn't.
30
+ Validates that a path exists and exits with code 1 if it doesn't.
31
31
 
32
32
  ```typescript
33
33
  import { assertPathExists } from 'ts-repo-utils';
34
34
 
35
- try {
36
- await assertPathExists('./src/index.ts', 'Entry point file');
37
- } catch (error) {
38
- console.error('Entry point file does not exist');
39
- }
35
+ // If the file doesn't exist, this will exit the process with code 1
36
+ await assertPathExists('./src/index.ts', 'Entry point file');
40
37
  ```
41
38
 
42
39
  ### File Extension Validation
43
40
 
44
41
  #### `assertExt(config: CheckExtConfig): Promise<void>`
45
42
 
46
- Validates that all files in specified directories have the correct extensions.
43
+ Validates that all files in specified directories have the correct extensions. Exits with code 1 if any files have incorrect extensions.
47
44
 
48
45
  ```typescript
49
46
  import { assertExt } from 'ts-repo-utils';
@@ -269,17 +266,14 @@ await formatFiles('dist/**/*.js');
269
266
  ### Project Validation
270
267
 
271
268
  ```typescript
272
- import { pathExists, assertPathExists, repoIsDirty } from 'ts-repo-utils';
269
+ import { pathExists, assertPathExists, assertRepoIsDirty } from 'ts-repo-utils';
273
270
 
274
- // Check required files exist
271
+ // Check required files exist (exits with code 1 if files don't exist)
275
272
  await assertPathExists('./package.json', 'Package manifest');
276
273
  await assertPathExists('./tsconfig.json', 'TypeScript config');
277
274
 
278
- // Verify clean repository state
279
- const isDirty = await repoIsDirty();
280
- if (isDirty) {
281
- throw new Error('Repository has uncommitted changes');
282
- }
275
+ // Verify clean repository state (exits with code 1 if repo is dirty)
276
+ await assertRepoIsDirty();
283
277
  ```
284
278
 
285
279
  ## License
@@ -15,8 +15,8 @@ export type CheckExtConfig = DeepReadonly<{
15
15
  }>;
16
16
  /**
17
17
  * Validates that all files in specified directories have the correct extensions.
18
+ * Exits with code 1 if any files have incorrect extensions.
18
19
  * @param config - Configuration specifying directories and expected extensions.
19
- * @throws Error with details of all incorrect files found.
20
20
  */
21
21
  export declare const assertExt: (config: CheckExtConfig) => Promise<void>;
22
22
  //# sourceMappingURL=assert-ext.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assert-ext.d.mts","sourceRoot":"","sources":["../../src/functions/assert-ext.mts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAG5B;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC;IACxC,6DAA6D;IAC7D,WAAW,EAAE;QACX,8BAA8B;QAC9B,IAAI,EAAE,MAAM,CAAC;QACb,kDAAkD;QAClD,SAAS,EAAE,MAAM,CAAC;QAClB,sFAAsF;QACtF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;KAC3B,EAAE,CAAC;CACL,CAAC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAU,QAAQ,cAAc,KAAG,OAAO,CAAC,IAAI,CA2DpE,CAAC"}
1
+ {"version":3,"file":"assert-ext.d.mts","sourceRoot":"","sources":["../../src/functions/assert-ext.mts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAG5B;;GAEG;AACH,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC;IACxC,6DAA6D;IAC7D,WAAW,EAAE;QACX,8BAA8B;QAC9B,IAAI,EAAE,MAAM,CAAC;QACb,kDAAkD;QAClD,SAAS,EAAE,MAAM,CAAC;QAClB,sFAAsF;QACtF,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;KAC3B,EAAE,CAAC;CACL,CAAC,CAAC;AAEH;;;;GAIG;AACH,eAAO,MAAM,SAAS,GAAU,QAAQ,cAAc,KAAG,OAAO,CAAC,IAAI,CA4DpE,CAAC"}
@@ -3,8 +3,8 @@ import { assertPathExists } from './assert-path-exists.mjs';
3
3
 
4
4
  /**
5
5
  * Validates that all files in specified directories have the correct extensions.
6
+ * Exits with code 1 if any files have incorrect extensions.
6
7
  * @param config - Configuration specifying directories and expected extensions.
7
- * @throws Error with details of all incorrect files found.
8
8
  */
9
9
  const assertExt = async (config) => {
10
10
  const allIncorrectFiles = [];
@@ -46,7 +46,8 @@ const assertExt = async (config) => {
46
46
  '',
47
47
  generateErrorMessage(),
48
48
  ].join('\n');
49
- throw new Error(errorMessage);
49
+ echo(errorMessage);
50
+ process.exit(1);
50
51
  }
51
52
  echo('✓ All files have correct extensions');
52
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"assert-ext.mjs","sources":["../../src/functions/assert-ext.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAkBA;;;;AAIG;MACU,SAAS,GAAG,OAAO,MAAsB,KAAmB;IACvE,MAAM,iBAAiB,GAAa,EAAE;;IAGtC,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,cAAc,EAAE,KAAI;AACxE,QAAA,IAAI;YACF,OAAO,MAAM,8BAA8B,CACzC,GAAG,EACH,SAAS,EACT,cAAc,CACf;;QACD,OAAO,KAAK,EAAE;AACd,YAAA,OAAO,CAAC,KAAK,CAAC,CAAA,0BAAA,EAA6B,GAAG,CAAA,EAAA,EAAK,MAAM,CAAC,KAAK,CAAC,CAAE,CAAA,CAAC;AACnE,YAAA,OAAO,EAAE;;KAEZ,CAAC,CACH;;AAGD,IAAA,OAAO,CAAC,OAAO,CAAC,CAAC,cAAc,KAAI;AACjC,QAAA,iBAAiB,CAAC,IAAI,CAAC,GAAG,cAAc,CAAC;AAC3C,KAAC,CAAC;AAEF,IAAA,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;QAChC,MAAM,oBAAoB,GAAG,MAAa;;AAExC,YAAA,MAAM,eAAe,GAAG,IAAI,GAAG,E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,EAAO,IAAI,CAAA,CAAE,CAAC;YACjD,EAAE;AACF,YAAA,oBAAoB,EAAE;AACvB,SAAA,CAAC,IAAI,CAAC,IAAI,CAAC;QAEZ,IAAI,CAAC,YAAY,CAAC;AAClB,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;;IAGjB,IAAI,CAAC,qCAAqC,CAAC;AAC7C;AAEA;;;;;;AAMG;AACH,MAAM,8BAA8B,GAAG,OACrC,GAAW,EACX,iBAAyB,EACzB,cAAkC,KACb;AACrB,IAAA,MAAM,gBAAgB,CAAC,GAAG,EAAE,WAAW,CAAC;AAExC,IAAA,MAAM,qBAAqB,GAAG,CAAC,eAAe,EAAE,aAAa,CAAC;AAC9D,IAAA,MAAM,mBAAmB,GAAG,cAAc,IAAI,qBAAqB;;AAGnE,IAAA,MAAM,sBAAsB,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC,OAAO,KAC7D,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,GAAG,OAAO,GAAG,CAAA,EAAG,GAAG,CAAA,CAAA,EAAI,OAAO,CAAA,CAAE,CACzD;IAED,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,CAAG,EAAA,GAAG,OAAO,EAAE;AACtC,QAAA,MAAM,EAAE,sBAAsB;AAC/B,KAAA,CAAC;AAEF,IAAA,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,iBAAiB,CAAC,CAAC;AAClE,CAAC;;;;"}
@@ -1,3 +1,4 @@
1
+ import '../node-global.mjs';
1
2
  /**
2
3
  * Checks if a file or directory exists.
3
4
  * @param filePath - The path to check.
@@ -5,10 +6,9 @@
5
6
  */
6
7
  export declare const pathExists: (filePath: string) => Promise<boolean>;
7
8
  /**
8
- * Validates that a path exists and throws if it doesn't.
9
+ * Validates that a path exists and exits with code 1 if it doesn't.
9
10
  * @param filePath - The path to validate.
10
- * @param description - Description for error message.
11
- * @throws Error if path doesn't exist.
11
+ * @param description - Description for error message (defaults to 'Path').
12
12
  */
13
13
  export declare const assertPathExists: (filePath: string, description?: string) => Promise<void>;
14
14
  //# sourceMappingURL=assert-path-exists.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"assert-path-exists.d.mts","sourceRoot":"","sources":["../../src/functions/assert-path-exists.mts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,UAAU,MAAM,KAAG,OAAO,CAAC,OAAO,CAOlE,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,oBAAoB,KACnB,OAAO,CAAC,IAAI,CAId,CAAC"}
1
+ {"version":3,"file":"assert-path-exists.d.mts","sourceRoot":"","sources":["../../src/functions/assert-path-exists.mts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAE5B;;;;GAIG;AACH,eAAO,MAAM,UAAU,GAAU,UAAU,MAAM,KAAG,OAAO,CAAC,OAAO,CAOlE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAC3B,UAAU,MAAM,EAChB,oBAAoB,KACnB,OAAO,CAAC,IAAI,CAKd,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import * as fs_ from 'node:fs/promises';
2
+ import '../node-global.mjs';
2
3
 
3
4
  /**
4
5
  * Checks if a file or directory exists.
@@ -15,14 +16,14 @@ const pathExists = async (filePath) => {
15
16
  }
16
17
  };
17
18
  /**
18
- * Validates that a path exists and throws if it doesn't.
19
+ * Validates that a path exists and exits with code 1 if it doesn't.
19
20
  * @param filePath - The path to validate.
20
- * @param description - Description for error message.
21
- * @throws Error if path doesn't exist.
21
+ * @param description - Description for error message (defaults to 'Path').
22
22
  */
23
23
  const assertPathExists = async (filePath, description = 'Path') => {
24
24
  if (!(await pathExists(filePath))) {
25
- throw new Error(`${description} does not exist: ${filePath}`);
25
+ echo(`${description} does not exist: ${filePath}`);
26
+ process.exit(1);
26
27
  }
27
28
  };
28
29
 
@@ -1 +1 @@
1
- {"version":3,"file":"assert-path-exists.mjs","sources":["../../src/functions/assert-path-exists.mts"],"sourcesContent":[null],"names":["fs"],"mappings":";;AAEA;;;;AAIG;MACU,UAAU,GAAG,OAAO,QAAgB,KAAsB;AACrE,IAAA,IAAI;AACF,QAAA,MAAMA,GAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;AACzB,QAAA,OAAO,IAAI;;AACX,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;;AAEhB;AAEA;;;;;AAKG;AACI,MAAM,gBAAgB,GAAG,OAC9B,QAAgB,EAChB,WAAW,GAAG,MAAM,KACH;IACjB,IAAI,EAAE,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAE;QACjC,MAAM,IAAI,KAAK,CAAC,CAAA,EAAG,WAAW,CAAoB,iBAAA,EAAA,QAAQ,CAAE,CAAA,CAAC;;AAEjE;;;;"}
1
+ {"version":3,"file":"assert-path-exists.mjs","sources":["../../src/functions/assert-path-exists.mts"],"sourcesContent":[null],"names":["fs"],"mappings":";;;AAGA;;;;AAIG;MACU,UAAU,GAAG,OAAO,QAAgB,KAAsB;AACrE,IAAA,IAAI;AACF,QAAA,MAAMA,GAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;AACzB,QAAA,OAAO,IAAI;;AACX,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;;AAEhB;AAEA;;;;AAIG;AACI,MAAM,gBAAgB,GAAG,OAC9B,QAAgB,EAChB,WAAW,GAAG,MAAM,KACH;IACjB,IAAI,EAAE,MAAM,UAAU,CAAC,QAAQ,CAAC,CAAC,EAAE;AACjC,QAAA,IAAI,CAAC,CAAG,EAAA,WAAW,oBAAoB,QAAQ,CAAA,CAAE,CAAC;AAClD,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;;AAEnB;;;;"}
@@ -7,7 +7,7 @@ import '../node-global.mjs';
7
7
  export declare const repoIsDirty: () => Promise<boolean>;
8
8
  /**
9
9
  * Checks if the repository is dirty and exits with code 1 if it is.
10
- * @throws Error if git command fails.
10
+ * Shows git status and diff output before exiting.
11
11
  */
12
12
  export declare const assertRepoIsDirty: () => Promise<void>;
13
13
  //# sourceMappingURL=assert-repo-is-dirty.d.mts.map
@@ -11,7 +11,7 @@ const repoIsDirty = async () => {
11
11
  };
12
12
  /**
13
13
  * Checks if the repository is dirty and exits with code 1 if it is.
14
- * @throws Error if git command fails.
14
+ * Shows git status and diff output before exiting.
15
15
  */
16
16
  const assertRepoIsDirty = async () => {
17
17
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ts-repo-utils",
3
- "version": "1.0.1",
3
+ "version": "1.1.0",
4
4
  "private": false,
5
5
  "keywords": [
6
6
  "typescript"
@@ -18,8 +18,8 @@ export type CheckExtConfig = DeepReadonly<{
18
18
 
19
19
  /**
20
20
  * Validates that all files in specified directories have the correct extensions.
21
+ * Exits with code 1 if any files have incorrect extensions.
21
22
  * @param config - Configuration specifying directories and expected extensions.
22
- * @throws Error with details of all incorrect files found.
23
23
  */
24
24
  export const assertExt = async (config: CheckExtConfig): Promise<void> => {
25
25
  const allIncorrectFiles: string[] = [];
@@ -76,7 +76,8 @@ export const assertExt = async (config: CheckExtConfig): Promise<void> => {
76
76
  generateErrorMessage(),
77
77
  ].join('\n');
78
78
 
79
- throw new Error(errorMessage);
79
+ echo(errorMessage);
80
+ process.exit(1);
80
81
  }
81
82
 
82
83
  echo('✓ All files have correct extensions');
@@ -1,4 +1,5 @@
1
1
  import * as fs from 'node:fs/promises';
2
+ import '../node-global.mjs';
2
3
 
3
4
  /**
4
5
  * Checks if a file or directory exists.
@@ -15,16 +16,16 @@ export const pathExists = async (filePath: string): Promise<boolean> => {
15
16
  };
16
17
 
17
18
  /**
18
- * Validates that a path exists and throws if it doesn't.
19
+ * Validates that a path exists and exits with code 1 if it doesn't.
19
20
  * @param filePath - The path to validate.
20
- * @param description - Description for error message.
21
- * @throws Error if path doesn't exist.
21
+ * @param description - Description for error message (defaults to 'Path').
22
22
  */
23
23
  export const assertPathExists = async (
24
24
  filePath: string,
25
25
  description = 'Path',
26
26
  ): Promise<void> => {
27
27
  if (!(await pathExists(filePath))) {
28
- throw new Error(`${description} does not exist: ${filePath}`);
28
+ echo(`${description} does not exist: ${filePath}`);
29
+ process.exit(1);
29
30
  }
30
31
  };
@@ -12,7 +12,7 @@ export const repoIsDirty = async (): Promise<boolean> => {
12
12
 
13
13
  /**
14
14
  * Checks if the repository is dirty and exits with code 1 if it is.
15
- * @throws Error if git command fails.
15
+ * Shows git status and diff output before exiting.
16
16
  */
17
17
  export const assertRepoIsDirty = async (): Promise<void> => {
18
18
  try {