@storm-software/config-tools 1.5.13 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/declarations.d.ts +29 -1
- package/index.cjs +66 -59
- package/index.js +64 -59
- package/meta.cjs.json +1 -1
- package/meta.esm.json +1 -1
- package/package.json +1 -1
- package/utilities/find-workspace-root.cjs +9 -4
- package/utilities/find-workspace-root.js +7 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [1.5.14](https://github.com/storm-software/storm-ops/compare/config-tools-v1.5.13...config-tools-v1.5.14) (2023-12-21)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **config-tools:** Update declaration types ([8ca8850](https://github.com/storm-software/storm-ops/commit/8ca8850c5ba1d92e7bc3fa273f332cf8c1acce18))
|
|
7
|
+
|
|
8
|
+
## [1.5.13](https://github.com/storm-software/storm-ops/compare/config-tools-v1.5.12...config-tools-v1.5.13) (2023-12-21)
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
### Bug Fixes
|
|
12
|
+
|
|
13
|
+
* **config-tools:** Add workspace root parameter to config creator ([a22f0fb](https://github.com/storm-software/storm-ops/commit/a22f0fb10970bf49c4ab384ef9a4e8988ef6f372))
|
|
14
|
+
|
|
1
15
|
## [1.5.12](https://github.com/storm-software/storm-ops/compare/config-tools-v1.5.11...config-tools-v1.5.12) (2023-12-21)
|
|
2
16
|
|
|
3
17
|
|
package/declarations.d.ts
CHANGED
|
@@ -17,6 +17,33 @@ declare type StormConfig<
|
|
|
17
17
|
};
|
|
18
18
|
export { StormConfig };
|
|
19
19
|
|
|
20
|
+
/**
|
|
21
|
+
* Find the root of the current monorepo
|
|
22
|
+
*
|
|
23
|
+
* @param pathInsideMonorepo - The path inside the monorepo
|
|
24
|
+
*/
|
|
25
|
+
declare function findWorkspaceRoot(pathInsideMonorepo?: string): string;
|
|
26
|
+
export { findWorkspaceRoot };
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Find the root of the current monorepo safely (do not throw an error if it cannot be found)
|
|
30
|
+
*
|
|
31
|
+
* @param pathInsideMonorepo - The path inside the monorepo
|
|
32
|
+
*/
|
|
33
|
+
declare function findWorkspaceRootSafe(
|
|
34
|
+
pathInsideMonorepo?: string
|
|
35
|
+
): string | undefined;
|
|
36
|
+
export { findWorkspaceRootSafe };
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Type-check to determine if `obj` is a `StormError` object
|
|
40
|
+
*
|
|
41
|
+
* @param value - the object to check
|
|
42
|
+
* @returns The function isStormError is returning a boolean value.
|
|
43
|
+
*/
|
|
44
|
+
declare function createConfig(workspaceRoot?: string): StormConfig;
|
|
45
|
+
export { createConfig };
|
|
46
|
+
|
|
20
47
|
/**
|
|
21
48
|
* Type-check to determine if `obj` is a `StormError` object
|
|
22
49
|
*
|
|
@@ -30,6 +57,7 @@ declare function createStormConfig<
|
|
|
30
57
|
TExtensionSchema extends z.ZodTypeAny = z.ZodTypeAny
|
|
31
58
|
>(
|
|
32
59
|
extensionName?: TExtensionName,
|
|
33
|
-
schema?: TExtensionSchema
|
|
60
|
+
schema?: TExtensionSchema,
|
|
61
|
+
workspaceRoot?: string
|
|
34
62
|
): StormConfig<TExtensionName, TExtensionConfig>;
|
|
35
63
|
export { createStormConfig };
|
package/index.cjs
CHANGED
|
@@ -38,6 +38,8 @@ __export(src_exports, {
|
|
|
38
38
|
createConfig: () => createConfig,
|
|
39
39
|
createConfigExtension: () => createConfigExtension,
|
|
40
40
|
createStormConfig: () => createStormConfig,
|
|
41
|
+
findWorkspaceRoot: () => findWorkspaceRoot,
|
|
42
|
+
findWorkspaceRootSafe: () => findWorkspaceRootSafe,
|
|
41
43
|
getConfigEnv: () => getConfigEnv,
|
|
42
44
|
getConfigFile: () => getConfigFile,
|
|
43
45
|
getDefaultConfig: () => getDefaultConfig,
|
|
@@ -106,63 +108,6 @@ var LogLevelLabel = {
|
|
|
106
108
|
TRACE: "trace"
|
|
107
109
|
};
|
|
108
110
|
|
|
109
|
-
// packages/config-tools/src/utilities/get-default-config.ts
|
|
110
|
-
var import_fs = require("fs");
|
|
111
|
-
var import_path = require("path");
|
|
112
|
-
|
|
113
|
-
// packages/config-tools/src/schema.ts
|
|
114
|
-
var z = __toESM(require("zod"), 1);
|
|
115
|
-
var ColorConfigSchema = z.object({
|
|
116
|
-
primary: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0ea5e9").describe("The primary color of the workspace"),
|
|
117
|
-
background: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d232a").describe("The background color of the workspace"),
|
|
118
|
-
success: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#087f5b").describe("The success color of the workspace"),
|
|
119
|
-
info: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0ea5e9").describe("The informational color of the workspace"),
|
|
120
|
-
warning: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace"),
|
|
121
|
-
error: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#990000").describe("The error color of the workspace"),
|
|
122
|
-
fatal: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#7d1a1a").describe("The fatal color of the workspace")
|
|
123
|
-
}).describe("Colors used for various workspace elements");
|
|
124
|
-
var StormConfigSchema = z.object({
|
|
125
|
-
name: z.string().trim().toLowerCase().describe("The name of the package"),
|
|
126
|
-
namespace: z.string().trim().toLowerCase().default("storm-software").describe("The namespace of the package"),
|
|
127
|
-
organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
128
|
-
repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
129
|
-
license: z.string().trim().default("Apache License 2.0").describe("The root directory of the package"),
|
|
130
|
-
homepage: z.string().trim().url().default("https://stormsoftware.org").describe("The homepage of the workspace"),
|
|
131
|
-
branch: z.string().trim().default("main").describe("The branch of the workspace"),
|
|
132
|
-
preMajor: z.boolean().default(false).describe(
|
|
133
|
-
"An indicator specifying if the package is still in it's pre-major version"
|
|
134
|
-
),
|
|
135
|
-
owner: z.string().trim().default("@storm-software/development").describe("The owner of the package"),
|
|
136
|
-
worker: z.string().trim().default("stormie-bot").describe(
|
|
137
|
-
"The worker of the package (this is the bot that will be used to perform various tasks)"
|
|
138
|
-
),
|
|
139
|
-
env: z.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment of the package"),
|
|
140
|
-
ci: z.boolean().default(true).describe(
|
|
141
|
-
"An indicator specifying if the current environment is a CI environment"
|
|
142
|
-
),
|
|
143
|
-
workspaceRoot: z.string().trim().describe("The root directory of the workspace"),
|
|
144
|
-
packageDirectory: z.string().trim().optional().describe("The root directory of the package"),
|
|
145
|
-
buildDirectory: z.string().trim().default("dist").describe("The build directory for the workspace"),
|
|
146
|
-
runtimeDirectory: z.string().trim().default("node_modules/.storm").describe("The runtime directory of Storm"),
|
|
147
|
-
runtimeVersion: z.string().trim().regex(
|
|
148
|
-
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
|
|
149
|
-
).default("1.0.0").describe("The global version of the Storm runtime"),
|
|
150
|
-
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
151
|
-
locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
152
|
-
logLevel: z.enum(["silent", "fatal", "error", "warn", "info", "debug", "trace"]).optional().describe(
|
|
153
|
-
"The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
|
|
154
|
-
),
|
|
155
|
-
configFile: z.string().trim().nullable().default(null).describe(
|
|
156
|
-
"The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
|
|
157
|
-
),
|
|
158
|
-
colors: ColorConfigSchema.describe(
|
|
159
|
-
"Storm theme config values used for styling various package elements"
|
|
160
|
-
),
|
|
161
|
-
extensions: z.record(z.any()).default({}).describe("Configuration of each used extension")
|
|
162
|
-
}).describe(
|
|
163
|
-
"Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo."
|
|
164
|
-
);
|
|
165
|
-
|
|
166
111
|
// packages/config-tools/src/utilities/find-up.ts
|
|
167
112
|
var import_locate_path = require("locate-path");
|
|
168
113
|
var path = __toESM(require("path"), 1);
|
|
@@ -237,12 +182,15 @@ var rootFiles = [
|
|
|
237
182
|
"pnpm-lock.yml",
|
|
238
183
|
"bun.lockb"
|
|
239
184
|
];
|
|
240
|
-
function
|
|
241
|
-
|
|
185
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
186
|
+
return process.env.STORM_WORKSPACE_ROOT ? process.env.STORM_WORKSPACE_ROOT : process.env.NX_WORKSPACE_ROOT_PATH ? process.env.NX_WORKSPACE_ROOT_PATH : findUpSync(rootFiles, {
|
|
242
187
|
cwd: pathInsideMonorepo ?? process.cwd(),
|
|
243
188
|
type: "file",
|
|
244
189
|
limit: 1
|
|
245
190
|
});
|
|
191
|
+
}
|
|
192
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
193
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
246
194
|
if (!result) {
|
|
247
195
|
throw new Error(
|
|
248
196
|
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
@@ -255,6 +203,63 @@ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
|
255
203
|
return result;
|
|
256
204
|
}
|
|
257
205
|
|
|
206
|
+
// packages/config-tools/src/utilities/get-default-config.ts
|
|
207
|
+
var import_fs = require("fs");
|
|
208
|
+
var import_path = require("path");
|
|
209
|
+
|
|
210
|
+
// packages/config-tools/src/schema.ts
|
|
211
|
+
var z = __toESM(require("zod"), 1);
|
|
212
|
+
var ColorConfigSchema = z.object({
|
|
213
|
+
primary: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0ea5e9").describe("The primary color of the workspace"),
|
|
214
|
+
background: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d232a").describe("The background color of the workspace"),
|
|
215
|
+
success: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#087f5b").describe("The success color of the workspace"),
|
|
216
|
+
info: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0ea5e9").describe("The informational color of the workspace"),
|
|
217
|
+
warning: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace"),
|
|
218
|
+
error: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#990000").describe("The error color of the workspace"),
|
|
219
|
+
fatal: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#7d1a1a").describe("The fatal color of the workspace")
|
|
220
|
+
}).describe("Colors used for various workspace elements");
|
|
221
|
+
var StormConfigSchema = z.object({
|
|
222
|
+
name: z.string().trim().toLowerCase().describe("The name of the package"),
|
|
223
|
+
namespace: z.string().trim().toLowerCase().default("storm-software").describe("The namespace of the package"),
|
|
224
|
+
organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
225
|
+
repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
226
|
+
license: z.string().trim().default("Apache License 2.0").describe("The root directory of the package"),
|
|
227
|
+
homepage: z.string().trim().url().default("https://stormsoftware.org").describe("The homepage of the workspace"),
|
|
228
|
+
branch: z.string().trim().default("main").describe("The branch of the workspace"),
|
|
229
|
+
preMajor: z.boolean().default(false).describe(
|
|
230
|
+
"An indicator specifying if the package is still in it's pre-major version"
|
|
231
|
+
),
|
|
232
|
+
owner: z.string().trim().default("@storm-software/development").describe("The owner of the package"),
|
|
233
|
+
worker: z.string().trim().default("stormie-bot").describe(
|
|
234
|
+
"The worker of the package (this is the bot that will be used to perform various tasks)"
|
|
235
|
+
),
|
|
236
|
+
env: z.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment of the package"),
|
|
237
|
+
ci: z.boolean().default(true).describe(
|
|
238
|
+
"An indicator specifying if the current environment is a CI environment"
|
|
239
|
+
),
|
|
240
|
+
workspaceRoot: z.string().trim().describe("The root directory of the workspace"),
|
|
241
|
+
packageDirectory: z.string().trim().optional().describe("The root directory of the package"),
|
|
242
|
+
buildDirectory: z.string().trim().default("dist").describe("The build directory for the workspace"),
|
|
243
|
+
runtimeDirectory: z.string().trim().default("node_modules/.storm").describe("The runtime directory of Storm"),
|
|
244
|
+
runtimeVersion: z.string().trim().regex(
|
|
245
|
+
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
|
|
246
|
+
).default("1.0.0").describe("The global version of the Storm runtime"),
|
|
247
|
+
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
248
|
+
locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
249
|
+
logLevel: z.enum(["silent", "fatal", "error", "warn", "info", "debug", "trace"]).optional().describe(
|
|
250
|
+
"The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
|
|
251
|
+
),
|
|
252
|
+
configFile: z.string().trim().nullable().default(null).describe(
|
|
253
|
+
"The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
|
|
254
|
+
),
|
|
255
|
+
colors: ColorConfigSchema.describe(
|
|
256
|
+
"Storm theme config values used for styling various package elements"
|
|
257
|
+
),
|
|
258
|
+
extensions: z.record(z.any()).default({}).describe("Configuration of each used extension")
|
|
259
|
+
}).describe(
|
|
260
|
+
"Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo."
|
|
261
|
+
);
|
|
262
|
+
|
|
258
263
|
// packages/config-tools/src/utilities/get-default-config.ts
|
|
259
264
|
var DefaultColorConfig = {
|
|
260
265
|
primary: "#1fb2a6",
|
|
@@ -545,6 +550,8 @@ var setConfigEnv = (config) => {
|
|
|
545
550
|
createConfig,
|
|
546
551
|
createConfigExtension,
|
|
547
552
|
createStormConfig,
|
|
553
|
+
findWorkspaceRoot,
|
|
554
|
+
findWorkspaceRootSafe,
|
|
548
555
|
getConfigEnv,
|
|
549
556
|
getConfigFile,
|
|
550
557
|
getDefaultConfig,
|
package/index.js
CHANGED
|
@@ -55,63 +55,6 @@ var LogLevelLabel = {
|
|
|
55
55
|
TRACE: "trace"
|
|
56
56
|
};
|
|
57
57
|
|
|
58
|
-
// packages/config-tools/src/utilities/get-default-config.ts
|
|
59
|
-
import { existsSync, readFileSync } from "fs";
|
|
60
|
-
import { join } from "path";
|
|
61
|
-
|
|
62
|
-
// packages/config-tools/src/schema.ts
|
|
63
|
-
import * as z from "zod";
|
|
64
|
-
var ColorConfigSchema = z.object({
|
|
65
|
-
primary: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0ea5e9").describe("The primary color of the workspace"),
|
|
66
|
-
background: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d232a").describe("The background color of the workspace"),
|
|
67
|
-
success: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#087f5b").describe("The success color of the workspace"),
|
|
68
|
-
info: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0ea5e9").describe("The informational color of the workspace"),
|
|
69
|
-
warning: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace"),
|
|
70
|
-
error: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#990000").describe("The error color of the workspace"),
|
|
71
|
-
fatal: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#7d1a1a").describe("The fatal color of the workspace")
|
|
72
|
-
}).describe("Colors used for various workspace elements");
|
|
73
|
-
var StormConfigSchema = z.object({
|
|
74
|
-
name: z.string().trim().toLowerCase().describe("The name of the package"),
|
|
75
|
-
namespace: z.string().trim().toLowerCase().default("storm-software").describe("The namespace of the package"),
|
|
76
|
-
organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
77
|
-
repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
78
|
-
license: z.string().trim().default("Apache License 2.0").describe("The root directory of the package"),
|
|
79
|
-
homepage: z.string().trim().url().default("https://stormsoftware.org").describe("The homepage of the workspace"),
|
|
80
|
-
branch: z.string().trim().default("main").describe("The branch of the workspace"),
|
|
81
|
-
preMajor: z.boolean().default(false).describe(
|
|
82
|
-
"An indicator specifying if the package is still in it's pre-major version"
|
|
83
|
-
),
|
|
84
|
-
owner: z.string().trim().default("@storm-software/development").describe("The owner of the package"),
|
|
85
|
-
worker: z.string().trim().default("stormie-bot").describe(
|
|
86
|
-
"The worker of the package (this is the bot that will be used to perform various tasks)"
|
|
87
|
-
),
|
|
88
|
-
env: z.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment of the package"),
|
|
89
|
-
ci: z.boolean().default(true).describe(
|
|
90
|
-
"An indicator specifying if the current environment is a CI environment"
|
|
91
|
-
),
|
|
92
|
-
workspaceRoot: z.string().trim().describe("The root directory of the workspace"),
|
|
93
|
-
packageDirectory: z.string().trim().optional().describe("The root directory of the package"),
|
|
94
|
-
buildDirectory: z.string().trim().default("dist").describe("The build directory for the workspace"),
|
|
95
|
-
runtimeDirectory: z.string().trim().default("node_modules/.storm").describe("The runtime directory of Storm"),
|
|
96
|
-
runtimeVersion: z.string().trim().regex(
|
|
97
|
-
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
|
|
98
|
-
).default("1.0.0").describe("The global version of the Storm runtime"),
|
|
99
|
-
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
100
|
-
locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
101
|
-
logLevel: z.enum(["silent", "fatal", "error", "warn", "info", "debug", "trace"]).optional().describe(
|
|
102
|
-
"The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
|
|
103
|
-
),
|
|
104
|
-
configFile: z.string().trim().nullable().default(null).describe(
|
|
105
|
-
"The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
|
|
106
|
-
),
|
|
107
|
-
colors: ColorConfigSchema.describe(
|
|
108
|
-
"Storm theme config values used for styling various package elements"
|
|
109
|
-
),
|
|
110
|
-
extensions: z.record(z.any()).default({}).describe("Configuration of each used extension")
|
|
111
|
-
}).describe(
|
|
112
|
-
"Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo."
|
|
113
|
-
);
|
|
114
|
-
|
|
115
58
|
// packages/config-tools/src/utilities/find-up.ts
|
|
116
59
|
import { locatePath, locatePathSync } from "locate-path";
|
|
117
60
|
import * as path from "path";
|
|
@@ -186,12 +129,15 @@ var rootFiles = [
|
|
|
186
129
|
"pnpm-lock.yml",
|
|
187
130
|
"bun.lockb"
|
|
188
131
|
];
|
|
189
|
-
function
|
|
190
|
-
|
|
132
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
133
|
+
return process.env.STORM_WORKSPACE_ROOT ? process.env.STORM_WORKSPACE_ROOT : process.env.NX_WORKSPACE_ROOT_PATH ? process.env.NX_WORKSPACE_ROOT_PATH : findUpSync(rootFiles, {
|
|
191
134
|
cwd: pathInsideMonorepo ?? process.cwd(),
|
|
192
135
|
type: "file",
|
|
193
136
|
limit: 1
|
|
194
137
|
});
|
|
138
|
+
}
|
|
139
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
140
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
195
141
|
if (!result) {
|
|
196
142
|
throw new Error(
|
|
197
143
|
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
@@ -204,6 +150,63 @@ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
|
204
150
|
return result;
|
|
205
151
|
}
|
|
206
152
|
|
|
153
|
+
// packages/config-tools/src/utilities/get-default-config.ts
|
|
154
|
+
import { existsSync, readFileSync } from "fs";
|
|
155
|
+
import { join } from "path";
|
|
156
|
+
|
|
157
|
+
// packages/config-tools/src/schema.ts
|
|
158
|
+
import * as z from "zod";
|
|
159
|
+
var ColorConfigSchema = z.object({
|
|
160
|
+
primary: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0ea5e9").describe("The primary color of the workspace"),
|
|
161
|
+
background: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d232a").describe("The background color of the workspace"),
|
|
162
|
+
success: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#087f5b").describe("The success color of the workspace"),
|
|
163
|
+
info: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0ea5e9").describe("The informational color of the workspace"),
|
|
164
|
+
warning: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace"),
|
|
165
|
+
error: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#990000").describe("The error color of the workspace"),
|
|
166
|
+
fatal: z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#7d1a1a").describe("The fatal color of the workspace")
|
|
167
|
+
}).describe("Colors used for various workspace elements");
|
|
168
|
+
var StormConfigSchema = z.object({
|
|
169
|
+
name: z.string().trim().toLowerCase().describe("The name of the package"),
|
|
170
|
+
namespace: z.string().trim().toLowerCase().default("storm-software").describe("The namespace of the package"),
|
|
171
|
+
organization: z.string().trim().default("storm-software").describe("The organization of the workspace"),
|
|
172
|
+
repository: z.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
173
|
+
license: z.string().trim().default("Apache License 2.0").describe("The root directory of the package"),
|
|
174
|
+
homepage: z.string().trim().url().default("https://stormsoftware.org").describe("The homepage of the workspace"),
|
|
175
|
+
branch: z.string().trim().default("main").describe("The branch of the workspace"),
|
|
176
|
+
preMajor: z.boolean().default(false).describe(
|
|
177
|
+
"An indicator specifying if the package is still in it's pre-major version"
|
|
178
|
+
),
|
|
179
|
+
owner: z.string().trim().default("@storm-software/development").describe("The owner of the package"),
|
|
180
|
+
worker: z.string().trim().default("stormie-bot").describe(
|
|
181
|
+
"The worker of the package (this is the bot that will be used to perform various tasks)"
|
|
182
|
+
),
|
|
183
|
+
env: z.enum(["development", "staging", "production"]).default("production").describe("The current runtime environment of the package"),
|
|
184
|
+
ci: z.boolean().default(true).describe(
|
|
185
|
+
"An indicator specifying if the current environment is a CI environment"
|
|
186
|
+
),
|
|
187
|
+
workspaceRoot: z.string().trim().describe("The root directory of the workspace"),
|
|
188
|
+
packageDirectory: z.string().trim().optional().describe("The root directory of the package"),
|
|
189
|
+
buildDirectory: z.string().trim().default("dist").describe("The build directory for the workspace"),
|
|
190
|
+
runtimeDirectory: z.string().trim().default("node_modules/.storm").describe("The runtime directory of Storm"),
|
|
191
|
+
runtimeVersion: z.string().trim().regex(
|
|
192
|
+
/^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
|
|
193
|
+
).default("1.0.0").describe("The global version of the Storm runtime"),
|
|
194
|
+
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
195
|
+
locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
196
|
+
logLevel: z.enum(["silent", "fatal", "error", "warn", "info", "debug", "trace"]).optional().describe(
|
|
197
|
+
"The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."
|
|
198
|
+
),
|
|
199
|
+
configFile: z.string().trim().nullable().default(null).describe(
|
|
200
|
+
"The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
|
|
201
|
+
),
|
|
202
|
+
colors: ColorConfigSchema.describe(
|
|
203
|
+
"Storm theme config values used for styling various package elements"
|
|
204
|
+
),
|
|
205
|
+
extensions: z.record(z.any()).default({}).describe("Configuration of each used extension")
|
|
206
|
+
}).describe(
|
|
207
|
+
"Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo."
|
|
208
|
+
);
|
|
209
|
+
|
|
207
210
|
// packages/config-tools/src/utilities/get-default-config.ts
|
|
208
211
|
var DefaultColorConfig = {
|
|
209
212
|
primary: "#1fb2a6",
|
|
@@ -493,6 +496,8 @@ export {
|
|
|
493
496
|
createConfig,
|
|
494
497
|
createConfigExtension,
|
|
495
498
|
createStormConfig,
|
|
499
|
+
findWorkspaceRoot,
|
|
500
|
+
findWorkspaceRootSafe,
|
|
496
501
|
getConfigEnv,
|
|
497
502
|
getConfigFile,
|
|
498
503
|
getDefaultConfig,
|
package/meta.cjs.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/config-tools/src/config-file/get-config-file.ts":{"bytes":1987,"imports":[{"path":"cosmiconfig","kind":"import-statement","external":true},{"path":"../types","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/config-file/index.ts":{"bytes":35,"imports":[{"path":"packages/config-tools/src/config-file/get-config-file.ts","kind":"import-statement","original":"./get-config-file"}],"format":"esm"},"packages/config-tools/src/types.ts":{"bytes":1405,"imports":[{"path":"zod","kind":"import-statement","external":true},{"path":"./schema","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/
|
|
1
|
+
{"inputs":{"packages/config-tools/src/config-file/get-config-file.ts":{"bytes":1987,"imports":[{"path":"cosmiconfig","kind":"import-statement","external":true},{"path":"../types","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/config-file/index.ts":{"bytes":35,"imports":[{"path":"packages/config-tools/src/config-file/get-config-file.ts","kind":"import-statement","original":"./get-config-file"}],"format":"esm"},"packages/config-tools/src/types.ts":{"bytes":1405,"imports":[{"path":"zod","kind":"import-statement","external":true},{"path":"./schema","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/utilities/find-up.ts":{"bytes":4526,"imports":[{"path":"locate-path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"url","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/utilities/find-workspace-root.ts":{"bytes":1485,"imports":[{"path":"packages/config-tools/src/utilities/find-up.ts","kind":"import-statement","original":"./find-up"}],"format":"esm"},"packages/config-tools/src/schema.ts":{"bytes":5736,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/utilities/get-default-config.ts":{"bytes":2600,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"packages/config-tools/src/schema.ts","kind":"import-statement","original":"../schema"},{"path":"../types","kind":"import-statement","external":true},{"path":"packages/config-tools/src/utilities/find-workspace-root.ts","kind":"import-statement","original":"./find-workspace-root"}],"format":"esm"},"packages/config-tools/src/utilities/get-log-level.ts":{"bytes":1409,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/config-tools/src/utilities/index.ts":{"bytes":110,"imports":[{"path":"packages/config-tools/src/utilities/find-workspace-root.ts","kind":"import-statement","original":"./find-workspace-root"},{"path":"packages/config-tools/src/utilities/get-default-config.ts","kind":"import-statement","original":"./get-default-config"},{"path":"packages/config-tools/src/utilities/get-log-level.ts","kind":"import-statement","original":"./get-log-level"}],"format":"esm"},"packages/config-tools/src/env/get-env.ts":{"bytes":4137,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"},{"path":"packages/config-tools/src/utilities/index.ts","kind":"import-statement","original":"../utilities"}],"format":"esm"},"packages/config-tools/src/create-storm-config.ts":{"bytes":2905,"imports":[{"path":"zod","kind":"import-statement","external":true},{"path":"packages/config-tools/src/env/get-env.ts","kind":"import-statement","original":"./env/get-env"},{"path":"packages/config-tools/src/schema.ts","kind":"import-statement","original":"./schema"},{"path":"./types","kind":"import-statement","external":true},{"path":"packages/config-tools/src/utilities/get-default-config.ts","kind":"import-statement","original":"./utilities/get-default-config"}],"format":"esm"},"packages/config-tools/src/env/set-env.ts":{"bytes":4309,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"},{"path":"packages/config-tools/src/utilities/get-log-level.ts","kind":"import-statement","original":"../utilities/get-log-level"}],"format":"esm"},"packages/config-tools/src/env/index.ts":{"bytes":54,"imports":[{"path":"packages/config-tools/src/env/get-env.ts","kind":"import-statement","original":"./get-env"},{"path":"packages/config-tools/src/env/set-env.ts","kind":"import-statement","original":"./set-env"}],"format":"esm"},"packages/config-tools/src/index.ts":{"bytes":399,"imports":[{"path":"packages/config-tools/src/config-file/index.ts","kind":"import-statement","original":"./config-file"},{"path":"packages/config-tools/src/create-storm-config.ts","kind":"import-statement","original":"./create-storm-config"},{"path":"packages/config-tools/src/env/index.ts","kind":"import-statement","original":"./env"},{"path":"packages/config-tools/src/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/config-tools/src/utilities/index.ts","kind":"import-statement","original":"./utilities"}],"format":"esm"}},"outputs":{"dist/packages/config-tools/index.cjs":{"imports":[{"path":"cosmiconfig","kind":"require-call","external":true},{"path":"locate-path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"url","kind":"require-call","external":true},{"path":"fs","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"zod","kind":"require-call","external":true}],"exports":[],"entryPoint":"packages/config-tools/src/index.ts","inputs":{"packages/config-tools/src/index.ts":{"bytesInOutput":899},"packages/config-tools/src/config-file/get-config-file.ts":{"bytesInOutput":1594},"packages/config-tools/src/config-file/index.ts":{"bytesInOutput":0},"packages/config-tools/src/types.ts":{"bytesInOutput":256},"packages/config-tools/src/utilities/find-up.ts":{"bytesInOutput":1807},"packages/config-tools/src/utilities/find-workspace-root.ts":{"bytesInOutput":1159},"packages/config-tools/src/utilities/index.ts":{"bytesInOutput":0},"packages/config-tools/src/utilities/get-default-config.ts":{"bytesInOutput":2035},"packages/config-tools/src/schema.ts":{"bytesInOutput":4454},"packages/config-tools/src/utilities/get-log-level.ts":{"bytesInOutput":1029},"packages/config-tools/src/env/get-env.ts":{"bytesInOutput":3060},"packages/config-tools/src/create-storm-config.ts":{"bytesInOutput":1106},"packages/config-tools/src/env/index.ts":{"bytesInOutput":0},"packages/config-tools/src/env/set-env.ts":{"bytesInOutput":3528}},"bytes":23381},"dist/packages/config-tools/utilities/find-workspace-root.cjs":{"imports":[{"path":"locate-path","kind":"require-call","external":true},{"path":"path","kind":"require-call","external":true},{"path":"url","kind":"require-call","external":true}],"exports":[],"entryPoint":"packages/config-tools/src/utilities/find-workspace-root.ts","inputs":{"packages/config-tools/src/utilities/find-workspace-root.ts":{"bytesInOutput":1400},"packages/config-tools/src/utilities/find-up.ts":{"bytesInOutput":1807}},"bytes":4902}}}
|
package/meta.esm.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"inputs":{"packages/config-tools/src/config-file/get-config-file.ts":{"bytes":1987,"imports":[{"path":"cosmiconfig","kind":"import-statement","external":true},{"path":"../types","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/config-file/index.ts":{"bytes":35,"imports":[{"path":"packages/config-tools/src/config-file/get-config-file.ts","kind":"import-statement","original":"./get-config-file"}],"format":"esm"},"packages/config-tools/src/types.ts":{"bytes":1405,"imports":[{"path":"zod","kind":"import-statement","external":true},{"path":"./schema","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/
|
|
1
|
+
{"inputs":{"packages/config-tools/src/config-file/get-config-file.ts":{"bytes":1987,"imports":[{"path":"cosmiconfig","kind":"import-statement","external":true},{"path":"../types","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/config-file/index.ts":{"bytes":35,"imports":[{"path":"packages/config-tools/src/config-file/get-config-file.ts","kind":"import-statement","original":"./get-config-file"}],"format":"esm"},"packages/config-tools/src/types.ts":{"bytes":1405,"imports":[{"path":"zod","kind":"import-statement","external":true},{"path":"./schema","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/utilities/find-up.ts":{"bytes":4526,"imports":[{"path":"locate-path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"url","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/utilities/find-workspace-root.ts":{"bytes":1485,"imports":[{"path":"packages/config-tools/src/utilities/find-up.ts","kind":"import-statement","original":"./find-up"}],"format":"esm"},"packages/config-tools/src/schema.ts":{"bytes":5736,"imports":[{"path":"zod","kind":"import-statement","external":true}],"format":"esm"},"packages/config-tools/src/utilities/get-default-config.ts":{"bytes":2600,"imports":[{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"packages/config-tools/src/schema.ts","kind":"import-statement","original":"../schema"},{"path":"../types","kind":"import-statement","external":true},{"path":"packages/config-tools/src/utilities/find-workspace-root.ts","kind":"import-statement","original":"./find-workspace-root"}],"format":"esm"},"packages/config-tools/src/utilities/get-log-level.ts":{"bytes":1409,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"}],"format":"esm"},"packages/config-tools/src/utilities/index.ts":{"bytes":110,"imports":[{"path":"packages/config-tools/src/utilities/find-workspace-root.ts","kind":"import-statement","original":"./find-workspace-root"},{"path":"packages/config-tools/src/utilities/get-default-config.ts","kind":"import-statement","original":"./get-default-config"},{"path":"packages/config-tools/src/utilities/get-log-level.ts","kind":"import-statement","original":"./get-log-level"}],"format":"esm"},"packages/config-tools/src/env/get-env.ts":{"bytes":4137,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"},{"path":"packages/config-tools/src/utilities/index.ts","kind":"import-statement","original":"../utilities"}],"format":"esm"},"packages/config-tools/src/create-storm-config.ts":{"bytes":2905,"imports":[{"path":"zod","kind":"import-statement","external":true},{"path":"packages/config-tools/src/env/get-env.ts","kind":"import-statement","original":"./env/get-env"},{"path":"packages/config-tools/src/schema.ts","kind":"import-statement","original":"./schema"},{"path":"./types","kind":"import-statement","external":true},{"path":"packages/config-tools/src/utilities/get-default-config.ts","kind":"import-statement","original":"./utilities/get-default-config"}],"format":"esm"},"packages/config-tools/src/env/set-env.ts":{"bytes":4309,"imports":[{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"../types"},{"path":"packages/config-tools/src/utilities/get-log-level.ts","kind":"import-statement","original":"../utilities/get-log-level"}],"format":"esm"},"packages/config-tools/src/env/index.ts":{"bytes":54,"imports":[{"path":"packages/config-tools/src/env/get-env.ts","kind":"import-statement","original":"./get-env"},{"path":"packages/config-tools/src/env/set-env.ts","kind":"import-statement","original":"./set-env"}],"format":"esm"},"packages/config-tools/src/index.ts":{"bytes":399,"imports":[{"path":"packages/config-tools/src/config-file/index.ts","kind":"import-statement","original":"./config-file"},{"path":"packages/config-tools/src/create-storm-config.ts","kind":"import-statement","original":"./create-storm-config"},{"path":"packages/config-tools/src/env/index.ts","kind":"import-statement","original":"./env"},{"path":"packages/config-tools/src/schema.ts","kind":"import-statement","original":"./schema"},{"path":"packages/config-tools/src/types.ts","kind":"import-statement","original":"./types"},{"path":"packages/config-tools/src/utilities/index.ts","kind":"import-statement","original":"./utilities"}],"format":"esm"}},"outputs":{"dist/packages/config-tools/index.js":{"imports":[{"path":"cosmiconfig","kind":"import-statement","external":true},{"path":"locate-path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"url","kind":"import-statement","external":true},{"path":"fs","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"zod","kind":"import-statement","external":true}],"exports":["ColorConfigSchema","DefaultColorConfig","DefaultStormConfig","LogLevel","LogLevelLabel","StormConfigSchema","createConfig","createConfigExtension","createStormConfig","findWorkspaceRoot","findWorkspaceRootSafe","getConfigEnv","getConfigFile","getDefaultConfig","getExtensionEnv","getLogLevel","getLogLevelLabel","setConfigEnv","setExtensionEnv"],"entryPoint":"packages/config-tools/src/index.ts","inputs":{"packages/config-tools/src/config-file/get-config-file.ts":{"bytesInOutput":1564},"packages/config-tools/src/config-file/index.ts":{"bytesInOutput":0},"packages/config-tools/src/index.ts":{"bytesInOutput":0},"packages/config-tools/src/types.ts":{"bytesInOutput":256},"packages/config-tools/src/utilities/find-up.ts":{"bytesInOutput":1722},"packages/config-tools/src/utilities/find-workspace-root.ts":{"bytesInOutput":1159},"packages/config-tools/src/utilities/index.ts":{"bytesInOutput":0},"packages/config-tools/src/utilities/get-default-config.ts":{"bytesInOutput":1981},"packages/config-tools/src/schema.ts":{"bytesInOutput":4444},"packages/config-tools/src/utilities/get-log-level.ts":{"bytesInOutput":1029},"packages/config-tools/src/env/get-env.ts":{"bytesInOutput":3060},"packages/config-tools/src/create-storm-config.ts":{"bytesInOutput":1106},"packages/config-tools/src/env/index.ts":{"bytesInOutput":0},"packages/config-tools/src/env/set-env.ts":{"bytesInOutput":3528}},"bytes":20802},"dist/packages/config-tools/utilities/find-workspace-root.js":{"imports":[{"path":"locate-path","kind":"import-statement","external":true},{"path":"path","kind":"import-statement","external":true},{"path":"url","kind":"import-statement","external":true}],"exports":["findWorkspaceRoot","findWorkspaceRootSafe"],"entryPoint":"packages/config-tools/src/utilities/find-workspace-root.ts","inputs":{"packages/config-tools/src/utilities/find-up.ts":{"bytesInOutput":1722},"packages/config-tools/src/utilities/find-workspace-root.ts":{"bytesInOutput":1159}},"bytes":3051}}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storm-software/config-tools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "⚡The Storm-Ops monorepo contains utility applications, tools, and various libraries to create modern and scalable web applications.",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
29
29
|
// packages/config-tools/src/utilities/find-workspace-root.ts
|
|
30
30
|
var find_workspace_root_exports = {};
|
|
31
31
|
__export(find_workspace_root_exports, {
|
|
32
|
-
findWorkspaceRoot: () => findWorkspaceRoot
|
|
32
|
+
findWorkspaceRoot: () => findWorkspaceRoot,
|
|
33
|
+
findWorkspaceRootSafe: () => findWorkspaceRootSafe
|
|
33
34
|
});
|
|
34
35
|
module.exports = __toCommonJS(find_workspace_root_exports);
|
|
35
36
|
|
|
@@ -107,12 +108,15 @@ var rootFiles = [
|
|
|
107
108
|
"pnpm-lock.yml",
|
|
108
109
|
"bun.lockb"
|
|
109
110
|
];
|
|
110
|
-
function
|
|
111
|
-
|
|
111
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
112
|
+
return process.env.STORM_WORKSPACE_ROOT ? process.env.STORM_WORKSPACE_ROOT : process.env.NX_WORKSPACE_ROOT_PATH ? process.env.NX_WORKSPACE_ROOT_PATH : findUpSync(rootFiles, {
|
|
112
113
|
cwd: pathInsideMonorepo ?? process.cwd(),
|
|
113
114
|
type: "file",
|
|
114
115
|
limit: 1
|
|
115
116
|
});
|
|
117
|
+
}
|
|
118
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
119
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
116
120
|
if (!result) {
|
|
117
121
|
throw new Error(
|
|
118
122
|
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
@@ -126,5 +130,6 @@ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
|
126
130
|
}
|
|
127
131
|
// Annotate the CommonJS export names for ESM import in node:
|
|
128
132
|
0 && (module.exports = {
|
|
129
|
-
findWorkspaceRoot
|
|
133
|
+
findWorkspaceRoot,
|
|
134
|
+
findWorkspaceRootSafe
|
|
130
135
|
});
|
|
@@ -72,12 +72,15 @@ var rootFiles = [
|
|
|
72
72
|
"pnpm-lock.yml",
|
|
73
73
|
"bun.lockb"
|
|
74
74
|
];
|
|
75
|
-
function
|
|
76
|
-
|
|
75
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
76
|
+
return process.env.STORM_WORKSPACE_ROOT ? process.env.STORM_WORKSPACE_ROOT : process.env.NX_WORKSPACE_ROOT_PATH ? process.env.NX_WORKSPACE_ROOT_PATH : findUpSync(rootFiles, {
|
|
77
77
|
cwd: pathInsideMonorepo ?? process.cwd(),
|
|
78
78
|
type: "file",
|
|
79
79
|
limit: 1
|
|
80
80
|
});
|
|
81
|
+
}
|
|
82
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
83
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
81
84
|
if (!result) {
|
|
82
85
|
throw new Error(
|
|
83
86
|
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
@@ -90,5 +93,6 @@ Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
|
90
93
|
return result;
|
|
91
94
|
}
|
|
92
95
|
export {
|
|
93
|
-
findWorkspaceRoot
|
|
96
|
+
findWorkspaceRoot,
|
|
97
|
+
findWorkspaceRootSafe
|
|
94
98
|
};
|