@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.
Files changed (157) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +1272 -105
  3. package/bin/config.mjs +1271 -0
  4. package/dist/_virtual/_rolldown/runtime.cjs +23 -0
  5. package/dist/config-file/get-config-file.cjs +63 -79
  6. package/dist/config-file/get-config-file.d.cts +5 -5
  7. package/dist/config-file/{get-config-file.d.ts → get-config-file.d.mts} +7 -5
  8. package/dist/config-file/get-config-file.mjs +66 -0
  9. package/dist/config-file/index.cjs +4 -1
  10. package/dist/config-file/index.d.cts +2 -3
  11. package/dist/config-file/index.d.mts +4 -0
  12. package/dist/config-file/index.mjs +5 -0
  13. package/dist/create-storm-config.cjs +105 -136
  14. package/dist/create-storm-config.d.cts +5 -5
  15. package/dist/{create-storm-config.d.ts → create-storm-config.d.mts} +7 -5
  16. package/dist/create-storm-config.mjs +113 -0
  17. package/dist/env/get-env.cjs +190 -214
  18. package/dist/env/get-env.d.cts +5 -5
  19. package/dist/env/{get-env.d.ts → get-env.d.mts} +7 -5
  20. package/dist/env/get-env.mjs +203 -0
  21. package/dist/env/index.cjs +7 -2
  22. package/dist/env/index.d.cts +3 -4
  23. package/dist/env/index.d.mts +5 -0
  24. package/dist/env/index.mjs +6 -0
  25. package/dist/env/set-env.cjs +218 -374
  26. package/dist/env/set-env.d.cts +8 -8
  27. package/dist/env/{set-env.d.ts → set-env.d.mts} +10 -8
  28. package/dist/env/set-env.mjs +231 -0
  29. package/dist/get-config.cjs +40 -29
  30. package/dist/get-config.d.cts +18 -18
  31. package/dist/{get-config.d.ts → get-config.d.mts} +20 -18
  32. package/dist/get-config.mjs +46 -0
  33. package/dist/index.cjs +98 -7
  34. package/dist/index.d.cts +27 -28
  35. package/dist/index.d.mts +29 -0
  36. package/dist/index.mjs +26 -0
  37. package/dist/logger/chalk.cjs +38 -29
  38. package/dist/logger/chalk.d.cts +18 -17
  39. package/dist/logger/chalk.d.mts +37 -0
  40. package/dist/logger/chalk.mjs +43 -0
  41. package/dist/logger/console-icons.cjs +15 -14
  42. package/dist/logger/console-icons.d.cts +5 -8
  43. package/dist/logger/console-icons.d.mts +7 -0
  44. package/dist/logger/console-icons.mjs +20 -0
  45. package/dist/logger/console.cjs +187 -183
  46. package/dist/logger/console.d.cts +25 -25
  47. package/dist/logger/{console.d.ts → console.d.mts} +27 -25
  48. package/dist/logger/console.mjs +185 -0
  49. package/dist/logger/create-logger.cjs +31 -24
  50. package/dist/logger/create-logger.d.cts +5 -6
  51. package/dist/logger/{create-logger.d.ts → create-logger.d.mts} +7 -6
  52. package/dist/logger/create-logger.mjs +34 -0
  53. package/dist/logger/format-timestamp.cjs +12 -4
  54. package/dist/logger/format-timestamp.d.cts +3 -2
  55. package/dist/logger/{format-timestamp.d.ts → format-timestamp.d.mts} +5 -2
  56. package/dist/logger/format-timestamp.mjs +16 -0
  57. package/dist/logger/get-log-level.cjs +50 -60
  58. package/dist/logger/get-log-level.d.cts +4 -5
  59. package/dist/logger/{get-log-level.d.ts → get-log-level.d.mts} +6 -5
  60. package/dist/logger/get-log-level.mjs +54 -0
  61. package/dist/logger/index.cjs +29 -7
  62. package/dist/logger/index.d.cts +8 -10
  63. package/dist/logger/index.d.mts +10 -0
  64. package/dist/logger/index.mjs +11 -0
  65. package/dist/logger/is-unicode-supported.cjs +6 -10
  66. package/dist/logger/is-unicode-supported.d.cts +3 -2
  67. package/dist/logger/is-unicode-supported.d.mts +6 -0
  68. package/dist/logger/is-unicode-supported.mjs +10 -0
  69. package/dist/types.cjs +26 -25
  70. package/dist/types.d.cts +39 -41
  71. package/dist/types.d.mts +53 -0
  72. package/dist/types.mjs +30 -0
  73. package/dist/utilities/apply-workspace-tokens.cjs +31 -70
  74. package/dist/utilities/apply-workspace-tokens.d.cts +4 -5
  75. package/dist/utilities/{apply-workspace-tokens.d.ts → apply-workspace-tokens.d.mts} +6 -5
  76. package/dist/utilities/apply-workspace-tokens.mjs +37 -0
  77. package/dist/utilities/colors.cjs +91 -74
  78. package/dist/utilities/colors.d.cts +4 -4
  79. package/dist/utilities/{colors.d.ts → colors.d.mts} +6 -4
  80. package/dist/utilities/colors.mjs +97 -0
  81. package/dist/utilities/correct-paths.cjs +166 -196
  82. package/dist/utilities/correct-paths.d.cts +4 -4
  83. package/dist/utilities/{correct-paths.d.ts → correct-paths.d.mts} +6 -4
  84. package/dist/utilities/correct-paths.mjs +190 -0
  85. package/dist/utilities/file-path-utils.cjs +42 -27
  86. package/dist/utilities/file-path-utils.d.cts +15 -14
  87. package/dist/utilities/{file-path-utils.d.ts → file-path-utils.d.mts} +17 -14
  88. package/dist/utilities/file-path-utils.mjs +48 -0
  89. package/dist/utilities/find-up.cjs +12 -18
  90. package/dist/utilities/find-up.d.cts +3 -2
  91. package/dist/utilities/{find-up.d.ts → find-up.d.mts} +5 -2
  92. package/dist/utilities/find-up.mjs +19 -0
  93. package/dist/utilities/find-workspace-root.cjs +64 -69
  94. package/dist/utilities/find-workspace-root.d.cts +3 -2
  95. package/dist/utilities/{find-workspace-root.d.ts → find-workspace-root.d.mts} +5 -2
  96. package/dist/utilities/find-workspace-root.mjs +73 -0
  97. package/dist/utilities/get-default-config.cjs +69 -91
  98. package/dist/utilities/get-default-config.d.cts +4 -4
  99. package/dist/utilities/{get-default-config.d.ts → get-default-config.d.mts} +6 -4
  100. package/dist/utilities/get-default-config.mjs +74 -0
  101. package/dist/utilities/index.cjs +49 -9
  102. package/dist/utilities/index.d.cts +10 -14
  103. package/dist/utilities/index.d.mts +12 -0
  104. package/dist/utilities/index.mjs +13 -0
  105. package/dist/utilities/process-handler.cjs +32 -47
  106. package/dist/utilities/process-handler.d.cts +4 -4
  107. package/dist/utilities/process-handler.d.mts +9 -0
  108. package/dist/utilities/process-handler.mjs +38 -0
  109. package/dist/utilities/run.cjs +62 -36
  110. package/dist/utilities/run.d.cts +5 -6
  111. package/dist/utilities/{run.d.ts → run.d.mts} +7 -6
  112. package/dist/utilities/run.mjs +64 -0
  113. package/dist/utilities/toml.cjs +27 -32
  114. package/dist/utilities/toml.d.cts +148 -147
  115. package/dist/utilities/toml.d.mts +192 -0
  116. package/dist/utilities/toml.mjs +33 -0
  117. package/package.json +105 -157
  118. package/bin/config.js +0 -108
  119. package/dist/config-file/get-config-file.js +0 -83
  120. package/dist/config-file/index.d.ts +0 -3
  121. package/dist/config-file/index.js +0 -1
  122. package/dist/create-storm-config.js +0 -147
  123. package/dist/env/get-env.js +0 -226
  124. package/dist/env/index.d.ts +0 -4
  125. package/dist/env/index.js +0 -2
  126. package/dist/env/set-env.js +0 -386
  127. package/dist/get-config.js +0 -35
  128. package/dist/index.d.ts +0 -28
  129. package/dist/index.js +0 -7
  130. package/dist/logger/chalk.d.ts +0 -34
  131. package/dist/logger/chalk.js +0 -34
  132. package/dist/logger/console-icons.d.ts +0 -8
  133. package/dist/logger/console-icons.js +0 -17
  134. package/dist/logger/console.js +0 -191
  135. package/dist/logger/create-logger.js +0 -27
  136. package/dist/logger/format-timestamp.js +0 -6
  137. package/dist/logger/get-log-level.js +0 -64
  138. package/dist/logger/index.d.ts +0 -10
  139. package/dist/logger/index.js +0 -7
  140. package/dist/logger/is-unicode-supported.d.ts +0 -3
  141. package/dist/logger/is-unicode-supported.js +0 -12
  142. package/dist/types.d.ts +0 -53
  143. package/dist/types.js +0 -28
  144. package/dist/utilities/apply-workspace-tokens.js +0 -76
  145. package/dist/utilities/colors.js +0 -81
  146. package/dist/utilities/correct-paths.js +0 -231
  147. package/dist/utilities/file-path-utils.js +0 -33
  148. package/dist/utilities/find-up.js +0 -23
  149. package/dist/utilities/find-workspace-root.js +0 -77
  150. package/dist/utilities/get-default-config.js +0 -95
  151. package/dist/utilities/index.d.ts +0 -14
  152. package/dist/utilities/index.js +0 -9
  153. package/dist/utilities/process-handler.d.ts +0 -7
  154. package/dist/utilities/process-handler.js +0 -53
  155. package/dist/utilities/run.js +0 -38
  156. package/dist/utilities/toml.d.ts +0 -189
  157. package/dist/utilities/toml.js +0 -42
