ts-repo-utils 5.0.2 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/functions/assert-ext.d.mts +12 -7
- package/dist/functions/assert-ext.d.mts.map +1 -1
- package/dist/functions/assert-ext.mjs +17 -12
- package/dist/functions/assert-ext.mjs.map +1 -1
- package/dist/functions/assert-path-exists.d.mts +2 -0
- package/dist/functions/assert-path-exists.d.mts.map +1 -1
- package/dist/functions/assert-path-exists.mjs +2 -0
- package/dist/functions/assert-path-exists.mjs.map +1 -1
- package/dist/functions/assert-repo-is-clean.d.mts +3 -2
- package/dist/functions/assert-repo-is-clean.d.mts.map +1 -1
- package/dist/functions/assert-repo-is-clean.mjs +4 -2
- package/dist/functions/assert-repo-is-clean.mjs.map +1 -1
- package/dist/functions/diff.d.mts +2 -6
- package/dist/functions/diff.d.mts.map +1 -1
- package/dist/functions/diff.mjs +2 -6
- package/dist/functions/diff.mjs.map +1 -1
- package/dist/functions/exec-async.d.mts +1 -0
- package/dist/functions/exec-async.d.mts.map +1 -1
- package/dist/functions/exec-async.mjs +2 -0
- package/dist/functions/exec-async.mjs.map +1 -1
- package/dist/functions/format.d.mts +10 -3
- package/dist/functions/format.d.mts.map +1 -1
- package/dist/functions/format.mjs +10 -3
- package/dist/functions/format.mjs.map +1 -1
- package/dist/functions/gen-index.d.mts +19 -6
- package/dist/functions/gen-index.d.mts.map +1 -1
- package/dist/functions/gen-index.mjs +63 -42
- package/dist/functions/gen-index.mjs.map +1 -1
- package/dist/functions/should-run.d.mts +8 -5
- package/dist/functions/should-run.d.mts.map +1 -1
- package/dist/functions/should-run.mjs +8 -5
- package/dist/functions/should-run.mjs.map +1 -1
- package/dist/functions/workspace-utils/execute-parallel.d.mts +11 -6
- package/dist/functions/workspace-utils/execute-parallel.d.mts.map +1 -1
- package/dist/functions/workspace-utils/execute-parallel.mjs +50 -38
- package/dist/functions/workspace-utils/execute-parallel.mjs.map +1 -1
- package/dist/functions/workspace-utils/get-workspace-packages.d.mts +7 -4
- package/dist/functions/workspace-utils/get-workspace-packages.d.mts.map +1 -1
- package/dist/functions/workspace-utils/get-workspace-packages.mjs +7 -4
- package/dist/functions/workspace-utils/get-workspace-packages.mjs.map +1 -1
- package/dist/functions/workspace-utils/run-cmd-in-parallel.d.mts +7 -3
- package/dist/functions/workspace-utils/run-cmd-in-parallel.d.mts.map +1 -1
- package/dist/functions/workspace-utils/run-cmd-in-parallel.mjs +9 -5
- package/dist/functions/workspace-utils/run-cmd-in-parallel.mjs.map +1 -1
- package/dist/functions/workspace-utils/run-cmd-in-stages.d.mts +10 -6
- package/dist/functions/workspace-utils/run-cmd-in-stages.d.mts.map +1 -1
- package/dist/functions/workspace-utils/run-cmd-in-stages.mjs +12 -8
- package/dist/functions/workspace-utils/run-cmd-in-stages.mjs.map +1 -1
- package/dist/globals.d.mts +1 -0
- package/dist/node-global.d.mts.map +1 -1
- package/dist/node-global.mjs +1 -0
- package/dist/node-global.mjs.map +1 -1
- package/package.json +19 -8
- package/src/functions/assert-ext.mts +38 -19
- package/src/functions/assert-path-exists.mts +2 -0
- package/src/functions/assert-repo-is-clean.mts +4 -2
- package/src/functions/diff.mts +2 -6
- package/src/functions/diff.test.mts +31 -24
- package/src/functions/exec-async.mts +2 -0
- package/src/functions/format.mts +10 -3
- package/src/functions/format.test.mts +8 -4
- package/src/functions/gen-index.mts +146 -62
- package/src/functions/should-run.mts +8 -5
- package/src/functions/workspace-utils/execute-parallel.mts +52 -39
- package/src/functions/workspace-utils/get-workspace-packages.mts +7 -4
- package/src/functions/workspace-utils/run-cmd-in-parallel.mts +9 -5
- package/src/functions/workspace-utils/run-cmd-in-stages.mts +12 -8
- package/src/globals.d.mts +1 -0
- package/src/node-global.mts +3 -0
- package/src/functions/gen-index.test.mts +0 -18
|
@@ -1,21 +1,26 @@
|
|
|
1
1
|
import '../node-global.mjs';
|
|
2
|
-
/**
|
|
3
|
-
* Configuration for directory extension checking.
|
|
4
|
-
*/
|
|
2
|
+
/** Configuration for directory extension checking. */
|
|
5
3
|
export type CheckExtConfig = DeepReadonly<{
|
|
6
4
|
/** Array of directory paths and their expected extensions */
|
|
7
5
|
directories: {
|
|
8
6
|
/** Directory path to check */
|
|
9
7
|
path: string;
|
|
10
|
-
/**
|
|
8
|
+
/**
|
|
9
|
+
* Expected file extension(s) (including the dot). Can be a single extension
|
|
10
|
+
* or an array of valid extensions
|
|
11
|
+
*/
|
|
11
12
|
extension: `.${string}` | `.${string}`[];
|
|
12
|
-
/**
|
|
13
|
+
/**
|
|
14
|
+
* Optional glob patterns to ignore (defaults to ['tsconfig.json',
|
|
15
|
+
* 'globals.d.*'])
|
|
16
|
+
*/
|
|
13
17
|
ignorePatterns?: string[];
|
|
14
18
|
}[];
|
|
15
19
|
}>;
|
|
16
20
|
/**
|
|
17
|
-
* Validates that all files in specified directories have the correct
|
|
18
|
-
* Exits with code 1 if any files have incorrect extensions.
|
|
21
|
+
* Validates that all files in specified directories have the correct
|
|
22
|
+
* extensions. Exits with code 1 if any files have incorrect extensions.
|
|
23
|
+
*
|
|
19
24
|
* @param config - Configuration specifying directories and expected extensions.
|
|
20
25
|
*/
|
|
21
26
|
export declare const assertExt: (config: CheckExtConfig) => Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert-ext.d.mts","sourceRoot":"","sources":["../../src/functions/assert-ext.mts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAG5B
|
|
1
|
+
{"version":3,"file":"assert-ext.d.mts","sourceRoot":"","sources":["../../src/functions/assert-ext.mts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAG5B,sDAAsD;AACtD,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC;IACxC,6DAA6D;IAC7D,WAAW,EAAE;QACX,8BAA8B;QAC9B,IAAI,EAAE,MAAM,CAAC;QAEb;;;WAGG;QACH,SAAS,EAAE,IAAI,MAAM,EAAE,GAAG,IAAI,MAAM,EAAE,EAAE,CAAC;QAEzC;;;WAGG;QACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;KAC3B,EAAE,CAAC;CACL,CAAC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAU,QAAQ,cAAc,KAAG,OAAO,CAAC,IAAI,CAuEpE,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { isString } from 'ts-data-forge';
|
|
1
|
+
import { isString, Arr } from 'ts-data-forge';
|
|
2
2
|
import '../node-global.mjs';
|
|
3
3
|
import { assertPathExists } from './assert-path-exists.mjs';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
* Validates that all files in specified directories have the correct
|
|
7
|
-
* Exits with code 1 if any files have incorrect extensions.
|
|
6
|
+
* Validates that all files in specified directories have the correct
|
|
7
|
+
* extensions. Exits with code 1 if any files have incorrect extensions.
|
|
8
|
+
*
|
|
8
9
|
* @param config - Configuration specifying directories and expected extensions.
|
|
9
10
|
*/
|
|
10
11
|
const assertExt = async (config) => {
|
|
@@ -23,18 +24,21 @@ const assertExt = async (config) => {
|
|
|
23
24
|
if (allIncorrectFiles.length > 0) {
|
|
24
25
|
const generateErrorMessage = () => {
|
|
25
26
|
// Group directories by extension for a cleaner message
|
|
26
|
-
const extensionGroups =
|
|
27
|
-
for (const { path: dirPath, extension } of config.directories) {
|
|
27
|
+
const extensionGroups = Arr.groupBy(config.directories.map(({ path: dirPath, extension }) => {
|
|
28
28
|
const relativePath = path.relative(process.cwd(), dirPath);
|
|
29
|
-
const extKey = isString(extension)
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
29
|
+
const extKey = isString(extension)
|
|
30
|
+
? extension
|
|
31
|
+
: extension.join(' or ');
|
|
32
|
+
return {
|
|
33
|
+
relativePath,
|
|
34
|
+
extKey,
|
|
35
|
+
};
|
|
36
|
+
}), ({ extKey }) => extKey);
|
|
35
37
|
// Generate message parts for each extension
|
|
36
38
|
const messageParts = Array.from(extensionGroups.entries(), ([ext, dirs]) => {
|
|
37
|
-
const dirList = dirs.length === 1
|
|
39
|
+
const dirList = dirs.length === 1
|
|
40
|
+
? dirs[0]?.relativePath
|
|
41
|
+
: dirs.map((d) => d.relativePath).join(', ');
|
|
38
42
|
return `${dirList} should have ${ext} extension`;
|
|
39
43
|
});
|
|
40
44
|
return `All files in ${messageParts.join(' and ')}.`;
|
|
@@ -52,6 +56,7 @@ const assertExt = async (config) => {
|
|
|
52
56
|
};
|
|
53
57
|
/**
|
|
54
58
|
* Checks if all files in a directory have the expected extension.
|
|
59
|
+
*
|
|
55
60
|
* @param dir - The directory to check.
|
|
56
61
|
* @param expectedExtensions - The expected file extensions.
|
|
57
62
|
* @param ignorePatterns - Optional glob patterns to ignore.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert-ext.mjs","sources":["../../src/functions/assert-ext.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"assert-ext.mjs","sources":["../../src/functions/assert-ext.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;AAyBA;;;;;AAKG;MACU,SAAS,GAAG,OAAO,MAAsB,KAAmB;;IAEvE,MAAM,OAAO,GAAG,MAAM,OAAO,CAAC,GAAG,CAC/B,MAAM,CAAC,WAAW,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,EAAE,GAAG,EAAE,SAAS,EAAE,cAAc,EAAE,KAAI;AACxE,QAAA,IAAI;YACF,OAAO,MAAM,8BAA8B,CACzC,GAAG,EACH,QAAQ,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,GAAG,SAAS,EAC7C,cAAc,CACf;QACH;QAAE,OAAO,KAAK,EAAE;AACd,YAAA,OAAO,CAAC,KAAK,CAAC,CAAA,0BAAA,EAA6B,GAAG,CAAA,EAAA,EAAK,MAAM,CAAC,KAAK,CAAC,CAAA,CAAE,CAAC;AACnE,YAAA,OAAO,EAAE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G,CAAC,CAAC,IAAI,KAAK,CAAA,IAAA,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;IACjB;IAEA,IAAI,CAAC,qCAAqC,CAAC;AAC7C;AAEA;;;;;;;AAOG;AACH,MAAM,8BAA8B,GAAG,OACrC,GAAW,EACX,kBAAqC,EACrC,cAAkC,KACJ;AAC9B,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,CAAA,EAAG,GAAG,OAAO,EAAE;AACtC,QAAA,MAAM,EAAE,sBAAsB;AAC/B,KAAA,CAAC;;IAGF,OAAO,KAAK,CAAC,MAAM,CACjB,CAAC,IAAI,KAAK,CAAC,kBAAkB,CAAC,IAAI,CAAC,CAAC,GAAG,KAAK,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAChE;AACH,CAAC;;;;"}
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import '../node-global.mjs';
|
|
2
2
|
/**
|
|
3
3
|
* Checks if a file or directory exists.
|
|
4
|
+
*
|
|
4
5
|
* @param filePath - The path to check.
|
|
5
6
|
* @returns True if the path exists.
|
|
6
7
|
*/
|
|
7
8
|
export declare const pathExists: (filePath: string) => Promise<boolean>;
|
|
8
9
|
/**
|
|
9
10
|
* Validates that a path exists and exits with code 1 if it doesn't.
|
|
11
|
+
*
|
|
10
12
|
* @param filePath - The path to validate.
|
|
11
13
|
* @param description - Description for error message (defaults to 'Path').
|
|
12
14
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert-path-exists.d.mts","sourceRoot":"","sources":["../../src/functions/assert-path-exists.mts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAE5B
|
|
1
|
+
{"version":3,"file":"assert-path-exists.d.mts","sourceRoot":"","sources":["../../src/functions/assert-path-exists.mts"],"names":[],"mappings":"AAAA,OAAO,oBAAoB,CAAC;AAE5B;;;;;GAKG;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,CAKd,CAAC"}
|
|
@@ -2,6 +2,7 @@ import '../node-global.mjs';
|
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Checks if a file or directory exists.
|
|
5
|
+
*
|
|
5
6
|
* @param filePath - The path to check.
|
|
6
7
|
* @returns True if the path exists.
|
|
7
8
|
*/
|
|
@@ -16,6 +17,7 @@ const pathExists = async (filePath) => {
|
|
|
16
17
|
};
|
|
17
18
|
/**
|
|
18
19
|
* Validates that a path exists and exits with code 1 if it doesn't.
|
|
20
|
+
*
|
|
19
21
|
* @param filePath - The path to validate.
|
|
20
22
|
* @param description - Description for error message (defaults to 'Path').
|
|
21
23
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert-path-exists.mjs","sources":["../../src/functions/assert-path-exists.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA
|
|
1
|
+
{"version":3,"file":"assert-path-exists.mjs","sources":["../../src/functions/assert-path-exists.mts"],"sourcesContent":[null],"names":[],"mappings":";;AAEA;;;;;AAKG;MACU,UAAU,GAAG,OAAO,QAAgB,KAAsB;AACrE,IAAA,IAAI;AACF,QAAA,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC;AACzB,QAAA,OAAO,IAAI;IACb;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,KAAK;IACd;AACF;AAEA;;;;;AAKG;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,CAAA,EAAG,WAAW,oBAAoB,QAAQ,CAAA,CAAE,CAAC;AAClD,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjB;AACF;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '../node-global.mjs';
|
|
2
2
|
/**
|
|
3
3
|
* Checks if the repository has uncommitted changes.
|
|
4
|
+
*
|
|
4
5
|
* @returns True if the repo is dirty, false otherwise.
|
|
5
6
|
* @throws Error if git command fails.
|
|
6
7
|
*/
|
|
@@ -8,8 +9,8 @@ export declare const repoIsDirty: (options?: Readonly<{
|
|
|
8
9
|
silent?: boolean;
|
|
9
10
|
}>) => Promise<boolean>;
|
|
10
11
|
/**
|
|
11
|
-
* Checks if the repository is clean and exits with code 1 if it is dirty.
|
|
12
|
-
*
|
|
12
|
+
* Checks if the repository is clean and exits with code 1 if it is dirty. Shows
|
|
13
|
+
* git status and diff output before exiting.
|
|
13
14
|
*/
|
|
14
15
|
export declare const assertRepoIsClean: (options?: Readonly<{
|
|
15
16
|
silent?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert-repo-is-clean.d.mts","sourceRoot":"","sources":["../../src/functions/assert-repo-is-clean.mts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAE5B
|
|
1
|
+
{"version":3,"file":"assert-repo-is-clean.d.mts","sourceRoot":"","sources":["../../src/functions/assert-repo-is-clean.mts"],"names":[],"mappings":"AACA,OAAO,oBAAoB,CAAC;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,QAAQ,CAAC;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,KACvC,OAAO,CAAC,OAAO,CAGjB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,iBAAiB,GAC5B,UAAU,QAAQ,CAAC;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,KACvC,OAAO,CAAC,IAAI,CAiCd,CAAC"}
|
|
@@ -3,6 +3,7 @@ import '../node-global.mjs';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Checks if the repository has uncommitted changes.
|
|
6
|
+
*
|
|
6
7
|
* @returns True if the repo is dirty, false otherwise.
|
|
7
8
|
* @throws Error if git command fails.
|
|
8
9
|
*/
|
|
@@ -11,8 +12,8 @@ const repoIsDirty = async (options) => {
|
|
|
11
12
|
return status.isDirty;
|
|
12
13
|
};
|
|
13
14
|
/**
|
|
14
|
-
* Checks if the repository is clean and exits with code 1 if it is dirty.
|
|
15
|
-
*
|
|
15
|
+
* Checks if the repository is clean and exits with code 1 if it is dirty. Shows
|
|
16
|
+
* git status and diff output before exiting.
|
|
16
17
|
*/
|
|
17
18
|
const assertRepoIsClean = async (options) => {
|
|
18
19
|
try {
|
|
@@ -46,6 +47,7 @@ const assertRepoIsClean = async (options) => {
|
|
|
46
47
|
};
|
|
47
48
|
/**
|
|
48
49
|
* Gets the git status of the repository.
|
|
50
|
+
*
|
|
49
51
|
* @returns An object containing status information.
|
|
50
52
|
*/
|
|
51
53
|
const getGitStatus = async (options) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assert-repo-is-clean.mjs","sources":["../../src/functions/assert-repo-is-clean.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAGA
|
|
1
|
+
{"version":3,"file":"assert-repo-is-clean.mjs","sources":["../../src/functions/assert-repo-is-clean.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAGA;;;;;AAKG;MACU,WAAW,GAAG,OACzB,OAAwC,KACpB;AACpB,IAAA,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,CAAC;IACvE,OAAO,MAAM,CAAC,OAAO;AACvB;AAEA;;;AAGG;MACU,iBAAiB,GAAG,OAC/B,OAAwC,KACvB;AACjB,IAAA,IAAI;AACF,QAAA,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,CAAC;AAEvE,QAAA,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE;YACnB,IAAI,CAAC,iBAAiB,CAAC;YACvB;QACF;QAEA,IAAI,CAAC,iBAAiB,CAAC;QACvB,IAAI,CAAC,kBAAkB,CAAC;AACxB,QAAA,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC;;AAGnB,QAAA,MAAM,SAAS,GAAG,MAAM,CAAC,CAAC,cAAc,EAAE;AACxC,YAAA,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK;AACjC,SAAA,CAAC;AACF,QAAA,IAAI,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE;YAC3B,IAAI,CAAC,mDAAmD,CAAC;QAC3D;AAEA,QAAA,MAAM,UAAU,GAAG,MAAM,CAAC,CAAC,UAAU,EAAE;AACrC,YAAA,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK;AACjC,SAAA,CAAC;AACF,QAAA,IAAI,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,EAAE;YAC5B,IAAI,CAAC,gCAAgC,CAAC;QACxC;AAEA,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjB;IAAE,OAAO,KAAK,EAAE;QACd,IAAI,CAAC,qCAAqC,MAAM,CAAC,KAAK,CAAC,CAAA,EAAA,CAAI,CAAC;AAC5D,QAAA,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjB;AACF;AAEA;;;;AAIG;AACH,MAAM,YAAY,GAAG,OACnB,OAAwC,KAIrC;AACH,IAAA,MAAM,GAAG,GAAG,MAAM,CAAC,CAAC,wBAAwB,EAAE;AAC5C,QAAA,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK;AACjC,KAAA,CAAC;AAEF,IAAA,IAAI,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,CAAA,0BAAA,EAA6B,GAAG,CAAC,KAAK,CAAC,OAAO,CAAA,CAAE,CAAC;IACnE;AAEA,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,GAAG,CAAC,KAAK;IAE5B,OAAO;AACL,QAAA,OAAO,EAAE,MAAM,CAAC,IAAI,EAAE,KAAK,EAAE;QAC7B,MAAM;KACP;AACH,CAAC;;;;"}
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { type ExecException } from 'node:child_process';
|
|
2
2
|
import { Result } from 'ts-data-forge';
|
|
3
3
|
import '../node-global.mjs';
|
|
4
|
-
/**
|
|
5
|
-
* Get files that have been changed (git status).
|
|
6
|
-
*/
|
|
4
|
+
/** Get files that have been changed (git status). */
|
|
7
5
|
export declare const getUntrackedFiles: (options?: Readonly<{
|
|
8
6
|
/** @default true */
|
|
9
7
|
excludeDeleted?: boolean;
|
|
@@ -12,9 +10,7 @@ export declare const getUntrackedFiles: (options?: Readonly<{
|
|
|
12
10
|
}>) => Promise<Result<readonly string[], ExecException | Readonly<{
|
|
13
11
|
message: string;
|
|
14
12
|
}>>>;
|
|
15
|
-
/**
|
|
16
|
-
* Get files that differ from the specified base branch or commit
|
|
17
|
-
*/
|
|
13
|
+
/** Get files that differ from the specified base branch or commit */
|
|
18
14
|
export declare const getDiffFrom: (base: string, options?: Readonly<{
|
|
19
15
|
/** @default true */
|
|
20
16
|
excludeDeleted?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.d.mts","sourceRoot":"","sources":["../../src/functions/diff.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,oBAAoB,CAAC;AAE5B
|
|
1
|
+
{"version":3,"file":"diff.d.mts","sourceRoot":"","sources":["../../src/functions/diff.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACvC,OAAO,oBAAoB,CAAC;AAE5B,qDAAqD;AACrD,eAAO,MAAM,iBAAiB,GAC5B,UAAU,QAAQ,CAAC;IACjB,oBAAoB;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qBAAqB;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC,KACD,OAAO,CACR,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,aAAa,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CA2BzE,CAAC;AAEF,qEAAqE;AACrE,eAAO,MAAM,WAAW,GACtB,MAAM,MAAM,EACZ,UAAU,QAAQ,CAAC;IACjB,oBAAoB;IACpB,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,qBAAqB;IACrB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC,KACD,OAAO,CACR,MAAM,CAAC,SAAS,MAAM,EAAE,EAAE,aAAa,GAAG,QAAQ,CAAC;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC,CA2BzE,CAAC"}
|
package/dist/functions/diff.mjs
CHANGED
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { Result } from 'ts-data-forge';
|
|
2
2
|
import '../node-global.mjs';
|
|
3
3
|
|
|
4
|
-
/**
|
|
5
|
-
* Get files that have been changed (git status).
|
|
6
|
-
*/
|
|
4
|
+
/** Get files that have been changed (git status). */
|
|
7
5
|
const getUntrackedFiles = async (options) => {
|
|
8
6
|
// Get changed files from git status
|
|
9
7
|
const result = await $([
|
|
@@ -24,9 +22,7 @@ const getUntrackedFiles = async (options) => {
|
|
|
24
22
|
.filter((s) => s !== '');
|
|
25
23
|
return Result.ok(files);
|
|
26
24
|
};
|
|
27
|
-
/**
|
|
28
|
-
* Get files that differ from the specified base branch or commit
|
|
29
|
-
*/
|
|
25
|
+
/** Get files that differ from the specified base branch or commit */
|
|
30
26
|
const getDiffFrom = async (base, options) => {
|
|
31
27
|
// Get files that differ from base branch/commit (excluding deleted files)
|
|
32
28
|
const result = await $([
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"diff.mjs","sources":["../../src/functions/diff.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA
|
|
1
|
+
{"version":3,"file":"diff.mjs","sources":["../../src/functions/diff.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAIA;MACa,iBAAiB,GAAG,OAC/B,OAKE,KAGA;;AAEF,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,CACpB;QACE,CAAA,wCAAA,CAA0C;;AAE1C,QAAA,CAAC,OAAO,EAAE,cAAc,IAAI,IAAI,IAAI,EAAE,GAAG,WAAW;AACrD;SACE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE;AACtB,SAAA,IAAI,CAAC,GAAG,CAAC,EACZ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,CACrC;AAED,IAAA,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACxB,QAAA,OAAO,MAAM;IACf;AAEA,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK;;IAG/B,MAAM,KAAK,GAAG;SACX,KAAK,CAAC,IAAI;SACV,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE;SACnB,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;AAE1B,IAAA,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;AACzB;AAEA;AACO,MAAM,WAAW,GAAG,OACzB,IAAY,EACZ,OAKE,KAGA;;AAEF,IAAA,MAAM,MAAM,GAAG,MAAM,CAAC,CACpB;QACE,CAAA,oBAAA,CAAsB;QACtB,IAAI;AACJ,QAAA,CAAC,OAAO,EAAE,cAAc,IAAI,IAAI,IAAI,iBAAiB,GAAG,EAAE;AAC3D;SACE,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,EAAE;AACtB,SAAA,IAAI,CAAC,GAAG,CAAC,EACZ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,IAAI,KAAK,EAAE,CACrC;AAED,IAAA,IAAI,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,EAAE;AACxB,QAAA,OAAO,MAAM;IACf;AAEA,IAAA,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,CAAC,KAAK;;IAG/B,MAAM,KAAK,GAAG;SACX,KAAK,CAAC,IAAI;SACV,GAAG,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,EAAE;SACzB,MAAM,CAAC,CAAC,IAAI,KAAK,IAAI,KAAK,EAAE,CAAC;AAEhC,IAAA,OAAO,MAAM,CAAC,EAAE,CAAC,KAAK,CAAC;AACzB;;;;"}
|
|
@@ -2,6 +2,7 @@ import { type ExecException } from 'node:child_process';
|
|
|
2
2
|
import { Result } from 'ts-data-forge';
|
|
3
3
|
/**
|
|
4
4
|
* Executes a shell command asynchronously.
|
|
5
|
+
*
|
|
5
6
|
* @param cmd - The command to execute.
|
|
6
7
|
* @param options - Optional configuration for command execution.
|
|
7
8
|
* @returns A promise that resolves with the command result.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec-async.d.mts","sourceRoot":"","sources":["../../src/functions/exec-async.mts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC
|
|
1
|
+
{"version":3,"file":"exec-async.d.mts","sourceRoot":"","sources":["../../src/functions/exec-async.mts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC9D,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC;;;;;;GAMG;AACH,eAAO,MAAM,CAAC,GACZ,KAAK,MAAM,EACX,UAAS,QAAQ,CAAC;IAAE,MAAM,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAM,KAC7D,OAAO,CACR,MAAM,CAAC,QAAQ,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,aAAa,CAAC,CA6BpE,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { Result } from 'ts-data-forge';
|
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
5
|
* Executes a shell command asynchronously.
|
|
6
|
+
*
|
|
6
7
|
* @param cmd - The command to execute.
|
|
7
8
|
* @param options - Optional configuration for command execution.
|
|
8
9
|
* @returns A promise that resolves with the command result.
|
|
@@ -14,6 +15,7 @@ const $ = (cmd, options = {}) => {
|
|
|
14
15
|
}
|
|
15
16
|
return new Promise((resolve) => {
|
|
16
17
|
const execOptions = { timeout };
|
|
18
|
+
// eslint-disable-next-line security/detect-child-process
|
|
17
19
|
exec(cmd, execOptions, (error, stdout, stderr) => {
|
|
18
20
|
if (!silent) {
|
|
19
21
|
if (stdout !== '') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exec-async.mjs","sources":["../../src/functions/exec-async.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAGA
|
|
1
|
+
{"version":3,"file":"exec-async.mjs","sources":["../../src/functions/exec-async.mts"],"sourcesContent":[null],"names":[],"mappings":";;;AAGA;;;;;;AAMG;AACI,MAAM,CAAC,GAAG,CACf,GAAW,EACX,OAAA,GAA4D,EAAE,KAG5D;IACF,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,OAAO,GAAG,KAAK,EAAE,GAAG,OAAO;IAEnD,IAAI,CAAC,MAAM,EAAE;AACX,QAAA,IAAI,CAAC,CAAA,EAAA,EAAK,GAAG,CAAA,CAAE,CAAC;IAClB;AAEA,IAAA,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,KAAI;AAC7B,QAAA,MAAM,WAAW,GAAG,EAAE,OAAO,EAAE;;AAG/B,QAAA,IAAI,CAAC,GAAG,EAAE,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,KAAI;YAC/C,IAAI,CAAC,MAAM,EAAE;AACX,gBAAA,IAAI,MAAM,KAAK,EAAE,EAAE;oBACjB,IAAI,CAAC,MAAM,CAAC;gBACd;AACA,gBAAA,IAAI,MAAM,KAAK,EAAE,EAAE;AACjB,oBAAA,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;gBACvB;YACF;AAEA,YAAA,IAAI,KAAK,KAAK,IAAI,EAAE;gBAClB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;YAC5B;iBAAO;AACL,gBAAA,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;YACxC;AACF,QAAA,CAAC,CAAC;AACJ,IAAA,CAAC,CAAC;AACJ;;;;"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import '../node-global.mjs';
|
|
2
2
|
/**
|
|
3
3
|
* Format a list of files using Prettier
|
|
4
|
+
*
|
|
4
5
|
* @param files - Array of file paths to format
|
|
5
6
|
* @returns 'ok' if successful, 'err' if any errors occurred
|
|
6
7
|
*/
|
|
@@ -9,6 +10,7 @@ export declare const formatFilesList: (files: readonly string[], options?: Reado
|
|
|
9
10
|
}>) => Promise<"ok" | "err">;
|
|
10
11
|
/**
|
|
11
12
|
* Format files matching the given glob pattern using Prettier
|
|
13
|
+
*
|
|
12
14
|
* @param pathGlob - Glob pattern to match files
|
|
13
15
|
* @returns 'ok' if successful, 'err' if any errors occurred
|
|
14
16
|
*/
|
|
@@ -17,6 +19,7 @@ export declare const formatFiles: (pathGlob: string, options?: Readonly<{
|
|
|
17
19
|
}>) => Promise<"ok" | "err">;
|
|
18
20
|
/**
|
|
19
21
|
* Format only files that have been changed (git status)
|
|
22
|
+
*
|
|
20
23
|
* @param options - Options for formatting
|
|
21
24
|
* @returns 'ok' if successful, 'err' if any errors occurred
|
|
22
25
|
*/
|
|
@@ -25,10 +28,14 @@ export declare const formatUntracked: (options?: Readonly<{
|
|
|
25
28
|
}>) => Promise<"ok" | "err">;
|
|
26
29
|
/**
|
|
27
30
|
* Format only files that differ from the specified base branch or commit
|
|
28
|
-
*
|
|
31
|
+
*
|
|
32
|
+
* @param base - Base branch name or commit hash to compare against (defaults to
|
|
33
|
+
* 'main')
|
|
29
34
|
* @param options - Options for formatting
|
|
30
|
-
* @param options.includeUntracked - Include untracked files in addition to diff
|
|
31
|
-
*
|
|
35
|
+
* @param options.includeUntracked - Include untracked files in addition to diff
|
|
36
|
+
* files (default is true)
|
|
37
|
+
* @param options.silent - Silent mode to suppress command output (default is
|
|
38
|
+
* false)
|
|
32
39
|
* @returns 'ok' if successful, 'err' if any errors occurred
|
|
33
40
|
*/
|
|
34
41
|
export declare const formatDiffFrom: (base: string, options?: Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.mts","sourceRoot":"","sources":["../../src/functions/format.mts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,CAAC;AAG5B
|
|
1
|
+
{"version":3,"file":"format.d.mts","sourceRoot":"","sources":["../../src/functions/format.mts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,CAAC;AAG5B;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,OAAO,SAAS,MAAM,EAAE,EACxB,UAAU,QAAQ,CAAC;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,KACvC,OAAO,CAAC,IAAI,GAAG,KAAK,CA2DtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,WAAW,GACtB,UAAU,MAAM,EAChB,UAAU,QAAQ,CAAC;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,KACvC,OAAO,CAAC,IAAI,GAAG,KAAK,CAuBtB,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAC1B,UAAU,QAAQ,CAAC;IAAE,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,KACvC,OAAO,CAAC,IAAI,GAAG,KAAK,CAqDtB,CAAC;AAEF;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,MAAM,EACZ,UAAU,QAAQ,CAAC;IAAE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC,KACnE,OAAO,CAAC,IAAI,GAAG,KAAK,CA4DtB,CAAC"}
|
|
@@ -5,6 +5,7 @@ import { getUntrackedFiles, getDiffFrom } from './diff.mjs';
|
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Format a list of files using Prettier
|
|
8
|
+
*
|
|
8
9
|
* @param files - Array of file paths to format
|
|
9
10
|
* @returns 'ok' if successful, 'err' if any errors occurred
|
|
10
11
|
*/
|
|
@@ -60,6 +61,7 @@ const formatFilesList = async (files, options) => {
|
|
|
60
61
|
};
|
|
61
62
|
/**
|
|
62
63
|
* Format files matching the given glob pattern using Prettier
|
|
64
|
+
*
|
|
63
65
|
* @param pathGlob - Glob pattern to match files
|
|
64
66
|
* @returns 'ok' if successful, 'err' if any errors occurred
|
|
65
67
|
*/
|
|
@@ -87,6 +89,7 @@ const formatFiles = async (pathGlob, options) => {
|
|
|
87
89
|
};
|
|
88
90
|
/**
|
|
89
91
|
* Format only files that have been changed (git status)
|
|
92
|
+
*
|
|
90
93
|
* @param options - Options for formatting
|
|
91
94
|
* @returns 'ok' if successful, 'err' if any errors occurred
|
|
92
95
|
*/
|
|
@@ -135,10 +138,14 @@ const formatUntracked = async (options) => {
|
|
|
135
138
|
};
|
|
136
139
|
/**
|
|
137
140
|
* Format only files that differ from the specified base branch or commit
|
|
138
|
-
*
|
|
141
|
+
*
|
|
142
|
+
* @param base - Base branch name or commit hash to compare against (defaults to
|
|
143
|
+
* 'main')
|
|
139
144
|
* @param options - Options for formatting
|
|
140
|
-
* @param options.includeUntracked - Include untracked files in addition to diff
|
|
141
|
-
*
|
|
145
|
+
* @param options.includeUntracked - Include untracked files in addition to diff
|
|
146
|
+
* files (default is true)
|
|
147
|
+
* @param options.silent - Silent mode to suppress command output (default is
|
|
148
|
+
* false)
|
|
142
149
|
* @returns 'ok' if successful, 'err' if any errors occurred
|
|
143
150
|
*/
|
|
144
151
|
const formatDiffFrom = async (base, options) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.mjs","sources":["../../src/functions/format.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKA
|
|
1
|
+
{"version":3,"file":"format.mjs","sources":["../../src/functions/format.mts"],"sourcesContent":[null],"names":[],"mappings":";;;;;AAKA;;;;;AAKG;AACI,MAAM,eAAe,GAAG,OAC7B,KAAwB,EACxB,OAAwC,KACf;AACzB,IAAA,MAAM,MAAM,GAAG,OAAO,EAAE,MAAM,IAAI,KAAK;AAEvC,IAAA,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QACtB,IAAI,CAAC,MAAM,EAAE;YACX,IAAI,CAAC,oBAAoB,CAAC;QAC5B;AAC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,OAAO,MAAM,eAAe,CAAC,YAAY,EAAE,EAAE,MAAM,EAAE,CAAC;IACxD;IAAE,OAAO,KAAK,EAAE;AACd,QAAA,OAAO,CAAC,KAAK,CAAC,0BAA0B,EAAE,KAAK,CAAC;AAChD,QAAA,OAAO,KAAK;IACd;AACF;;;;"}
|
|
@@ -1,25 +1,38 @@
|
|
|
1
1
|
import '../node-global.mjs';
|
|
2
|
-
/**
|
|
3
|
-
* Configuration for index file generation.
|
|
4
|
-
*/
|
|
2
|
+
/** Configuration for index file generation. */
|
|
5
3
|
export type GenIndexConfig = DeepReadonly<{
|
|
6
4
|
/** Target directories to generate index files for (string or array of strings) */
|
|
7
5
|
targetDirectory: string | readonly string[];
|
|
8
|
-
/**
|
|
6
|
+
/**
|
|
7
|
+
* Glob patterns of files or predicate function to exclude from exports
|
|
8
|
+
* (default: excludes `'**\/*.{test,spec}.?(c|m)[jt]s?(x)'`)
|
|
9
|
+
*/
|
|
10
|
+
exclude?: readonly string[] | ((args: Readonly<{
|
|
11
|
+
absolutePath: string;
|
|
12
|
+
relativePath: string;
|
|
13
|
+
fileName: string;
|
|
14
|
+
}>) => boolean);
|
|
15
|
+
/**
|
|
16
|
+
* Glob patterns of files or predicate function to exclude from exports
|
|
17
|
+
* (default: excludes `'**\/*.{test,spec}.?(c|m)[jt]s?(x)'`)
|
|
18
|
+
*
|
|
19
|
+
* @deprecated Use `exclude` instead.
|
|
20
|
+
*/
|
|
9
21
|
excludePatterns?: readonly string[];
|
|
10
22
|
/** File extensions of source files to export (default: ['.ts', '.tsx']) */
|
|
11
23
|
sourceExtensions?: readonly `.${string}`[];
|
|
12
24
|
/** File extension of index files to generate (default: '.ts') */
|
|
13
25
|
indexExtension?: `.${string}`;
|
|
14
26
|
/** File extension to use in export statements (default: '.js') */
|
|
15
|
-
exportExtension?: `.${string}
|
|
16
|
-
/** Command to run for formatting generated files (
|
|
27
|
+
exportExtension?: `.${string}` | 'none';
|
|
28
|
+
/** Command to run for formatting generated files (optional) */
|
|
17
29
|
formatCommand?: string;
|
|
18
30
|
/** Whether to suppress output during execution (default: false) */
|
|
19
31
|
silent?: boolean;
|
|
20
32
|
}>;
|
|
21
33
|
/**
|
|
22
34
|
* Generates index.ts files recursively in `config.targetDirectory`.
|
|
35
|
+
*
|
|
23
36
|
* @param config - Configuration for index file generation
|
|
24
37
|
* @throws Error if any step fails.
|
|
25
38
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gen-index.d.mts","sourceRoot":"","sources":["../../src/functions/gen-index.mts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,CAAC;AAG5B
|
|
1
|
+
{"version":3,"file":"gen-index.d.mts","sourceRoot":"","sources":["../../src/functions/gen-index.mts"],"names":[],"mappings":"AAEA,OAAO,oBAAoB,CAAC;AAG5B,+CAA+C;AAC/C,MAAM,MAAM,cAAc,GAAG,YAAY,CAAC;IACxC,kFAAkF;IAClF,eAAe,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CAAC;IAE5C;;;OAGG;IACH,OAAO,CAAC,EACJ,SAAS,MAAM,EAAE,GACjB,CAAC,CACC,IAAI,EAAE,QAAQ,CAAC;QACb,YAAY,EAAE,MAAM,CAAC;QACrB,YAAY,EAAE,MAAM,CAAC;QACrB,QAAQ,EAAE,MAAM,CAAC;KAClB,CAAC,KACC,OAAO,CAAC,CAAC;IAElB;;;;;OAKG;IACH,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAEpC,2EAA2E;IAC3E,gBAAgB,CAAC,EAAE,SAAS,IAAI,MAAM,EAAE,EAAE,CAAC;IAE3C,iEAAiE;IACjE,cAAc,CAAC,EAAE,IAAI,MAAM,EAAE,CAAC;IAE9B,kEAAkE;IAClE,eAAe,CAAC,EAAE,IAAI,MAAM,EAAE,GAAG,MAAM,CAAC;IAExC,+DAA+D;IAC/D,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,mEAAmE;IACnE,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC,CAAC;AAkBH;;;;;GAKG;AACH,eAAO,MAAM,QAAQ,GAAU,QAAQ,cAAc,KAAG,OAAO,CAAC,IAAI,CA8CnE,CAAC"}
|