@storm-software/config-tools 1.190.120 → 1.190.122
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 +1 -1
- package/bin/config.cjs +1272 -105
- package/bin/config.mjs +1271 -0
- package/dist/_virtual/_rolldown/runtime.cjs +23 -0
- package/dist/config-file/get-config-file.cjs +63 -79
- package/dist/config-file/get-config-file.d.cts +5 -5
- package/dist/config-file/{get-config-file.d.ts → get-config-file.d.mts} +7 -5
- package/dist/config-file/get-config-file.mjs +66 -0
- package/dist/config-file/index.cjs +4 -1
- package/dist/config-file/index.d.cts +2 -3
- package/dist/config-file/index.d.mts +4 -0
- package/dist/config-file/index.mjs +5 -0
- package/dist/create-storm-config.cjs +105 -136
- package/dist/create-storm-config.d.cts +5 -5
- package/dist/{create-storm-config.d.ts → create-storm-config.d.mts} +7 -5
- package/dist/create-storm-config.mjs +113 -0
- package/dist/env/get-env.cjs +190 -214
- package/dist/env/get-env.d.cts +5 -5
- package/dist/env/{get-env.d.ts → get-env.d.mts} +7 -5
- package/dist/env/get-env.mjs +203 -0
- package/dist/env/index.cjs +7 -2
- package/dist/env/index.d.cts +3 -4
- package/dist/env/index.d.mts +5 -0
- package/dist/env/index.mjs +6 -0
- package/dist/env/set-env.cjs +218 -374
- package/dist/env/set-env.d.cts +8 -8
- package/dist/env/{set-env.d.ts → set-env.d.mts} +10 -8
- package/dist/env/set-env.mjs +231 -0
- package/dist/get-config.cjs +40 -29
- package/dist/get-config.d.cts +18 -18
- package/dist/{get-config.d.ts → get-config.d.mts} +20 -18
- package/dist/get-config.mjs +46 -0
- package/dist/index.cjs +98 -7
- package/dist/index.d.cts +27 -28
- package/dist/index.d.mts +29 -0
- package/dist/index.mjs +26 -0
- package/dist/logger/chalk.cjs +38 -29
- package/dist/logger/chalk.d.cts +18 -17
- package/dist/logger/chalk.d.mts +37 -0
- package/dist/logger/chalk.mjs +43 -0
- package/dist/logger/console-icons.cjs +15 -14
- package/dist/logger/console-icons.d.cts +5 -8
- package/dist/logger/console-icons.d.mts +7 -0
- package/dist/logger/console-icons.mjs +20 -0
- package/dist/logger/console.cjs +187 -183
- package/dist/logger/console.d.cts +25 -25
- package/dist/logger/{console.d.ts → console.d.mts} +27 -25
- package/dist/logger/console.mjs +185 -0
- package/dist/logger/create-logger.cjs +31 -24
- package/dist/logger/create-logger.d.cts +5 -6
- package/dist/logger/{create-logger.d.ts → create-logger.d.mts} +7 -6
- package/dist/logger/create-logger.mjs +34 -0
- package/dist/logger/format-timestamp.cjs +12 -4
- package/dist/logger/format-timestamp.d.cts +3 -2
- package/dist/logger/{format-timestamp.d.ts → format-timestamp.d.mts} +5 -2
- package/dist/logger/format-timestamp.mjs +16 -0
- package/dist/logger/get-log-level.cjs +50 -60
- package/dist/logger/get-log-level.d.cts +4 -5
- package/dist/logger/{get-log-level.d.ts → get-log-level.d.mts} +6 -5
- package/dist/logger/get-log-level.mjs +54 -0
- package/dist/logger/index.cjs +29 -7
- package/dist/logger/index.d.cts +8 -10
- package/dist/logger/index.d.mts +10 -0
- package/dist/logger/index.mjs +11 -0
- package/dist/logger/is-unicode-supported.cjs +6 -10
- package/dist/logger/is-unicode-supported.d.cts +3 -2
- package/dist/logger/is-unicode-supported.d.mts +6 -0
- package/dist/logger/is-unicode-supported.mjs +10 -0
- package/dist/types.cjs +26 -25
- package/dist/types.d.cts +39 -41
- package/dist/types.d.mts +53 -0
- package/dist/types.mjs +30 -0
- package/dist/utilities/apply-workspace-tokens.cjs +31 -70
- package/dist/utilities/apply-workspace-tokens.d.cts +4 -5
- package/dist/utilities/{apply-workspace-tokens.d.ts → apply-workspace-tokens.d.mts} +6 -5
- package/dist/utilities/apply-workspace-tokens.mjs +37 -0
- package/dist/utilities/colors.cjs +91 -74
- package/dist/utilities/colors.d.cts +4 -4
- package/dist/utilities/{colors.d.ts → colors.d.mts} +6 -4
- package/dist/utilities/colors.mjs +97 -0
- package/dist/utilities/correct-paths.cjs +166 -196
- package/dist/utilities/correct-paths.d.cts +4 -4
- package/dist/utilities/{correct-paths.d.ts → correct-paths.d.mts} +6 -4
- package/dist/utilities/correct-paths.mjs +190 -0
- package/dist/utilities/file-path-utils.cjs +42 -27
- package/dist/utilities/file-path-utils.d.cts +15 -14
- package/dist/utilities/{file-path-utils.d.ts → file-path-utils.d.mts} +17 -14
- package/dist/utilities/file-path-utils.mjs +48 -0
- package/dist/utilities/find-up.cjs +12 -18
- package/dist/utilities/find-up.d.cts +3 -2
- package/dist/utilities/{find-up.d.ts → find-up.d.mts} +5 -2
- package/dist/utilities/find-up.mjs +19 -0
- package/dist/utilities/find-workspace-root.cjs +64 -69
- package/dist/utilities/find-workspace-root.d.cts +3 -2
- package/dist/utilities/{find-workspace-root.d.ts → find-workspace-root.d.mts} +5 -2
- package/dist/utilities/find-workspace-root.mjs +73 -0
- package/dist/utilities/get-default-config.cjs +69 -91
- package/dist/utilities/get-default-config.d.cts +4 -4
- package/dist/utilities/{get-default-config.d.ts → get-default-config.d.mts} +6 -4
- package/dist/utilities/get-default-config.mjs +74 -0
- package/dist/utilities/index.cjs +49 -9
- package/dist/utilities/index.d.cts +10 -14
- package/dist/utilities/index.d.mts +12 -0
- package/dist/utilities/index.mjs +13 -0
- package/dist/utilities/process-handler.cjs +32 -47
- package/dist/utilities/process-handler.d.cts +4 -4
- package/dist/utilities/process-handler.d.mts +9 -0
- package/dist/utilities/process-handler.mjs +38 -0
- package/dist/utilities/run.cjs +62 -36
- package/dist/utilities/run.d.cts +5 -6
- package/dist/utilities/{run.d.ts → run.d.mts} +7 -6
- package/dist/utilities/run.mjs +64 -0
- package/dist/utilities/toml.cjs +27 -32
- package/dist/utilities/toml.d.cts +148 -147
- package/dist/utilities/toml.d.mts +192 -0
- package/dist/utilities/toml.mjs +33 -0
- package/package.json +105 -157
- package/bin/config.js +0 -108
- package/dist/config-file/get-config-file.js +0 -83
- package/dist/config-file/index.d.ts +0 -3
- package/dist/config-file/index.js +0 -1
- package/dist/create-storm-config.js +0 -147
- package/dist/env/get-env.js +0 -226
- package/dist/env/index.d.ts +0 -4
- package/dist/env/index.js +0 -2
- package/dist/env/set-env.js +0 -386
- package/dist/get-config.js +0 -35
- package/dist/index.d.ts +0 -28
- package/dist/index.js +0 -7
- package/dist/logger/chalk.d.ts +0 -34
- package/dist/logger/chalk.js +0 -34
- package/dist/logger/console-icons.d.ts +0 -8
- package/dist/logger/console-icons.js +0 -17
- package/dist/logger/console.js +0 -191
- package/dist/logger/create-logger.js +0 -27
- package/dist/logger/format-timestamp.js +0 -6
- package/dist/logger/get-log-level.js +0 -64
- package/dist/logger/index.d.ts +0 -10
- package/dist/logger/index.js +0 -7
- package/dist/logger/is-unicode-supported.d.ts +0 -3
- package/dist/logger/is-unicode-supported.js +0 -12
- package/dist/types.d.ts +0 -53
- package/dist/types.js +0 -28
- package/dist/utilities/apply-workspace-tokens.js +0 -76
- package/dist/utilities/colors.js +0 -81
- package/dist/utilities/correct-paths.js +0 -231
- package/dist/utilities/file-path-utils.js +0 -33
- package/dist/utilities/find-up.js +0 -23
- package/dist/utilities/find-workspace-root.js +0 -77
- package/dist/utilities/get-default-config.js +0 -95
- package/dist/utilities/index.d.ts +0 -14
- package/dist/utilities/index.js +0 -9
- package/dist/utilities/process-handler.d.ts +0 -7
- package/dist/utilities/process-handler.js +0 -53
- package/dist/utilities/run.js +0 -38
- package/dist/utilities/toml.d.ts +0 -189
- package/dist/utilities/toml.js +0 -42
|
@@ -1,33 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utilities_correct_paths = require("./correct-paths.cjs");
|
|
3
|
+
//#region src/utilities/file-path-utils.ts
|
|
2
4
|
const removeExtension = (filePath) => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
if (result.startsWith(".") || result.startsWith("/")) {
|
|
8
|
-
return result.substring(1);
|
|
9
|
-
}
|
|
10
|
-
return result;
|
|
5
|
+
const result = !filePath || (filePath?.match(/./g) || []).length <= 1 ? "." : filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
|
|
6
|
+
if (result.startsWith("./")) return result.substring(2);
|
|
7
|
+
if (result.startsWith(".") || result.startsWith("/")) return result.substring(1);
|
|
8
|
+
return result;
|
|
11
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Find the file name from a file path.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const fileName = findFileName("C:\\Users\\user\\Documents\\file.txt");
|
|
16
|
+
* // fileName = "file.txt"
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @param filePath - The file path to process
|
|
20
|
+
* @param options - The options to use when processing the file name
|
|
21
|
+
* @returns The file name
|
|
22
|
+
*/
|
|
12
23
|
function findFileName(filePath, { requireExtension, withExtension } = {}) {
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
if (withExtension === false && result.includes(".")) {
|
|
18
|
-
return result.split(".").slice(-1).join(".") || "";
|
|
19
|
-
}
|
|
20
|
-
return result;
|
|
24
|
+
const result = require_utilities_correct_paths.normalizeWindowsPath(filePath)?.split(filePath?.includes("\\") ? "\\" : "/")?.pop() ?? "";
|
|
25
|
+
if (requireExtension === true && !result.includes(".")) return "";
|
|
26
|
+
if (withExtension === false && result.includes(".")) return result.split(".").slice(-1).join(".") || "";
|
|
27
|
+
return result;
|
|
21
28
|
}
|
|
29
|
+
/**
|
|
30
|
+
* Find the full file path's directories from a file path.
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* ```ts
|
|
34
|
+
* const folderPath = findFilePath("C:\\Users\\user\\Documents\\file.txt");
|
|
35
|
+
* // folderPath = "C:\\Users\\user\\Documents"
|
|
36
|
+
* ```
|
|
37
|
+
*
|
|
38
|
+
* @param filePath - The file path to process
|
|
39
|
+
* @returns The full file path's directories
|
|
40
|
+
*/
|
|
22
41
|
function findFilePath(filePath) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
findFileName(normalizedPath, { requireExtension: true }),
|
|
26
|
-
""
|
|
27
|
-
);
|
|
42
|
+
const normalizedPath = require_utilities_correct_paths.normalizeWindowsPath(filePath);
|
|
43
|
+
return normalizedPath.replace(findFileName(normalizedPath, { requireExtension: true }), "");
|
|
28
44
|
}
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
exports.findFileName = findFileName; exports.findFilePath = findFilePath; exports.removeExtension = removeExtension;
|
|
45
|
+
//#endregion
|
|
46
|
+
exports.findFileName = findFileName;
|
|
47
|
+
exports.findFilePath = findFilePath;
|
|
48
|
+
exports.removeExtension = removeExtension;
|
|
@@ -1,17 +1,18 @@
|
|
|
1
|
+
//#region src/utilities/file-path-utils.d.ts
|
|
1
2
|
declare const removeExtension: (filePath?: string) => string;
|
|
2
3
|
interface FindFileNameOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Require the file extension to be present in the file name.
|
|
6
|
+
*
|
|
7
|
+
* @defaultValue false
|
|
8
|
+
*/
|
|
9
|
+
requireExtension?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Return the file extension as part of the full file name result.
|
|
12
|
+
*
|
|
13
|
+
* @defaultValue true
|
|
14
|
+
*/
|
|
15
|
+
withExtension?: boolean;
|
|
15
16
|
}
|
|
16
17
|
/**
|
|
17
18
|
* Find the file name from a file path.
|
|
@@ -40,5 +41,5 @@ declare function findFileName(filePath: string, { requireExtension, withExtensio
|
|
|
40
41
|
* @returns The full file path's directories
|
|
41
42
|
*/
|
|
42
43
|
declare function findFilePath(filePath: string): string;
|
|
43
|
-
|
|
44
|
-
export {
|
|
44
|
+
//#endregion
|
|
45
|
+
export { FindFileNameOptions, findFileName, findFilePath, removeExtension };
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/utilities/file-path-utils.d.ts
|
|
1
4
|
declare const removeExtension: (filePath?: string) => string;
|
|
2
5
|
interface FindFileNameOptions {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
6
|
+
/**
|
|
7
|
+
* Require the file extension to be present in the file name.
|
|
8
|
+
*
|
|
9
|
+
* @defaultValue false
|
|
10
|
+
*/
|
|
11
|
+
requireExtension?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Return the file extension as part of the full file name result.
|
|
14
|
+
*
|
|
15
|
+
* @defaultValue true
|
|
16
|
+
*/
|
|
17
|
+
withExtension?: boolean;
|
|
15
18
|
}
|
|
16
19
|
/**
|
|
17
20
|
* Find the file name from a file path.
|
|
@@ -40,5 +43,5 @@ declare function findFileName(filePath: string, { requireExtension, withExtensio
|
|
|
40
43
|
* @returns The full file path's directories
|
|
41
44
|
*/
|
|
42
45
|
declare function findFilePath(filePath: string): string;
|
|
43
|
-
|
|
44
|
-
export {
|
|
46
|
+
//#endregion
|
|
47
|
+
export { FindFileNameOptions, findFileName, findFilePath, removeExtension };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { normalizeWindowsPath } from "./correct-paths.mjs";
|
|
5
|
+
//#region src/utilities/file-path-utils.ts
|
|
6
|
+
const removeExtension = (filePath) => {
|
|
7
|
+
const result = !filePath || (filePath?.match(/./g) || []).length <= 1 ? "." : filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
|
|
8
|
+
if (result.startsWith("./")) return result.substring(2);
|
|
9
|
+
if (result.startsWith(".") || result.startsWith("/")) return result.substring(1);
|
|
10
|
+
return result;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* Find the file name from a file path.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```ts
|
|
17
|
+
* const fileName = findFileName("C:\\Users\\user\\Documents\\file.txt");
|
|
18
|
+
* // fileName = "file.txt"
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @param filePath - The file path to process
|
|
22
|
+
* @param options - The options to use when processing the file name
|
|
23
|
+
* @returns The file name
|
|
24
|
+
*/
|
|
25
|
+
function findFileName(filePath, { requireExtension, withExtension } = {}) {
|
|
26
|
+
const result = normalizeWindowsPath(filePath)?.split(filePath?.includes("\\") ? "\\" : "/")?.pop() ?? "";
|
|
27
|
+
if (requireExtension === true && !result.includes(".")) return "";
|
|
28
|
+
if (withExtension === false && result.includes(".")) return result.split(".").slice(-1).join(".") || "";
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Find the full file path's directories from a file path.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const folderPath = findFilePath("C:\\Users\\user\\Documents\\file.txt");
|
|
37
|
+
* // folderPath = "C:\\Users\\user\\Documents"
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @param filePath - The file path to process
|
|
41
|
+
* @returns The full file path's directories
|
|
42
|
+
*/
|
|
43
|
+
function findFilePath(filePath) {
|
|
44
|
+
const normalizedPath = normalizeWindowsPath(filePath);
|
|
45
|
+
return normalizedPath.replace(findFileName(normalizedPath, { requireExtension: true }), "");
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { findFileName, findFilePath, removeExtension };
|
|
@@ -1,23 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
let node_fs = require("node:fs");
|
|
3
|
+
let node_path = require("node:path");
|
|
4
|
+
//#region src/utilities/find-up.ts
|
|
3
5
|
const MAX_PATH_SEARCH_DEPTH = 30;
|
|
4
6
|
let depth = 0;
|
|
7
|
+
/**
|
|
8
|
+
* Gets the nearest "node_modules" folder by walking up from start path.
|
|
9
|
+
*/
|
|
5
10
|
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return _startPath;
|
|
11
|
-
}
|
|
12
|
-
if (endFileNames.some((endFileName) => _nodefs.existsSync.call(void 0, _nodepath.join.call(void 0, _startPath, endFileName)))) {
|
|
13
|
-
return _startPath;
|
|
14
|
-
}
|
|
15
|
-
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
16
|
-
const parent = _nodepath.join.call(void 0, _startPath, "..");
|
|
17
|
-
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
18
|
-
}
|
|
19
|
-
return void 0;
|
|
11
|
+
const _startPath = startPath ?? process.cwd();
|
|
12
|
+
if (endDirectoryNames.some((endDirName) => (0, node_fs.existsSync)((0, node_path.join)(_startPath, endDirName)))) return _startPath;
|
|
13
|
+
if (endFileNames.some((endFileName) => (0, node_fs.existsSync)((0, node_path.join)(_startPath, endFileName)))) return _startPath;
|
|
14
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) return findFolderUp((0, node_path.join)(_startPath, ".."), endFileNames, endDirectoryNames);
|
|
20
15
|
}
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
//#endregion
|
|
23
17
|
exports.findFolderUp = findFolderUp;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
//#region src/utilities/find-up.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Gets the nearest "node_modules" folder by walking up from start path.
|
|
3
4
|
*/
|
|
4
5
|
declare function findFolderUp(startPath: string, endFileNames?: string[], endDirectoryNames?: string[]): string | undefined;
|
|
5
|
-
|
|
6
|
-
export { findFolderUp };
|
|
6
|
+
//#endregion
|
|
7
|
+
export { findFolderUp };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/utilities/find-up.d.ts
|
|
1
4
|
/**
|
|
2
5
|
* Gets the nearest "node_modules" folder by walking up from start path.
|
|
3
6
|
*/
|
|
4
7
|
declare function findFolderUp(startPath: string, endFileNames?: string[], endDirectoryNames?: string[]): string | undefined;
|
|
5
|
-
|
|
6
|
-
export { findFolderUp };
|
|
8
|
+
//#endregion
|
|
9
|
+
export { findFolderUp };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { existsSync } from "node:fs";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
//#region src/utilities/find-up.ts
|
|
7
|
+
const MAX_PATH_SEARCH_DEPTH = 30;
|
|
8
|
+
let depth = 0;
|
|
9
|
+
/**
|
|
10
|
+
* Gets the nearest "node_modules" folder by walking up from start path.
|
|
11
|
+
*/
|
|
12
|
+
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
13
|
+
const _startPath = startPath ?? process.cwd();
|
|
14
|
+
if (endDirectoryNames.some((endDirName) => existsSync(join(_startPath, endDirName)))) return _startPath;
|
|
15
|
+
if (endFileNames.some((endFileName) => existsSync(join(_startPath, endFileName)))) return _startPath;
|
|
16
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) return findFolderUp(join(_startPath, ".."), endFileNames, endDirectoryNames);
|
|
17
|
+
}
|
|
18
|
+
//#endregion
|
|
19
|
+
export { findFolderUp };
|
|
@@ -1,77 +1,72 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_utilities_correct_paths = require("./correct-paths.cjs");
|
|
3
|
+
const require_utilities_find_up = require("./find-up.cjs");
|
|
4
|
+
//#region src/utilities/find-workspace-root.ts
|
|
3
5
|
const rootFiles = [
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
6
|
+
"storm-workspace.json",
|
|
7
|
+
"storm-workspace.yaml",
|
|
8
|
+
"storm-workspace.yml",
|
|
9
|
+
"storm-workspace.js",
|
|
10
|
+
"storm-workspace.ts",
|
|
11
|
+
".storm-workspace.json",
|
|
12
|
+
".storm-workspace.yaml",
|
|
13
|
+
".storm-workspace.yml",
|
|
14
|
+
".storm-workspace.js",
|
|
15
|
+
".storm-workspace.ts",
|
|
16
|
+
"lerna.json",
|
|
17
|
+
"nx.json",
|
|
18
|
+
"turbo.json",
|
|
19
|
+
"npm-workspace.json",
|
|
20
|
+
"yarn-workspace.json",
|
|
21
|
+
"pnpm-workspace.json",
|
|
22
|
+
"npm-workspace.yaml",
|
|
23
|
+
"yarn-workspace.yaml",
|
|
24
|
+
"pnpm-workspace.yaml",
|
|
25
|
+
"npm-workspace.yml",
|
|
26
|
+
"yarn-workspace.yml",
|
|
27
|
+
"pnpm-workspace.yml",
|
|
28
|
+
"npm-lock.json",
|
|
29
|
+
"yarn-lock.json",
|
|
30
|
+
"pnpm-lock.json",
|
|
31
|
+
"npm-lock.yaml",
|
|
32
|
+
"yarn-lock.yaml",
|
|
33
|
+
"pnpm-lock.yaml",
|
|
34
|
+
"npm-lock.yml",
|
|
35
|
+
"yarn-lock.yml",
|
|
36
|
+
"pnpm-lock.yml",
|
|
37
|
+
"bun.lockb",
|
|
38
|
+
"bun.lock",
|
|
39
|
+
"bunfig.toml"
|
|
38
40
|
];
|
|
39
41
|
const rootDirectories = [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
42
|
+
".storm-workspace",
|
|
43
|
+
".nx",
|
|
44
|
+
".git",
|
|
45
|
+
".github",
|
|
46
|
+
".vscode",
|
|
47
|
+
".verdaccio"
|
|
46
48
|
];
|
|
49
|
+
/**
|
|
50
|
+
* Find the monorepo root directory, searching upwards from `path`.
|
|
51
|
+
*
|
|
52
|
+
* @param pathInsideMonorepo - The path inside the monorepo to start searching from
|
|
53
|
+
* @returns The monorepo root directory
|
|
54
|
+
*/
|
|
47
55
|
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
_nullishCoalesce(process.env.STORM_WORKSPACE_ROOT, () => ( process.env.NX_WORKSPACE_ROOT_PATH))
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
return _correctpaths.correctPaths.call(void 0,
|
|
54
|
-
_findup.findFolderUp.call(void 0,
|
|
55
|
-
_nullishCoalesce(pathInsideMonorepo, () => ( process.cwd())),
|
|
56
|
-
rootFiles,
|
|
57
|
-
rootDirectories
|
|
58
|
-
)
|
|
59
|
-
);
|
|
56
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) return require_utilities_correct_paths.correctPaths(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
57
|
+
return require_utilities_correct_paths.correctPaths(require_utilities_find_up.findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
60
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Find the monorepo root directory, searching upwards from `path`.
|
|
61
|
+
*
|
|
62
|
+
* @param pathInsideMonorepo - The path inside the monorepo to start searching from
|
|
63
|
+
* @returns The monorepo root directory
|
|
64
|
+
*/
|
|
61
65
|
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
66
|
-
${rootFiles.join(
|
|
67
|
-
"\n"
|
|
68
|
-
)}
|
|
69
|
-
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
70
|
-
);
|
|
71
|
-
}
|
|
72
|
-
return result;
|
|
66
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
67
|
+
if (!result) throw new Error(`Cannot find workspace root upwards from known path. Files search list includes: \n${rootFiles.join("\n")}\nPath: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
|
|
68
|
+
return result;
|
|
73
69
|
}
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
exports.findWorkspaceRoot = findWorkspaceRoot; exports.findWorkspaceRootSafe = findWorkspaceRootSafe;
|
|
70
|
+
//#endregion
|
|
71
|
+
exports.findWorkspaceRoot = findWorkspaceRoot;
|
|
72
|
+
exports.findWorkspaceRootSafe = findWorkspaceRootSafe;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
//#region src/utilities/find-workspace-root.d.ts
|
|
1
2
|
/**
|
|
2
3
|
* Find the monorepo root directory, searching upwards from `path`.
|
|
3
4
|
*
|
|
@@ -12,5 +13,5 @@ declare function findWorkspaceRootSafe(pathInsideMonorepo?: string): string | un
|
|
|
12
13
|
* @returns The monorepo root directory
|
|
13
14
|
*/
|
|
14
15
|
declare function findWorkspaceRoot(pathInsideMonorepo?: string): string;
|
|
15
|
-
|
|
16
|
-
export { findWorkspaceRoot, findWorkspaceRootSafe };
|
|
16
|
+
//#endregion
|
|
17
|
+
export { findWorkspaceRoot, findWorkspaceRootSafe };
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import __tsdown_shims_path from 'node:path';
|
|
2
|
+
import __tsdown_shims_url from 'node:url';
|
|
3
|
+
//#region src/utilities/find-workspace-root.d.ts
|
|
1
4
|
/**
|
|
2
5
|
* Find the monorepo root directory, searching upwards from `path`.
|
|
3
6
|
*
|
|
@@ -12,5 +15,5 @@ declare function findWorkspaceRootSafe(pathInsideMonorepo?: string): string | un
|
|
|
12
15
|
* @returns The monorepo root directory
|
|
13
16
|
*/
|
|
14
17
|
declare function findWorkspaceRoot(pathInsideMonorepo?: string): string;
|
|
15
|
-
|
|
16
|
-
export { findWorkspaceRoot, findWorkspaceRootSafe };
|
|
18
|
+
//#endregion
|
|
19
|
+
export { findWorkspaceRoot, findWorkspaceRootSafe };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import "node:path";
|
|
2
|
+
import "node:url";
|
|
3
|
+
import.meta.url;
|
|
4
|
+
import { correctPaths } from "./correct-paths.mjs";
|
|
5
|
+
import { findFolderUp } from "./find-up.mjs";
|
|
6
|
+
//#region src/utilities/find-workspace-root.ts
|
|
7
|
+
const rootFiles = [
|
|
8
|
+
"storm-workspace.json",
|
|
9
|
+
"storm-workspace.yaml",
|
|
10
|
+
"storm-workspace.yml",
|
|
11
|
+
"storm-workspace.js",
|
|
12
|
+
"storm-workspace.ts",
|
|
13
|
+
".storm-workspace.json",
|
|
14
|
+
".storm-workspace.yaml",
|
|
15
|
+
".storm-workspace.yml",
|
|
16
|
+
".storm-workspace.js",
|
|
17
|
+
".storm-workspace.ts",
|
|
18
|
+
"lerna.json",
|
|
19
|
+
"nx.json",
|
|
20
|
+
"turbo.json",
|
|
21
|
+
"npm-workspace.json",
|
|
22
|
+
"yarn-workspace.json",
|
|
23
|
+
"pnpm-workspace.json",
|
|
24
|
+
"npm-workspace.yaml",
|
|
25
|
+
"yarn-workspace.yaml",
|
|
26
|
+
"pnpm-workspace.yaml",
|
|
27
|
+
"npm-workspace.yml",
|
|
28
|
+
"yarn-workspace.yml",
|
|
29
|
+
"pnpm-workspace.yml",
|
|
30
|
+
"npm-lock.json",
|
|
31
|
+
"yarn-lock.json",
|
|
32
|
+
"pnpm-lock.json",
|
|
33
|
+
"npm-lock.yaml",
|
|
34
|
+
"yarn-lock.yaml",
|
|
35
|
+
"pnpm-lock.yaml",
|
|
36
|
+
"npm-lock.yml",
|
|
37
|
+
"yarn-lock.yml",
|
|
38
|
+
"pnpm-lock.yml",
|
|
39
|
+
"bun.lockb",
|
|
40
|
+
"bun.lock",
|
|
41
|
+
"bunfig.toml"
|
|
42
|
+
];
|
|
43
|
+
const rootDirectories = [
|
|
44
|
+
".storm-workspace",
|
|
45
|
+
".nx",
|
|
46
|
+
".git",
|
|
47
|
+
".github",
|
|
48
|
+
".vscode",
|
|
49
|
+
".verdaccio"
|
|
50
|
+
];
|
|
51
|
+
/**
|
|
52
|
+
* Find the monorepo root directory, searching upwards from `path`.
|
|
53
|
+
*
|
|
54
|
+
* @param pathInsideMonorepo - The path inside the monorepo to start searching from
|
|
55
|
+
* @returns The monorepo root directory
|
|
56
|
+
*/
|
|
57
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
58
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) return correctPaths(process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH);
|
|
59
|
+
return correctPaths(findFolderUp(pathInsideMonorepo ?? process.cwd(), rootFiles, rootDirectories));
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Find the monorepo root directory, searching upwards from `path`.
|
|
63
|
+
*
|
|
64
|
+
* @param pathInsideMonorepo - The path inside the monorepo to start searching from
|
|
65
|
+
* @returns The monorepo root directory
|
|
66
|
+
*/
|
|
67
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
68
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
69
|
+
if (!result) throw new Error(`Cannot find workspace root upwards from known path. Files search list includes: \n${rootFiles.join("\n")}\nPath: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`);
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
//#endregion
|
|
73
|
+
export { findWorkspaceRoot, findWorkspaceRootSafe };
|