@@ -1,33 +1,48 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _correctpaths = require('./correct-paths');
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
- const result = !filePath || (_optionalChain([filePath, 'optionalAccess', _ => _.match, 'call', _2 => _2(/./g)]) || []).length <= 1 ? "." : filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
4
- if (result.startsWith("./")) {
5
- return result.substring(2);
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
- const result = _nullishCoalesce(_optionalChain([_correctpaths.normalizeWindowsPath.call(void 0, filePath), 'optionalAccess', _3 => _3.split, 'call', _4 => _4(_optionalChain([filePath, 'optionalAccess', _5 => _5.includes, 'call', _6 => _6("\\")]) ? "\\" : "/"), 'optionalAccess', _7 => _7.pop, 'call', _8 => _8()]), () => ( ""));
14
- if (requireExtension === true && !result.includes(".")) {
15
- return "";
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
- const normalizedPath = _correctpaths.normalizeWindowsPath.call(void 0, filePath);
24
- return normalizedPath.replace(
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
- * Require the file extension to be present in the file name.
5
- *
6
- * @defaultValue false
7
- */
8
- requireExtension?: boolean;
9
- /**
10
- * Return the file extension as part of the full file name result.
11
- *
12
- * @defaultValue true
13
- */
14
- withExtension?: boolean;
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 { type FindFileNameOptions, findFileName, findFilePath, removeExtension };
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
- * Require the file extension to be present in the file name.
5
- *
6
- * @defaultValue false
7
- */
8
- requireExtension?: boolean;
9
- /**
10
- * Return the file extension as part of the full file name result.
11
- *
12
- * @defaultValue true
13
- */
14
- withExtension?: boolean;
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 { type FindFileNameOptions, findFileName, findFilePath, removeExtension };
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
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _nodefs = require('node:fs');
2
- var _nodepath = require('node:path');
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
- const _startPath = _nullishCoalesce(startPath, () => ( process.cwd()));
7
- if (endDirectoryNames.some(
8
- (endDirName) => _nodefs.existsSync.call(void 0, _nodepath.join.call(void 0, _startPath, endDirName))
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
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }var _correctpaths = require('./correct-paths');
2
- var _findup = require('./find-up');
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
- "storm-workspace.json",
5
- "storm-workspace.yaml",
6
- "storm-workspace.yml",
7
- "storm-workspace.js",
8
- "storm-workspace.ts",
9
- ".storm-workspace.json",
10
- ".storm-workspace.yaml",
11
- ".storm-workspace.yml",
12
- ".storm-workspace.js",
13
- ".storm-workspace.ts",
14
- "lerna.json",
15
- "nx.json",
16
- "turbo.json",
17
- "npm-workspace.json",
18
- "yarn-workspace.json",
19
- "pnpm-workspace.json",
20
- "npm-workspace.yaml",
21
- "yarn-workspace.yaml",
22
- "pnpm-workspace.yaml",
23
- "npm-workspace.yml",
24
- "yarn-workspace.yml",
25
- "pnpm-workspace.yml",
26
- "npm-lock.json",
27
- "yarn-lock.json",
28
- "pnpm-lock.json",
29
- "npm-lock.yaml",
30
- "yarn-lock.yaml",
31
- "pnpm-lock.yaml",
32
- "npm-lock.yml",
33
- "yarn-lock.yml",
34
- "pnpm-lock.yml",
35
- "bun.lockb",
36
- "bun.lock",
37
- "bunfig.toml"
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
- ".storm-workspace",
41
- ".nx",
42
- ".git",
43
- ".github",
44
- ".vscode",
45
- ".verdaccio"
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
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
49
- return _correctpaths.correctPaths.call(void 0,
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
- const result = findWorkspaceRootSafe(pathInsideMonorepo);
63
- if (!result) {
64
- throw new Error(
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 };