@storm-software/config-tools 1.190.119 → 1.190.120

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 (114) hide show
  1. package/README.md +1 -1
  2. package/bin/config.cjs +20 -1532
  3. package/bin/config.js +19 -1527
  4. package/dist/config-file/get-config-file.cjs +80 -25
  5. package/dist/config-file/get-config-file.js +79 -24
  6. package/dist/config-file/index.cjs +1 -29
  7. package/dist/config-file/index.js +1 -29
  8. package/dist/create-storm-config.cjs +138 -26
  9. package/dist/create-storm-config.js +140 -28
  10. package/dist/env/get-env.cjs +221 -6
  11. package/dist/env/get-env.js +221 -6
  12. package/dist/env/index.cjs +2 -18
  13. package/dist/env/index.js +2 -18
  14. package/dist/env/set-env.cjs +383 -8
  15. package/dist/env/set-env.js +382 -7
  16. package/dist/get-config.cjs +28 -27
  17. package/dist/get-config.js +29 -28
  18. package/dist/index.cjs +7 -201
  19. package/dist/index.js +7 -201
  20. package/dist/logger/chalk.cjs +32 -4
  21. package/dist/logger/chalk.js +31 -3
  22. package/dist/logger/console-icons.cjs +15 -6
  23. package/dist/logger/console-icons.js +14 -5
  24. package/dist/logger/console.cjs +191 -37
  25. package/dist/logger/console.js +176 -22
  26. package/dist/logger/create-logger.cjs +25 -12
  27. package/dist/logger/create-logger.js +24 -11
  28. package/dist/logger/format-timestamp.cjs +4 -4
  29. package/dist/logger/format-timestamp.js +3 -3
  30. package/dist/logger/get-log-level.cjs +60 -7
  31. package/dist/logger/get-log-level.js +59 -6
  32. package/dist/logger/index.cjs +7 -61
  33. package/dist/logger/index.js +7 -61
  34. package/dist/logger/is-unicode-supported.cjs +10 -4
  35. package/dist/logger/is-unicode-supported.js +9 -3
  36. package/dist/types.cjs +25 -5
  37. package/dist/types.js +24 -4
  38. package/dist/utilities/apply-workspace-tokens.cjs +72 -9
  39. package/dist/utilities/apply-workspace-tokens.js +71 -8
  40. package/dist/utilities/colors.cjs +76 -7
  41. package/dist/utilities/colors.js +75 -6
  42. package/dist/utilities/correct-paths.cjs +231 -32
  43. package/dist/utilities/correct-paths.js +215 -16
  44. package/dist/utilities/file-path-utils.cjs +29 -7
  45. package/dist/utilities/file-path-utils.js +28 -6
  46. package/dist/utilities/find-up.cjs +21 -4
  47. package/dist/utilities/find-up.js +20 -3
  48. package/dist/utilities/find-workspace-root.cjs +74 -7
  49. package/dist/utilities/find-workspace-root.js +73 -6
  50. package/dist/utilities/get-default-config.cjs +90 -6
  51. package/dist/utilities/get-default-config.js +90 -6
  52. package/dist/utilities/index.cjs +9 -109
  53. package/dist/utilities/index.js +9 -109
  54. package/dist/utilities/process-handler.cjs +46 -11
  55. package/dist/utilities/process-handler.js +47 -12
  56. package/dist/utilities/run.cjs +34 -6
  57. package/dist/utilities/run.js +33 -5
  58. package/dist/utilities/toml.cjs +42 -24
  59. package/dist/utilities/toml.js +35 -17
  60. package/package.json +4 -4
  61. package/dist/chunk-24B36RDB.cjs +0 -81
  62. package/dist/chunk-27N3QEX5.js +0 -40
  63. package/dist/chunk-2AVLCXLT.js +0 -0
  64. package/dist/chunk-2RLMTBVZ.js +0 -233
  65. package/dist/chunk-2WBD2G3E.cjs +0 -38
  66. package/dist/chunk-3COHMHPU.cjs +0 -1
  67. package/dist/chunk-4Q45WJYQ.js +0 -165
  68. package/dist/chunk-5C7PIENF.js +0 -92
  69. package/dist/chunk-5J2SS4QU.js +0 -83
  70. package/dist/chunk-65SWKEHV.cjs +0 -1
  71. package/dist/chunk-6Y623TCS.cjs +0 -40
  72. package/dist/chunk-7PV6L7I7.cjs +0 -1
  73. package/dist/chunk-7QBTVNMR.cjs +0 -30
  74. package/dist/chunk-BDATZ3UB.cjs +0 -233
  75. package/dist/chunk-BZRTSWH4.cjs +0 -395
  76. package/dist/chunk-D3FRXXDE.js +0 -947
  77. package/dist/chunk-DTGT4OI3.cjs +0 -14
  78. package/dist/chunk-EC2KPWRG.cjs +0 -24
  79. package/dist/chunk-EENQN6N2.js +0 -40
  80. package/dist/chunk-ENI4UUSK.cjs +0 -35
  81. package/dist/chunk-FJNXECWU.js +0 -395
  82. package/dist/chunk-FMDVBSP6.cjs +0 -83
  83. package/dist/chunk-G2MK47WL.js +0 -14
  84. package/dist/chunk-HFS7WJVW.js +0 -81
  85. package/dist/chunk-HVVJHTFS.js +0 -36
  86. package/dist/chunk-IWD6YQKX.cjs +0 -1
  87. package/dist/chunk-IWQRXQ4N.cjs +0 -84
  88. package/dist/chunk-JK4TT5IV.js +0 -35
  89. package/dist/chunk-JWLDCEBZ.cjs +0 -70
  90. package/dist/chunk-JZAYHDV3.js +0 -8
  91. package/dist/chunk-KSMN3HSC.js +0 -38
  92. package/dist/chunk-L6UNTUC4.js +0 -0
  93. package/dist/chunk-LOY6ICHZ.cjs +0 -36
  94. package/dist/chunk-MBG2FTBL.cjs +0 -47
  95. package/dist/chunk-MQG74XF7.js +0 -102
  96. package/dist/chunk-MSAQEGBK.cjs +0 -92
  97. package/dist/chunk-NJFLUTGH.cjs +0 -25
  98. package/dist/chunk-PCYB64MB.cjs +0 -40
  99. package/dist/chunk-RALMUN5C.js +0 -30
  100. package/dist/chunk-RRKB32OH.js +0 -0
  101. package/dist/chunk-RUKM6FCF.js +0 -25
  102. package/dist/chunk-SIW7AXUG.js +0 -56
  103. package/dist/chunk-SLICWTO2.cjs +0 -165
  104. package/dist/chunk-SO3FWVXC.js +0 -84
  105. package/dist/chunk-SXPH7ILL.js +0 -70
  106. package/dist/chunk-T7YISGRS.cjs +0 -102
  107. package/dist/chunk-TZZRLM5J.cjs +0 -947
  108. package/dist/chunk-UJ77IBHD.cjs +0 -233
  109. package/dist/chunk-UKGRDKIH.js +0 -0
  110. package/dist/chunk-V3GMJ4TX.js +0 -233
  111. package/dist/chunk-WQJYIPSL.cjs +0 -8
  112. package/dist/chunk-YBVOKYAM.cjs +0 -56
  113. package/dist/chunk-YX4736HU.js +0 -47
  114. package/dist/chunk-ZFNAUMQS.js +0 -24
