@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,83 +0,0 @@
1
- import { loadConfig } from "c12";
2
- import defu from "defu";
3
- import { writeTrace } from "../logger/console";
4
- import { joinPaths } from "../utilities";
5
- import { findWorkspaceRoot } from "../utilities/find-workspace-root";
6
- const getConfigFileByName = async (fileName, filePath, options = {}) => {
7
- const workspacePath = filePath || findWorkspaceRoot(filePath);
8
- const configs = await Promise.all([
9
- loadConfig({
10
- cwd: workspacePath,
11
- packageJson: true,
12
- name: fileName,
13
- envName: fileName?.toUpperCase(),
14
- jitiOptions: {
15
- debug: false,
16
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
17
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
18
- "jiti"
19
- )
20
- },
21
- ...options
22
- }),
23
- loadConfig({
24
- cwd: workspacePath,
25
- packageJson: true,
26
- name: fileName,
27
- envName: fileName?.toUpperCase(),
28
- jitiOptions: {
29
- debug: false,
30
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
31
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
32
- "jiti"
33
- )
34
- },
35
- configFile: fileName,
36
- ...options
37
- })
38
- ]);
39
- return defu(configs[0] ?? {}, configs[1] ?? {});
40
- };
41
- const getConfigFile = async (filePath, additionalFileNames = []) => {
42
- const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
43
- const result = await getConfigFileByName("storm-workspace", workspacePath);
44
- let config = result.config;
45
- const configFile = result.configFile;
46
- if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
47
- writeTrace(
48
- `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
49
- {
50
- logLevel: "all"
51
- }
52
- );
53
- }
54
- if (additionalFileNames && additionalFileNames.length > 0) {
55
- const results = await Promise.all(
56
- additionalFileNames.map(
57
- (fileName) => getConfigFileByName(fileName, workspacePath)
58
- )
59
- );
60
- for (const result2 of results) {
61
- if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
62
- if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
63
- writeTrace(
64
- `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
65
- {
66
- logLevel: "all"
67
- }
68
- );
69
- }
70
- config = defu(result2.config ?? {}, config ?? {});
71
- }
72
- }
73
- }
74
- if (!config || Object.keys(config).length === 0) {
75
- return void 0;
76
- }
77
- config.configFile = configFile;
78
- return config;
79
- };
80
- export {
81
- getConfigFile,
82
- getConfigFileByName
83
- };
@@ -1,3 +0,0 @@
1
- export { getConfigFile, getConfigFileByName } from './get-config-file.js';
2
- import '@storm-software/config';
3
- import 'c12';
@@ -1 +0,0 @@
1
- export * from "./get-config-file";
@@ -1,147 +0,0 @@
1
- import { workspaceConfigSchema } from "@storm-software/config/schema";
2
- import defu from "defu";
3
- import { existsSync } from "node:fs";
4
- import { getConfigFile } from "./config-file/get-config-file";
5
- import { getConfigEnv, getExtensionEnv } from "./env/get-env";
6
- import { setConfigEnv } from "./env/set-env";
7
- import { formatLogMessage, writeTrace, writeWarning } from "./logger/console";
8
- import { joinPaths } from "./utilities";
9
- import { findWorkspaceRoot } from "./utilities/find-workspace-root";
10
- import {
11
- applyDefaultConfig,
12
- getPackageJsonConfig
13
- } from "./utilities/get-default-config";
14
- const _extension_cache = /* @__PURE__ */ new WeakMap();
15
- let _static_cache = void 0;
16
- const createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
17
- let result;
18
- if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
19
- let _workspaceRoot = workspaceRoot;
20
- if (!_workspaceRoot) {
21
- _workspaceRoot = findWorkspaceRoot();
22
- }
23
- const configEnv = getConfigEnv();
24
- const configFile = await getConfigFile(_workspaceRoot);
25
- if (!configFile) {
26
- if (!skipLogs) {
27
- writeWarning(
28
- "No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
29
- { logLevel: "all" }
30
- );
31
- }
32
- if (useDefault === false) {
33
- return void 0;
34
- }
35
- }
36
- const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
37
- const configInput = defu(
38
- configEnv,
39
- configFile,
40
- defaultConfig
41
- );
42
- if (!configInput.variant) {
43
- configInput.variant = existsSync(joinPaths(_workspaceRoot, "nx.json")) || existsSync(joinPaths(_workspaceRoot, ".nx")) || existsSync(joinPaths(_workspaceRoot, "lerna.json")) || existsSync(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
44
- }
45
- try {
46
- const parseResult = await Promise.resolve(
47
- workspaceConfigSchema._zod.parse(
48
- { value: configInput, issues: [] },
49
- { async: true }
50
- )
51
- );
52
- result = applyDefaultConfig(parseResult.value);
53
- result.workspaceRoot ??= _workspaceRoot;
54
- } catch (error) {
55
- throw new Error(
56
- `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
57
-
58
- Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
59
- configInput
60
- )}`,
61
- {
62
- cause: error
63
- }
64
- );
65
- }
66
- } else {
67
- result = _static_cache.data;
68
- }
69
- if (schema && extensionName) {
70
- result.extensions = {
71
- ...result.extensions,
72
- [extensionName]: createConfigExtension(extensionName, schema)
73
- };
74
- }
75
- _static_cache = {
76
- timestamp: Date.now(),
77
- data: result
78
- };
79
- return result;
80
- };
81
- const createConfigExtension = (extensionName, schema) => {
82
- const extension_cache_key = { extensionName };
83
- if (_extension_cache.has(extension_cache_key)) {
84
- return _extension_cache.get(extension_cache_key);
85
- }
86
- let extension = getExtensionEnv(extensionName);
87
- if (schema) {
88
- extension = schema.parse(extension);
89
- }
90
- _extension_cache.set(extension_cache_key, extension);
91
- return extension;
92
- };
93
- const loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
94
- const config = await createStormWorkspaceConfig(
95
- void 0,
96
- void 0,
97
- workspaceRoot,
98
- skipLogs,
99
- true
100
- );
101
- setConfigEnv(config);
102
- if (!skipLogs && !config.skipConfigLogging) {
103
- writeTrace(
104
- `\u2699\uFE0F Using Storm Workspace configuration:
105
- ${formatLogMessage(config)}`,
106
- config
107
- );
108
- }
109
- return config;
110
- };
111
- const tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
112
- try {
113
- const config = await createStormWorkspaceConfig(
114
- void 0,
115
- void 0,
116
- workspaceRoot,
117
- skipLogs,
118
- useDefault
119
- );
120
- if (!config) {
121
- return void 0;
122
- }
123
- setConfigEnv(config);
124
- if (!skipLogs && !config.skipConfigLogging) {
125
- writeTrace(
126
- `\u2699\uFE0F Using Storm Workspace configuration:
127
- ${formatLogMessage(config)}`,
128
- config
129
- );
130
- }
131
- return config;
132
- } catch (error) {
133
- if (!skipLogs) {
134
- writeWarning(
135
- `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
136
- { logLevel: "all" }
137
- );
138
- }
139
- return void 0;
140
- }
141
- };
142
- export {
143
- createConfigExtension,
144
- createStormWorkspaceConfig,
145
- loadStormWorkspaceConfig,
146
- tryLoadStormWorkspaceConfig
147
- };
@@ -1,226 +0,0 @@
1
- import {
2
- COLOR_KEYS,
3
- STORM_DEFAULT_DOCS,
4
- STORM_DEFAULT_HOMEPAGE,
5
- STORM_DEFAULT_LICENSING
6
- } from "@storm-software/config";
7
- import { getLogLevelLabel } from "../logger/get-log-level";
8
- import { correctPaths } from "../utilities/correct-paths";
9
- const getExtensionEnv = (extensionName) => {
10
- const prefix = `STORM_EXTENSION_${extensionName.toUpperCase()}_`;
11
- return Object.keys(process.env).filter((key) => key.startsWith(prefix)).reduce((ret, key) => {
12
- const name = key.replace(prefix, "").split("_").map(
13
- (i) => i.length > 0 ? i.trim().charAt(0).toUpperCase() + i.trim().slice(1) : ""
14
- ).join("");
15
- if (name) {
16
- ret[name] = process.env[key];
17
- }
18
- return ret;
19
- }, {});
20
- };
21
- const getConfigEnv = () => {
22
- const prefix = "STORM_";
23
- let config = {
24
- extends: process.env[`${prefix}EXTENDS`] || void 0,
25
- name: process.env[`${prefix}NAME`] || void 0,
26
- variant: process.env[`${prefix}VARIANT`] || void 0,
27
- namespace: process.env[`${prefix}NAMESPACE`] || void 0,
28
- owner: process.env[`${prefix}OWNER`] || void 0,
29
- bot: {
30
- name: process.env[`${prefix}BOT_NAME`] || void 0,
31
- email: process.env[`${prefix}BOT_EMAIL`] || void 0
32
- },
33
- release: {
34
- banner: {
35
- url: process.env[`${prefix}RELEASE_BANNER_URL`] || void 0,
36
- alt: process.env[`${prefix}RELEASE_BANNER_ALT`] || void 0
37
- },
38
- header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
39
- footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
40
- },
41
- error: {
42
- codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
43
- url: process.env[`${prefix}ERROR_URL`] || void 0
44
- },
45
- socials: {
46
- twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
47
- discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
48
- telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
49
- slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
50
- medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
51
- github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
52
- },
53
- organization: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] ? process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] ? {
54
- name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
55
- description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
56
- url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
57
- logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
58
- icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
59
- } : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
60
- packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
61
- license: process.env[`${prefix}LICENSE`] || void 0,
62
- homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
63
- docs: process.env[`${prefix}DOCS`] || void 0,
64
- portal: process.env[`${prefix}PORTAL`] || void 0,
65
- licensing: process.env[`${prefix}LICENSING`] || void 0,
66
- contact: process.env[`${prefix}CONTACT`] || void 0,
67
- support: process.env[`${prefix}SUPPORT`] || void 0,
68
- timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
69
- locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
70
- configFile: process.env[`${prefix}WORKSPACE_CONFIG_FILE`] ? correctPaths(process.env[`${prefix}WORKSPACE_CONFIG_FILE`]) : void 0,
71
- workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
72
- directories: {
73
- cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
74
- data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? correctPaths(process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
75
- config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? correctPaths(process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
76
- temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? correctPaths(process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
77
- log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? correctPaths(process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
78
- build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? correctPaths(process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
79
- },
80
- skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
81
- mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
82
- // ci:
83
- // process.env[`${prefix}CI`] !== undefined
84
- // ? Boolean(
85
- // process.env[`${prefix}CI`] ??
86
- // process.env.CI ??
87
- // process.env.CONTINUOUS_INTEGRATION
88
- // )
89
- // : undefined,
90
- repository: process.env[`${prefix}REPOSITORY`] || void 0,
91
- branch: process.env[`${prefix}BRANCH`] || void 0,
92
- preid: process.env[`${prefix}PRE_ID`] || void 0,
93
- registry: {
94
- github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
95
- npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
96
- cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
97
- cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
98
- container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
99
- },
100
- logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
101
- Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
102
- ) ? getLogLevelLabel(
103
- Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
104
- ) : process.env[`${prefix}LOG_LEVEL`] : void 0,
105
- skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
106
- };
107
- const themeNames = Object.keys(process.env).filter(
108
- (envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
109
- (colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
110
- )
111
- );
112
- config.colors = themeNames.length > 0 ? themeNames.reduce(
113
- (ret, themeName) => {
114
- ret[themeName] = getThemeColorsEnv(prefix, themeName);
115
- return ret;
116
- },
117
- {}
118
- ) : getThemeColorsEnv(prefix);
119
- if (config.docs === STORM_DEFAULT_DOCS) {
120
- if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
121
- config.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/docs`;
122
- } else {
123
- config.docs = `${config.homepage}/docs`;
124
- }
125
- }
126
- if (config.licensing === STORM_DEFAULT_LICENSING) {
127
- if (config.homepage === STORM_DEFAULT_HOMEPAGE) {
128
- config.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config.name}/licensing`;
129
- } else {
130
- config.licensing = `${config.homepage}/docs`;
131
- }
132
- }
133
- const serializedConfig = process.env[`${prefix}WORKSPACE_CONFIG`];
134
- if (serializedConfig) {
135
- const parsed = JSON.parse(serializedConfig);
136
- config = {
137
- ...config,
138
- ...parsed,
139
- colors: { ...config.colors, ...parsed.colors },
140
- extensions: { ...config.extensions, ...parsed.extensions }
141
- };
142
- }
143
- return config;
144
- };
145
- const getThemeColorsEnv = (prefix, theme) => {
146
- const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
147
- return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorsEnv(prefix + themeName) : getSingleThemeColorsEnv(prefix + themeName);
148
- };
149
- const getSingleThemeColorsEnv = (prefix) => {
150
- const gradient = [];
151
- if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
152
- gradient.push(
153
- process.env[`${prefix}GRADIENT_START`],
154
- process.env[`${prefix}GRADIENT_END`]
155
- );
156
- } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
157
- let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
158
- while (process.env[`${prefix}GRADIENT_${index}`]) {
159
- gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
160
- index++;
161
- }
162
- }
163
- return {
164
- dark: process.env[`${prefix}DARK`],
165
- light: process.env[`${prefix}LIGHT`],
166
- brand: process.env[`${prefix}BRAND`],
167
- alternate: process.env[`${prefix}ALTERNATE`],
168
- accent: process.env[`${prefix}ACCENT`],
169
- link: process.env[`${prefix}LINK`],
170
- discovery: process.env[`${prefix}DISCOVERY`],
171
- success: process.env[`${prefix}SUCCESS`],
172
- info: process.env[`${prefix}INFO`],
173
- debug: process.env[`${prefix}DEBUG`],
174
- warning: process.env[`${prefix}WARNING`],
175
- danger: process.env[`${prefix}DANGER`],
176
- fatal: process.env[`${prefix}FATAL`],
177
- performance: process.env[`${prefix}PERFORMANCE`],
178
- positive: process.env[`${prefix}POSITIVE`],
179
- negative: process.env[`${prefix}NEGATIVE`],
180
- gradient
181
- };
182
- };
183
- const getMultiThemeColorsEnv = (prefix) => {
184
- return {
185
- light: getBaseThemeColorsEnv(`${prefix}_LIGHT_`),
186
- dark: getBaseThemeColorsEnv(`${prefix}_DARK_`)
187
- };
188
- };
189
- const getBaseThemeColorsEnv = (prefix) => {
190
- const gradient = [];
191
- if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
192
- gradient.push(
193
- process.env[`${prefix}GRADIENT_START`],
194
- process.env[`${prefix}GRADIENT_END`]
195
- );
196
- } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
197
- let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
198
- while (process.env[`${prefix}GRADIENT_${index}`]) {
199
- gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
200
- index++;
201
- }
202
- }
203
- return {
204
- foreground: process.env[`${prefix}FOREGROUND`],
205
- background: process.env[`${prefix}BACKGROUND`],
206
- brand: process.env[`${prefix}BRAND`],
207
- alternate: process.env[`${prefix}ALTERNATE`],
208
- accent: process.env[`${prefix}ACCENT`],
209
- link: process.env[`${prefix}LINK`],
210
- discovery: process.env[`${prefix}DISCOVERY`],
211
- success: process.env[`${prefix}SUCCESS`],
212
- info: process.env[`${prefix}INFO`],
213
- debug: process.env[`${prefix}DEBUG`],
214
- warning: process.env[`${prefix}WARNING`],
215
- danger: process.env[`${prefix}DANGER`],
216
- fatal: process.env[`${prefix}FATAL`],
217
- performance: process.env[`${prefix}PERFORMANCE`],
218
- positive: process.env[`${prefix}POSITIVE`],
219
- negative: process.env[`${prefix}NEGATIVE`],
220
- gradient
221
- };
222
- };
223
- export {
224
- getConfigEnv,
225
- getExtensionEnv
226
- };
@@ -1,4 +0,0 @@
1
- export { getConfigEnv, getExtensionEnv } from './get-env.js';
2
- export { setConfigEnv, setExtensionEnv } from './set-env.js';
3
- import '@storm-software/config';
4
- import '../types.js';
package/dist/env/index.js DELETED
@@ -1,2 +0,0 @@
1
- export * from "./get-env";
2
- export * from "./set-env";