@@ -1,36 +0,0 @@
1
- // src/logger/chalk.ts
2
- import chalk from "chalk";
3
- var chalkDefault = {
4
- hex: (_) => (message) => message,
5
- bgHex: (_) => ({
6
- whiteBright: (message) => message,
7
- white: (message) => message
8
- }),
9
- white: (message) => message,
10
- whiteBright: (message) => message,
11
- gray: (message) => message,
12
- bold: {
13
- hex: (_) => (message) => message,
14
- bgHex: (_) => ({
15
- whiteBright: (message) => message,
16
- white: (message) => message
17
- }),
18
- whiteBright: (message) => message,
19
- white: (message) => message
20
- },
21
- dim: {
22
- hex: (_) => (message) => message,
23
- gray: (message) => message
24
- }
25
- };
26
- var getChalk = () => {
27
- let _chalk = chalk;
28
- if (!_chalk?.hex || !_chalk?.bold?.hex || !_chalk?.bgHex || !_chalk?.whiteBright || !_chalk?.white) {
29
- _chalk = chalkDefault;
30
- }
31
- return _chalk;
32
- };
33
-
34
- export {
35
- getChalk
36
- };
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,84 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
-
3
- var _chunkNJFLUTGHcjs = require('./chunk-NJFLUTGH.cjs');
4
-
5
-
6
- var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
7
-
8
- // src/utilities/find-workspace-root.ts
9
- var rootFiles = [
10
- "storm-workspace.json",
11
- "storm-workspace.yaml",
12
- "storm-workspace.yml",
13
- "storm-workspace.js",
14
- "storm-workspace.ts",
15
- ".storm-workspace.json",
16
- ".storm-workspace.yaml",
17
- ".storm-workspace.yml",
18
- ".storm-workspace.js",
19
- ".storm-workspace.ts",
20
- "lerna.json",
21
- "nx.json",
22
- "turbo.json",
23
- "npm-workspace.json",
24
- "yarn-workspace.json",
25
- "pnpm-workspace.json",
26
- "npm-workspace.yaml",
27
- "yarn-workspace.yaml",
28
- "pnpm-workspace.yaml",
29
- "npm-workspace.yml",
30
- "yarn-workspace.yml",
31
- "pnpm-workspace.yml",
32
- "npm-lock.json",
33
- "yarn-lock.json",
34
- "pnpm-lock.json",
35
- "npm-lock.yaml",
36
- "yarn-lock.yaml",
37
- "pnpm-lock.yaml",
38
- "npm-lock.yml",
39
- "yarn-lock.yml",
40
- "pnpm-lock.yml",
41
- "bun.lockb",
42
- "bun.lock",
43
- "bunfig.toml"
44
- ];
45
- var rootDirectories = [
46
- ".storm-workspace",
47
- ".nx",
48
- ".git",
49
- ".github",
50
- ".vscode",
51
- ".verdaccio"
52
- ];
53
- function findWorkspaceRootSafe(pathInsideMonorepo) {
54
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
55
- return _chunkBDATZ3UBcjs.correctPaths.call(void 0,
56
- _nullishCoalesce(process.env.STORM_WORKSPACE_ROOT, () => ( process.env.NX_WORKSPACE_ROOT_PATH))
57
- );
58
- }
59
- return _chunkBDATZ3UBcjs.correctPaths.call(void 0,
60
- _chunkNJFLUTGHcjs.findFolderUp.call(void 0,
61
- _nullishCoalesce(pathInsideMonorepo, () => ( process.cwd())),
62
- rootFiles,
63
- rootDirectories
64
- )
65
- );
66
- }
67
- function findWorkspaceRoot(pathInsideMonorepo) {
68
- const result = findWorkspaceRootSafe(pathInsideMonorepo);
69
- if (!result) {
70
- throw new Error(
71
- `Cannot find workspace root upwards from known path. Files search list includes:
72
- ${rootFiles.join(
73
- "\n"
74
- )}
75
- Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
76
- );
77
- }
78
- return result;
79
- }
80
-
81
-
82
-
83
-
84
- exports.findWorkspaceRootSafe = findWorkspaceRootSafe; exports.findWorkspaceRoot = findWorkspaceRoot;
@@ -1,35 +0,0 @@
1
- import {
2
- getLogFn,
3
- getStopwatch
4
- } from "./chunk-D3FRXXDE.js";
5
- import {
6
- LogLevel
7
- } from "./chunk-RALMUN5C.js";
8
-
9
- // src/logger/create-logger.ts
10
- import chalk from "chalk";
11
- async function createLogger(config) {
12
- const writeFatal = getLogFn(LogLevel.FATAL, config, { chalk });
13
- const writeError = getLogFn(LogLevel.ERROR, config, { chalk });
14
- const writeWarning = getLogFn(LogLevel.WARN, config, { chalk });
15
- const writeInfo = getLogFn(LogLevel.INFO, config, { chalk });
16
- const writeSuccess = getLogFn(LogLevel.SUCCESS, config, { chalk });
17
- const writeDebug = getLogFn(LogLevel.DEBUG, config, { chalk });
18
- const writePerformance = getLogFn(LogLevel.PERFORMANCE, config, { chalk });
19
- const writeTrace = getLogFn(LogLevel.TRACE, config, { chalk });
20
- return {
21
- fatal: writeFatal,
22
- error: writeError,
23
- warning: writeWarning,
24
- info: writeInfo,
25
- success: writeSuccess,
26
- performance: writePerformance,
27
- debug: writeDebug,
28
- trace: writeTrace,
29
- getStopwatch
30
- };
31
- }
32
-
33
- export {
34
- createLogger
35
- };
@@ -1,70 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _chunk7QBTVNMRcjs = require('./chunk-7QBTVNMR.cjs');
5
-
6
- // src/logger/get-log-level.ts
7
- var getLogLevel = (label) => {
8
- switch (label) {
9
- case "all":
10
- return _chunk7QBTVNMRcjs.LogLevel.ALL;
11
- case "trace":
12
- return _chunk7QBTVNMRcjs.LogLevel.TRACE;
13
- case "debug":
14
- return _chunk7QBTVNMRcjs.LogLevel.DEBUG;
15
- case "performance":
16
- return _chunk7QBTVNMRcjs.LogLevel.PERFORMANCE;
17
- case "info":
18
- return _chunk7QBTVNMRcjs.LogLevel.INFO;
19
- case "warn":
20
- return _chunk7QBTVNMRcjs.LogLevel.WARN;
21
- case "error":
22
- return _chunk7QBTVNMRcjs.LogLevel.ERROR;
23
- case "fatal":
24
- return _chunk7QBTVNMRcjs.LogLevel.FATAL;
25
- case "silent":
26
- return _chunk7QBTVNMRcjs.LogLevel.SILENT;
27
- default:
28
- return _chunk7QBTVNMRcjs.LogLevel.INFO;
29
- }
30
- };
31
- var getLogLevelLabel = (logLevel = _chunk7QBTVNMRcjs.LogLevel.INFO) => {
32
- if (logLevel >= _chunk7QBTVNMRcjs.LogLevel.ALL) {
33
- return _chunk7QBTVNMRcjs.LogLevelLabel.ALL;
34
- }
35
- if (logLevel >= _chunk7QBTVNMRcjs.LogLevel.TRACE) {
36
- return _chunk7QBTVNMRcjs.LogLevelLabel.TRACE;
37
- }
38
- if (logLevel >= _chunk7QBTVNMRcjs.LogLevel.DEBUG) {
39
- return _chunk7QBTVNMRcjs.LogLevelLabel.DEBUG;
40
- }
41
- if (logLevel >= _chunk7QBTVNMRcjs.LogLevel.PERFORMANCE) {
42
- return _chunk7QBTVNMRcjs.LogLevelLabel.PERFORMANCE;
43
- }
44
- if (logLevel >= _chunk7QBTVNMRcjs.LogLevel.INFO) {
45
- return _chunk7QBTVNMRcjs.LogLevelLabel.INFO;
46
- }
47
- if (logLevel >= _chunk7QBTVNMRcjs.LogLevel.WARN) {
48
- return _chunk7QBTVNMRcjs.LogLevelLabel.WARN;
49
- }
50
- if (logLevel >= _chunk7QBTVNMRcjs.LogLevel.ERROR) {
51
- return _chunk7QBTVNMRcjs.LogLevelLabel.ERROR;
52
- }
53
- if (logLevel >= _chunk7QBTVNMRcjs.LogLevel.FATAL) {
54
- return _chunk7QBTVNMRcjs.LogLevelLabel.FATAL;
55
- }
56
- if (logLevel <= _chunk7QBTVNMRcjs.LogLevel.SILENT) {
57
- return _chunk7QBTVNMRcjs.LogLevelLabel.SILENT;
58
- }
59
- return _chunk7QBTVNMRcjs.LogLevelLabel.INFO;
60
- };
61
- var isVerbose = (label = _chunk7QBTVNMRcjs.LogLevelLabel.SILENT) => {
62
- const logLevel = typeof label === "string" ? getLogLevel(label) : label;
63
- return logLevel >= _chunk7QBTVNMRcjs.LogLevel.DEBUG;
64
- };
65
-
66
-
67
-
68
-
69
-
70
- exports.getLogLevel = getLogLevel; exports.getLogLevelLabel = getLogLevelLabel; exports.isVerbose = isVerbose;
@@ -1,8 +0,0 @@
1
- // src/logger/format-timestamp.ts
2
- var formatTimestamp = (fullDateTime = false, date = /* @__PURE__ */ new Date()) => {
3
- return fullDateTime ? `${date.toLocaleDateString()} ${date.toLocaleTimeString()}` : `${date.toLocaleTimeString()}`;
4
- };
5
-
6
- export {
7
- formatTimestamp
8
- };
@@ -1,38 +0,0 @@
1
- import {
2
- normalizeWindowsPath
3
- } from "./chunk-V3GMJ4TX.js";
4
-
5
- // src/utilities/file-path-utils.ts
6
- var removeExtension = (filePath) => {
7
- const result = !filePath || (filePath?.match(/./g) || []).length <= 1 ? "." : filePath.lastIndexOf(".") ? filePath.substring(0, filePath.lastIndexOf(".")) : filePath;
8
- if (result.startsWith("./")) {
9
- return result.substring(2);
10
- }
11
- if (result.startsWith(".") || result.startsWith("/")) {
12
- return result.substring(1);
13
- }
14
- return result;
15
- };
16
- function findFileName(filePath, { requireExtension, withExtension } = {}) {
17
- const result = normalizeWindowsPath(filePath)?.split(filePath?.includes("\\") ? "\\" : "/")?.pop() ?? "";
18
- if (requireExtension === true && !result.includes(".")) {
19
- return "";
20
- }
21
- if (withExtension === false && result.includes(".")) {
22
- return result.split(".").slice(-1).join(".") || "";
23
- }
24
- return result;
25
- }
26
- function findFilePath(filePath) {
27
- const normalizedPath = normalizeWindowsPath(filePath);
28
- return normalizedPath.replace(
29
- findFileName(normalizedPath, { requireExtension: true }),
30
- ""
31
- );
32
- }
33
-
34
- export {
35
- removeExtension,
36
- findFileName,
37
- findFilePath
38
- };
File without changes
@@ -1,36 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; }// src/logger/chalk.ts
2
- var _chalk2 = require('chalk'); var _chalk3 = _interopRequireDefault(_chalk2);
3
- var chalkDefault = {
4
- hex: (_) => (message) => message,
5
- bgHex: (_) => ({
6
- whiteBright: (message) => message,
7
- white: (message) => message
8
- }),
9
- white: (message) => message,
10
- whiteBright: (message) => message,
11
- gray: (message) => message,
12
- bold: {
13
- hex: (_) => (message) => message,
14
- bgHex: (_) => ({
15
- whiteBright: (message) => message,
16
- white: (message) => message
17
- }),
18
- whiteBright: (message) => message,
19
- white: (message) => message
20
- },
21
- dim: {
22
- hex: (_) => (message) => message,
23
- gray: (message) => message
24
- }
25
- };
26
- var getChalk = () => {
27
- let _chalk = _chalk3.default;
28
- if (!_optionalChain([_chalk, 'optionalAccess', _2 => _2.hex]) || !_optionalChain([_chalk, 'optionalAccess', _3 => _3.bold, 'optionalAccess', _4 => _4.hex]) || !_optionalChain([_chalk, 'optionalAccess', _5 => _5.bgHex]) || !_optionalChain([_chalk, 'optionalAccess', _6 => _6.whiteBright]) || !_optionalChain([_chalk, 'optionalAccess', _7 => _7.white])) {
29
- _chalk = chalkDefault;
30
- }
31
- return _chalk;
32
- };
33
-
34
-
35
-
36
- exports.getChalk = getChalk;
@@ -1,47 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; }
2
-
3
- var _chunkTZZRLM5Jcjs = require('./chunk-TZZRLM5J.cjs');
4
-
5
- // src/utilities/toml.ts
6
- var _jtoml = require('@ltd/j-toml'); var _jtoml2 = _interopRequireDefault(_jtoml);
7
- function parseCargoTomlWithTree(tree, projectRoot, projectName) {
8
- const cargoTomlString = _optionalChain([tree, 'access', _ => _.read, 'call', _2 => _2(`${projectRoot}/Cargo.toml`), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
9
- if (!cargoTomlString) {
10
- _chunkTZZRLM5Jcjs.writeError.call(void 0, `Cannot find a Cargo.toml file in the ${projectName}`);
11
- throw new Error();
12
- }
13
- return parseCargoToml(cargoTomlString);
14
- }
15
- function parseCargoToml(cargoString) {
16
- if (!cargoString) {
17
- throw new Error("Cargo.toml is empty");
18
- }
19
- return _jtoml2.default.parse(cargoString, {
20
- x: { comment: true }
21
- });
22
- }
23
- function stringifyCargoToml(cargoToml) {
24
- const tomlString = _jtoml2.default.stringify(cargoToml, {
25
- newlineAround: "section"
26
- });
27
- if (Array.isArray(tomlString)) {
28
- return tomlString.join("\n");
29
- }
30
- return tomlString;
31
- }
32
- function modifyCargoTable(toml, section, key, value) {
33
- toml[section] ??= _jtoml2.default.Section({});
34
- toml[section][key] = typeof value === "object" && !Array.isArray(value) ? _jtoml2.default.inline(value) : typeof value === "function" ? value() : value;
35
- }
36
- function modifyCargoNestedTable(toml, section, key, value) {
37
- toml[section] ??= {};
38
- toml[section][key] = _jtoml2.default.Section(value);
39
- }
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
- exports.parseCargoTomlWithTree = parseCargoTomlWithTree; exports.parseCargoToml = parseCargoToml; exports.stringifyCargoToml = stringifyCargoToml; exports.modifyCargoTable = modifyCargoTable; exports.modifyCargoNestedTable = modifyCargoNestedTable;
@@ -1,102 +0,0 @@
1
- import {
2
- findWorkspaceRoot
3
- } from "./chunk-SO3FWVXC.js";
4
- import {
5
- joinPaths
6
- } from "./chunk-V3GMJ4TX.js";
7
-
8
- // src/utilities/get-default-config.ts
9
- import {
10
- STORM_DEFAULT_ERROR_CODES_FILE,
11
- STORM_DEFAULT_LICENSE
12
- } from "@storm-software/config";
13
- import { existsSync } from "node:fs";
14
- import { readFile } from "node:fs/promises";
15
- import { join } from "node:path";
16
- async function getPackageJsonConfig(root) {
17
- let license = STORM_DEFAULT_LICENSE;
18
- let homepage = void 0;
19
- let support = void 0;
20
- let name = void 0;
21
- let namespace = void 0;
22
- let repository = void 0;
23
- const workspaceRoot = findWorkspaceRoot(root);
24
- if (existsSync(join(workspaceRoot, "package.json"))) {
25
- const file = await readFile(
26
- joinPaths(workspaceRoot, "package.json"),
27
- "utf8"
28
- );
29
- if (file) {
30
- const packageJson = JSON.parse(file);
31
- if (packageJson.name) {
32
- name = packageJson.name;
33
- }
34
- if (packageJson.namespace) {
35
- namespace = packageJson.namespace;
36
- }
37
- if (packageJson.repository) {
38
- if (typeof packageJson.repository === "string") {
39
- repository = packageJson.repository;
40
- } else if (packageJson.repository.url) {
41
- repository = packageJson.repository.url;
42
- }
43
- }
44
- if (packageJson.license) {
45
- license = packageJson.license;
46
- }
47
- if (packageJson.homepage) {
48
- homepage = packageJson.homepage;
49
- }
50
- if (packageJson.bugs) {
51
- if (typeof packageJson.bugs === "string") {
52
- support = packageJson.bugs;
53
- } else if (packageJson.bugs.url) {
54
- support = packageJson.bugs.url;
55
- }
56
- }
57
- }
58
- }
59
- return {
60
- workspaceRoot,
61
- name,
62
- namespace,
63
- repository,
64
- license,
65
- homepage,
66
- support
67
- };
68
- }
69
- function applyDefaultConfig(config) {
70
- if (!config.support && config.contact) {
71
- config.support = config.contact;
72
- }
73
- if (!config.contact && config.support) {
74
- config.contact = config.support;
75
- }
76
- if (config.homepage) {
77
- if (!config.docs) {
78
- config.docs = `${config.homepage}/docs`;
79
- }
80
- if (!config.license) {
81
- config.license = `${config.homepage}/license`;
82
- }
83
- if (!config.support) {
84
- config.support = `${config.homepage}/support`;
85
- }
86
- if (!config.contact) {
87
- config.contact = `${config.homepage}/contact`;
88
- }
89
- if (!config.error?.codesFile || !config?.error?.url) {
90
- config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
91
- if (config.homepage) {
92
- config.error.url ??= `${config.homepage}/errors`;
93
- }
94
- }
95
- }
96
- return config;
97
- }
98
-
99
- export {
100
- getPackageJsonConfig,
101
- applyDefaultConfig
102
- };
@@ -1,92 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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; }
2
-
3
- var _chunkIWQRXQ4Ncjs = require('./chunk-IWQRXQ4N.cjs');
4
-
5
-
6
- var _chunkTZZRLM5Jcjs = require('./chunk-TZZRLM5J.cjs');
7
-
8
-
9
- var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
10
-
11
- // src/config-file/get-config-file.ts
12
- var _c12 = require('c12');
13
- var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
14
- var getConfigFileByName = async (fileName, filePath, options = {}) => {
15
- const workspacePath = filePath || _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, filePath);
16
- const configs = await Promise.all([
17
- _c12.loadConfig.call(void 0, {
18
- cwd: workspacePath,
19
- packageJson: true,
20
- name: fileName,
21
- envName: _optionalChain([fileName, 'optionalAccess', _ => _.toUpperCase, 'call', _2 => _2()]),
22
- jitiOptions: {
23
- debug: false,
24
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkBDATZ3UBcjs.joinPaths.call(void 0,
25
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
26
- "jiti"
27
- )
28
- },
29
- ...options
30
- }),
31
- _c12.loadConfig.call(void 0, {
32
- cwd: workspacePath,
33
- packageJson: true,
34
- name: fileName,
35
- envName: _optionalChain([fileName, 'optionalAccess', _3 => _3.toUpperCase, 'call', _4 => _4()]),
36
- jitiOptions: {
37
- debug: false,
38
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkBDATZ3UBcjs.joinPaths.call(void 0,
39
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
40
- "jiti"
41
- )
42
- },
43
- configFile: fileName,
44
- ...options
45
- })
46
- ]);
47
- return _defu2.default.call(void 0, _nullishCoalesce(configs[0], () => ( {})), _nullishCoalesce(configs[1], () => ( {})));
48
- };
49
- var getConfigFile = async (filePath, additionalFileNames = []) => {
50
- const workspacePath = filePath ? filePath : _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, filePath);
51
- const result = await getConfigFileByName("storm-workspace", workspacePath);
52
- let config = result.config;
53
- const configFile = result.configFile;
54
- if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
55
- _chunkTZZRLM5Jcjs.writeTrace.call(void 0,
56
- `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
57
- {
58
- logLevel: "all"
59
- }
60
- );
61
- }
62
- if (additionalFileNames && additionalFileNames.length > 0) {
63
- const results = await Promise.all(
64
- additionalFileNames.map(
65
- (fileName) => getConfigFileByName(fileName, workspacePath)
66
- )
67
- );
68
- for (const result2 of results) {
69
- if (_optionalChain([result2, 'optionalAccess', _5 => _5.config]) && _optionalChain([result2, 'optionalAccess', _6 => _6.configFile]) && Object.keys(result2.config).length > 0) {
70
- if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
71
- _chunkTZZRLM5Jcjs.writeTrace.call(void 0,
72
- `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
73
- {
74
- logLevel: "all"
75
- }
76
- );
77
- }
78
- config = _defu2.default.call(void 0, _nullishCoalesce(result2.config, () => ( {})), _nullishCoalesce(config, () => ( {})));
79
- }
80
- }
81
- }
82
- if (!config || Object.keys(config).length === 0) {
83
- return void 0;
84
- }
85
- config.configFile = configFile;
86
- return config;
87
- };
88
-
89
-
90
-
91
-
92
- exports.getConfigFileByName = getConfigFileByName; exports.getConfigFile = getConfigFile;
@@ -1,25 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }// src/utilities/find-up.ts
2
- var _fs = require('fs');
3
- var _path = require('path');
4
- var MAX_PATH_SEARCH_DEPTH = 30;
5
- var depth = 0;
6
- function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
7
- const _startPath = _nullishCoalesce(startPath, () => ( process.cwd()));
8
- if (endDirectoryNames.some(
9
- (endDirName) => _fs.existsSync.call(void 0, _path.join.call(void 0, _startPath, endDirName))
10
- )) {
11
- return _startPath;
12
- }
13
- if (endFileNames.some((endFileName) => _fs.existsSync.call(void 0, _path.join.call(void 0, _startPath, endFileName)))) {
14
- return _startPath;
15
- }
16
- if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
17
- const parent = _path.join.call(void 0, _startPath, "..");
18
- return findFolderUp(parent, endFileNames, endDirectoryNames);
19
- }
20
- return void 0;
21
- }
22
-
23
-
24
-
25
- exports.findFolderUp = findFolderUp;
@@ -1,40 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _chunkSLICWTO2cjs = require('./chunk-SLICWTO2.cjs');
5
-
6
-
7
- var _chunkIWQRXQ4Ncjs = require('./chunk-IWQRXQ4N.cjs');
8
-
9
- // src/get-config.ts
10
- function getConfig(workspaceRoot, skipLogs = false) {
11
- return _chunkSLICWTO2cjs.loadStormWorkspaceConfig.call(void 0, workspaceRoot, skipLogs);
12
- }
13
- function getWorkspaceConfig(skipLogs = true, options = {}) {
14
- let workspaceRoot = options.workspaceRoot;
15
- if (!workspaceRoot) {
16
- workspaceRoot = _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, options.cwd);
17
- }
18
- return getConfig(workspaceRoot, skipLogs);
19
- }
20
- async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
21
- try {
22
- let workspaceRoot = options.workspaceRoot;
23
- if (!workspaceRoot) {
24
- workspaceRoot = _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, options.cwd);
25
- }
26
- return _chunkSLICWTO2cjs.tryLoadStormWorkspaceConfig.call(void 0,
27
- workspaceRoot,
28
- skipLogs,
29
- options.useDefault
30
- );
31
- } catch (e) {
32
- return void 0;
33
- }
34
- }
35
-
36
-
37
-
38
-
39
-
40
- exports.getConfig = getConfig; exports.getWorkspaceConfig = getWorkspaceConfig; exports.tryGetWorkspaceConfig = tryGetWorkspaceConfig;
@@ -1,30 +0,0 @@
1
- // src/types.ts
2
- var LogLevel = {
3
- SILENT: 0,
4
- FATAL: 10,
5
- ERROR: 20,
6
- WARN: 30,
7
- SUCCESS: 35,
8
- INFO: 40,
9
- PERFORMANCE: 50,
10
- DEBUG: 60,
11
- TRACE: 70,
12
- ALL: 100
13
- };
14
- var LogLevelLabel = {
15
- SILENT: "silent",
16
- FATAL: "fatal",
17
- ERROR: "error",
18
- WARN: "warn",
19
- SUCCESS: "success",
20
- INFO: "info",
21
- PERFORMANCE: "performance",
22
- DEBUG: "debug",
23
- TRACE: "trace",
24
- ALL: "all"
25
- };
26
-
27
- export {
28
- LogLevel,
29
- LogLevelLabel
30
- };
File without changes