@storm-software/cloudflare-tools 0.63.55 → 0.63.62
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 +56 -0
- package/README.md +1 -2
- package/dist/chunk-2CDSXWFA.js +311 -0
- package/dist/{chunk-Q5XL7K7Z.mjs → chunk-47LTDAIV.mjs} +4 -4
- package/dist/{chunk-MB54NXKO.mjs → chunk-7ZAYEHFL.mjs} +11 -9
- package/dist/{chunk-AOAXSMD4.js → chunk-FULKT5FT.js} +121 -119
- package/dist/{chunk-TOB7OQN4.js → chunk-FVFZRRXE.js} +1 -1
- package/dist/{chunk-BRPTGDS4.mjs → chunk-IANDAPQS.mjs} +1 -1
- package/dist/{chunk-ADVG6LVE.mjs → chunk-LJBM3BJ3.mjs} +650 -14
- package/dist/chunk-MHMPOWJN.js +1370 -0
- package/dist/{chunk-57WTY3UY.js → chunk-NCQM44P3.js} +3 -3
- package/dist/{chunk-HSHWXMVT.mjs → chunk-OULGED23.mjs} +4 -4
- package/dist/{chunk-P45GT4VW.js → chunk-Q5A6EYKA.js} +12 -12
- package/dist/{chunk-X2ML265T.js → chunk-R6LCC4LT.js} +16 -16
- package/dist/{chunk-5GUQUTLT.mjs → chunk-TGT6YRXK.mjs} +1 -1
- package/dist/chunk-V44DYGWX.mjs +311 -0
- package/dist/executors.js +5 -5
- package/dist/executors.mjs +5 -5
- package/dist/generators.js +5 -5
- package/dist/generators.mjs +4 -4
- package/dist/index.js +8 -8
- package/dist/index.mjs +7 -7
- package/dist/src/executors/cloudflare-publish/executor.js +3 -3
- package/dist/src/executors/cloudflare-publish/executor.mjs +3 -3
- package/dist/src/executors/r2-upload-publish/executor.js +5 -5
- package/dist/src/executors/r2-upload-publish/executor.mjs +4 -4
- package/dist/src/executors/serve/executor.js +4 -4
- package/dist/src/executors/serve/executor.mjs +3 -3
- package/dist/src/generators/init/generator.js +2 -2
- package/dist/src/generators/init/generator.mjs +1 -1
- package/dist/src/generators/worker/generator.js +5 -5
- package/dist/src/generators/worker/generator.mjs +4 -4
- package/dist/src/utils/index.js +3 -3
- package/dist/src/utils/index.mjs +2 -2
- package/dist/src/utils/r2-bucket-helpers.js +3 -3
- package/dist/src/utils/r2-bucket-helpers.mjs +2 -2
- package/package.json +2 -2
- package/dist/chunk-AZSS2TUS.mjs +0 -879
- package/dist/chunk-KDRIR55G.js +0 -879
- package/dist/chunk-UOEUE2GI.js +0 -734
|
@@ -1,21 +1,507 @@
|
|
|
1
1
|
import {
|
|
2
|
-
COLOR_KEYS,
|
|
3
2
|
LogLevel,
|
|
4
|
-
STORM_DEFAULT_DOCS,
|
|
5
|
-
STORM_DEFAULT_HOMEPAGE,
|
|
6
|
-
STORM_DEFAULT_LICENSING,
|
|
7
|
-
applyDefaultConfig,
|
|
8
|
-
correctPaths,
|
|
9
|
-
findWorkspaceRoot,
|
|
10
3
|
formatLogMessage,
|
|
11
4
|
getLogLevel,
|
|
12
5
|
getLogLevelLabel,
|
|
13
|
-
getPackageJsonConfig,
|
|
14
|
-
joinPaths,
|
|
15
|
-
stormWorkspaceConfigSchema,
|
|
16
6
|
writeTrace,
|
|
17
7
|
writeWarning
|
|
18
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-V44DYGWX.mjs";
|
|
9
|
+
|
|
10
|
+
// ../config-tools/src/utilities/correct-paths.ts
|
|
11
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
12
|
+
function normalizeWindowsPath(input = "") {
|
|
13
|
+
if (!input) {
|
|
14
|
+
return input;
|
|
15
|
+
}
|
|
16
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
17
|
+
}
|
|
18
|
+
var _UNC_REGEX = /^[/\\]{2}/;
|
|
19
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
20
|
+
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
21
|
+
var correctPaths = function(path) {
|
|
22
|
+
if (!path || path.length === 0) {
|
|
23
|
+
return ".";
|
|
24
|
+
}
|
|
25
|
+
path = normalizeWindowsPath(path);
|
|
26
|
+
const isUNCPath = path.match(_UNC_REGEX);
|
|
27
|
+
const isPathAbsolute = isAbsolute(path);
|
|
28
|
+
const trailingSeparator = path[path.length - 1] === "/";
|
|
29
|
+
path = normalizeString(path, !isPathAbsolute);
|
|
30
|
+
if (path.length === 0) {
|
|
31
|
+
if (isPathAbsolute) {
|
|
32
|
+
return "/";
|
|
33
|
+
}
|
|
34
|
+
return trailingSeparator ? "./" : ".";
|
|
35
|
+
}
|
|
36
|
+
if (trailingSeparator) {
|
|
37
|
+
path += "/";
|
|
38
|
+
}
|
|
39
|
+
if (_DRIVE_LETTER_RE.test(path)) {
|
|
40
|
+
path += "/";
|
|
41
|
+
}
|
|
42
|
+
if (isUNCPath) {
|
|
43
|
+
if (!isPathAbsolute) {
|
|
44
|
+
return `//./${path}`;
|
|
45
|
+
}
|
|
46
|
+
return `//${path}`;
|
|
47
|
+
}
|
|
48
|
+
return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
|
|
49
|
+
};
|
|
50
|
+
var joinPaths = function(...segments) {
|
|
51
|
+
let path = "";
|
|
52
|
+
for (const seg of segments) {
|
|
53
|
+
if (!seg) {
|
|
54
|
+
continue;
|
|
55
|
+
}
|
|
56
|
+
if (path.length > 0) {
|
|
57
|
+
const pathTrailing = path[path.length - 1] === "/";
|
|
58
|
+
const segLeading = seg[0] === "/";
|
|
59
|
+
const both = pathTrailing && segLeading;
|
|
60
|
+
if (both) {
|
|
61
|
+
path += seg.slice(1);
|
|
62
|
+
} else {
|
|
63
|
+
path += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
path += seg;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return correctPaths(path);
|
|
70
|
+
};
|
|
71
|
+
function normalizeString(path, allowAboveRoot) {
|
|
72
|
+
let res = "";
|
|
73
|
+
let lastSegmentLength = 0;
|
|
74
|
+
let lastSlash = -1;
|
|
75
|
+
let dots = 0;
|
|
76
|
+
let char = null;
|
|
77
|
+
for (let index = 0; index <= path.length; ++index) {
|
|
78
|
+
if (index < path.length) {
|
|
79
|
+
char = path[index];
|
|
80
|
+
} else if (char === "/") {
|
|
81
|
+
break;
|
|
82
|
+
} else {
|
|
83
|
+
char = "/";
|
|
84
|
+
}
|
|
85
|
+
if (char === "/") {
|
|
86
|
+
if (lastSlash === index - 1 || dots === 1) {
|
|
87
|
+
} else if (dots === 2) {
|
|
88
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
89
|
+
if (res.length > 2) {
|
|
90
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
91
|
+
if (lastSlashIndex === -1) {
|
|
92
|
+
res = "";
|
|
93
|
+
lastSegmentLength = 0;
|
|
94
|
+
} else {
|
|
95
|
+
res = res.slice(0, lastSlashIndex);
|
|
96
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
97
|
+
}
|
|
98
|
+
lastSlash = index;
|
|
99
|
+
dots = 0;
|
|
100
|
+
continue;
|
|
101
|
+
} else if (res.length > 0) {
|
|
102
|
+
res = "";
|
|
103
|
+
lastSegmentLength = 0;
|
|
104
|
+
lastSlash = index;
|
|
105
|
+
dots = 0;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (allowAboveRoot) {
|
|
110
|
+
res += res.length > 0 ? "/.." : "..";
|
|
111
|
+
lastSegmentLength = 2;
|
|
112
|
+
}
|
|
113
|
+
} else {
|
|
114
|
+
if (res.length > 0) {
|
|
115
|
+
res += `/${path.slice(lastSlash + 1, index)}`;
|
|
116
|
+
} else {
|
|
117
|
+
res = path.slice(lastSlash + 1, index);
|
|
118
|
+
}
|
|
119
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
120
|
+
}
|
|
121
|
+
lastSlash = index;
|
|
122
|
+
dots = 0;
|
|
123
|
+
} else if (char === "." && dots !== -1) {
|
|
124
|
+
++dots;
|
|
125
|
+
} else {
|
|
126
|
+
dots = -1;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
return res;
|
|
130
|
+
}
|
|
131
|
+
var isAbsolute = function(p) {
|
|
132
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// ../config-tools/src/utilities/find-up.ts
|
|
136
|
+
import { existsSync } from "node:fs";
|
|
137
|
+
import { join } from "node:path";
|
|
138
|
+
var MAX_PATH_SEARCH_DEPTH = 30;
|
|
139
|
+
var depth = 0;
|
|
140
|
+
function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
|
|
141
|
+
const _startPath = startPath ?? process.cwd();
|
|
142
|
+
if (endDirectoryNames.some(
|
|
143
|
+
(endDirName) => existsSync(join(_startPath, endDirName))
|
|
144
|
+
)) {
|
|
145
|
+
return _startPath;
|
|
146
|
+
}
|
|
147
|
+
if (endFileNames.some(
|
|
148
|
+
(endFileName) => existsSync(join(_startPath, endFileName))
|
|
149
|
+
)) {
|
|
150
|
+
return _startPath;
|
|
151
|
+
}
|
|
152
|
+
if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
|
|
153
|
+
const parent = join(_startPath, "..");
|
|
154
|
+
return findFolderUp(parent, endFileNames, endDirectoryNames);
|
|
155
|
+
}
|
|
156
|
+
return void 0;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// ../config-tools/src/utilities/find-workspace-root.ts
|
|
160
|
+
var rootFiles = [
|
|
161
|
+
"storm-workspace.json",
|
|
162
|
+
"storm-workspace.yaml",
|
|
163
|
+
"storm-workspace.yml",
|
|
164
|
+
"storm-workspace.js",
|
|
165
|
+
"storm-workspace.ts",
|
|
166
|
+
".storm-workspace.json",
|
|
167
|
+
".storm-workspace.yaml",
|
|
168
|
+
".storm-workspace.yml",
|
|
169
|
+
".storm-workspace.js",
|
|
170
|
+
".storm-workspace.ts",
|
|
171
|
+
"lerna.json",
|
|
172
|
+
"nx.json",
|
|
173
|
+
"turbo.json",
|
|
174
|
+
"npm-workspace.json",
|
|
175
|
+
"yarn-workspace.json",
|
|
176
|
+
"pnpm-workspace.json",
|
|
177
|
+
"npm-workspace.yaml",
|
|
178
|
+
"yarn-workspace.yaml",
|
|
179
|
+
"pnpm-workspace.yaml",
|
|
180
|
+
"npm-workspace.yml",
|
|
181
|
+
"yarn-workspace.yml",
|
|
182
|
+
"pnpm-workspace.yml",
|
|
183
|
+
"npm-lock.json",
|
|
184
|
+
"yarn-lock.json",
|
|
185
|
+
"pnpm-lock.json",
|
|
186
|
+
"npm-lock.yaml",
|
|
187
|
+
"yarn-lock.yaml",
|
|
188
|
+
"pnpm-lock.yaml",
|
|
189
|
+
"npm-lock.yml",
|
|
190
|
+
"yarn-lock.yml",
|
|
191
|
+
"pnpm-lock.yml",
|
|
192
|
+
"bun.lockb"
|
|
193
|
+
];
|
|
194
|
+
var rootDirectories = [
|
|
195
|
+
".storm-workspace",
|
|
196
|
+
".nx",
|
|
197
|
+
".github",
|
|
198
|
+
".vscode",
|
|
199
|
+
".verdaccio"
|
|
200
|
+
];
|
|
201
|
+
function findWorkspaceRootSafe(pathInsideMonorepo) {
|
|
202
|
+
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
|
|
203
|
+
return correctPaths(
|
|
204
|
+
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
return correctPaths(
|
|
208
|
+
findFolderUp(
|
|
209
|
+
pathInsideMonorepo ?? process.cwd(),
|
|
210
|
+
rootFiles,
|
|
211
|
+
rootDirectories
|
|
212
|
+
)
|
|
213
|
+
);
|
|
214
|
+
}
|
|
215
|
+
function findWorkspaceRoot(pathInsideMonorepo) {
|
|
216
|
+
const result = findWorkspaceRootSafe(pathInsideMonorepo);
|
|
217
|
+
if (!result) {
|
|
218
|
+
throw new Error(
|
|
219
|
+
`Cannot find workspace root upwards from known path. Files search list includes:
|
|
220
|
+
${rootFiles.join(
|
|
221
|
+
"\n"
|
|
222
|
+
)}
|
|
223
|
+
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
|
|
224
|
+
);
|
|
225
|
+
}
|
|
226
|
+
return result;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// ../config/src/schema.ts
|
|
230
|
+
import * as z from "zod";
|
|
231
|
+
|
|
232
|
+
// ../config/src/constants.ts
|
|
233
|
+
var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
|
|
234
|
+
var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
|
|
235
|
+
var STORM_DEFAULT_CONTACT = "https://stormsoftware.com/contact";
|
|
236
|
+
var STORM_DEFAULT_LICENSING = "https://stormsoftware.com/license";
|
|
237
|
+
var STORM_DEFAULT_LICENSE = "Apache-2.0";
|
|
238
|
+
var STORM_DEFAULT_SOCIAL_TWITTER = "StormSoftwareHQ";
|
|
239
|
+
var STORM_DEFAULT_SOCIAL_DISCORD = "https://discord.gg/MQ6YVzakM5";
|
|
240
|
+
var STORM_DEFAULT_SOCIAL_TELEGRAM = "https://t.me/storm_software";
|
|
241
|
+
var STORM_DEFAULT_SOCIAL_SLACK = "https://join.slack.com/t/storm-software/shared_invite/zt-2gsmk04hs-i6yhK_r6urq0dkZYAwq2pA";
|
|
242
|
+
var STORM_DEFAULT_SOCIAL_MEDIUM = "https://medium.com/storm-software";
|
|
243
|
+
var STORM_DEFAULT_SOCIAL_GITHUB = "https://github.com/storm-software";
|
|
244
|
+
var STORM_DEFAULT_RELEASE_FOOTER = `
|
|
245
|
+
Storm Software is an open source software development organization with the mission is to make software development more accessible. Our ideal future is one where anyone can create software without years of prior development experience serving as a barrier to entry. We hope to achieve this via LLMs, Generative AI, and intuitive, high-level data modeling/programming languages.
|
|
246
|
+
|
|
247
|
+
Join us on [Discord](${STORM_DEFAULT_SOCIAL_DISCORD}) to chat with the team, receive release notifications, ask questions, and get involved.
|
|
248
|
+
|
|
249
|
+
If this sounds interesting, and you would like to help us in creating the next generation of development tools, please reach out on our [website](${STORM_DEFAULT_CONTACT}) or join our [Slack](${STORM_DEFAULT_SOCIAL_SLACK}) channel!
|
|
250
|
+
`;
|
|
251
|
+
var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
|
|
252
|
+
|
|
253
|
+
// ../config/src/schema.ts
|
|
254
|
+
var ColorSchema = z.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7);
|
|
255
|
+
var DarkColorSchema = ColorSchema.default("#151718").describe(
|
|
256
|
+
"The dark background color of the workspace"
|
|
257
|
+
);
|
|
258
|
+
var LightColorSchema = ColorSchema.default("#cbd5e1").describe(
|
|
259
|
+
"The light background color of the workspace"
|
|
260
|
+
);
|
|
261
|
+
var BrandColorSchema = ColorSchema.default("#1fb2a6").describe(
|
|
262
|
+
"The primary brand specific color of the workspace"
|
|
263
|
+
);
|
|
264
|
+
var AlternateColorSchema = ColorSchema.optional().describe(
|
|
265
|
+
"The alternate brand specific color of the workspace"
|
|
266
|
+
);
|
|
267
|
+
var AccentColorSchema = ColorSchema.optional().describe(
|
|
268
|
+
"The secondary brand specific color of the workspace"
|
|
269
|
+
);
|
|
270
|
+
var LinkColorSchema = ColorSchema.default("#3fa6ff").describe(
|
|
271
|
+
"The color used to display hyperlink text"
|
|
272
|
+
);
|
|
273
|
+
var HelpColorSchema = ColorSchema.default("#818cf8").describe(
|
|
274
|
+
"The second brand specific color of the workspace"
|
|
275
|
+
);
|
|
276
|
+
var SuccessColorSchema = ColorSchema.default("#45b27e").describe(
|
|
277
|
+
"The success color of the workspace"
|
|
278
|
+
);
|
|
279
|
+
var InfoColorSchema = ColorSchema.default("#38bdf8").describe(
|
|
280
|
+
"The informational color of the workspace"
|
|
281
|
+
);
|
|
282
|
+
var WarningColorSchema = ColorSchema.default("#f3d371").describe(
|
|
283
|
+
"The warning color of the workspace"
|
|
284
|
+
);
|
|
285
|
+
var DangerColorSchema = ColorSchema.default("#d8314a").describe(
|
|
286
|
+
"The danger color of the workspace"
|
|
287
|
+
);
|
|
288
|
+
var FatalColorSchema = ColorSchema.optional().describe(
|
|
289
|
+
"The fatal color of the workspace"
|
|
290
|
+
);
|
|
291
|
+
var PositiveColorSchema = ColorSchema.default("#4ade80").describe(
|
|
292
|
+
"The positive number color of the workspace"
|
|
293
|
+
);
|
|
294
|
+
var NegativeColorSchema = ColorSchema.default("#ef4444").describe(
|
|
295
|
+
"The negative number color of the workspace"
|
|
296
|
+
);
|
|
297
|
+
var GradientStopsSchema = z.array(ColorSchema).optional().describe(
|
|
298
|
+
"The color stops for the base gradient color pattern used in the workspace"
|
|
299
|
+
);
|
|
300
|
+
var DarkThemeColorConfigSchema = z.object({
|
|
301
|
+
foreground: LightColorSchema,
|
|
302
|
+
background: DarkColorSchema,
|
|
303
|
+
brand: BrandColorSchema,
|
|
304
|
+
alternate: AlternateColorSchema,
|
|
305
|
+
accent: AccentColorSchema,
|
|
306
|
+
link: LinkColorSchema,
|
|
307
|
+
help: HelpColorSchema,
|
|
308
|
+
success: SuccessColorSchema,
|
|
309
|
+
info: InfoColorSchema,
|
|
310
|
+
warning: WarningColorSchema,
|
|
311
|
+
danger: DangerColorSchema,
|
|
312
|
+
fatal: FatalColorSchema,
|
|
313
|
+
positive: PositiveColorSchema,
|
|
314
|
+
negative: NegativeColorSchema,
|
|
315
|
+
gradient: GradientStopsSchema
|
|
316
|
+
});
|
|
317
|
+
var LightThemeColorConfigSchema = z.object({
|
|
318
|
+
foreground: DarkColorSchema,
|
|
319
|
+
background: LightColorSchema,
|
|
320
|
+
brand: BrandColorSchema,
|
|
321
|
+
alternate: AlternateColorSchema,
|
|
322
|
+
accent: AccentColorSchema,
|
|
323
|
+
link: LinkColorSchema,
|
|
324
|
+
help: HelpColorSchema,
|
|
325
|
+
success: SuccessColorSchema,
|
|
326
|
+
info: InfoColorSchema,
|
|
327
|
+
warning: WarningColorSchema,
|
|
328
|
+
danger: DangerColorSchema,
|
|
329
|
+
fatal: FatalColorSchema,
|
|
330
|
+
positive: PositiveColorSchema,
|
|
331
|
+
negative: NegativeColorSchema,
|
|
332
|
+
gradient: GradientStopsSchema
|
|
333
|
+
});
|
|
334
|
+
var MultiThemeColorConfigSchema = z.object({
|
|
335
|
+
dark: DarkThemeColorConfigSchema,
|
|
336
|
+
light: LightThemeColorConfigSchema
|
|
337
|
+
});
|
|
338
|
+
var SingleThemeColorConfigSchema = z.object({
|
|
339
|
+
dark: DarkColorSchema,
|
|
340
|
+
light: LightColorSchema,
|
|
341
|
+
brand: BrandColorSchema,
|
|
342
|
+
alternate: AlternateColorSchema,
|
|
343
|
+
accent: AccentColorSchema,
|
|
344
|
+
link: LinkColorSchema,
|
|
345
|
+
help: HelpColorSchema,
|
|
346
|
+
success: SuccessColorSchema,
|
|
347
|
+
info: InfoColorSchema,
|
|
348
|
+
warning: WarningColorSchema,
|
|
349
|
+
danger: DangerColorSchema,
|
|
350
|
+
fatal: FatalColorSchema,
|
|
351
|
+
positive: PositiveColorSchema,
|
|
352
|
+
negative: NegativeColorSchema,
|
|
353
|
+
gradient: GradientStopsSchema
|
|
354
|
+
});
|
|
355
|
+
var RegistryUrlConfigSchema = z.url().optional().describe("A remote registry URL used to publish distributable packages");
|
|
356
|
+
var RegistryConfigSchema = z.object({
|
|
357
|
+
github: RegistryUrlConfigSchema,
|
|
358
|
+
npm: RegistryUrlConfigSchema,
|
|
359
|
+
cargo: RegistryUrlConfigSchema,
|
|
360
|
+
cyclone: RegistryUrlConfigSchema,
|
|
361
|
+
container: RegistryUrlConfigSchema
|
|
362
|
+
}).default({}).describe("A list of remote registry URLs used by Storm Software");
|
|
363
|
+
var ColorConfigSchema = SingleThemeColorConfigSchema.or(
|
|
364
|
+
MultiThemeColorConfigSchema
|
|
365
|
+
).describe("Colors used for various workspace elements");
|
|
366
|
+
var ColorConfigMapSchema = z.record(
|
|
367
|
+
z.union([z.literal("base"), z.string()]),
|
|
368
|
+
ColorConfigSchema
|
|
369
|
+
);
|
|
370
|
+
var ExtendsItemSchema = z.string().trim().describe(
|
|
371
|
+
"The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
|
|
372
|
+
);
|
|
373
|
+
var ExtendsSchema = ExtendsItemSchema.or(
|
|
374
|
+
z.array(ExtendsItemSchema)
|
|
375
|
+
).describe(
|
|
376
|
+
"The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
|
|
377
|
+
);
|
|
378
|
+
var WorkspaceBotConfigSchema = z.object({
|
|
379
|
+
name: z.string().trim().default("stormie-bot").describe(
|
|
380
|
+
"The workspace bot user's name (this is the bot that will be used to perform various tasks)"
|
|
381
|
+
),
|
|
382
|
+
email: z.email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
|
|
383
|
+
}).describe(
|
|
384
|
+
"The workspace's bot user's config used to automated various operations tasks"
|
|
385
|
+
);
|
|
386
|
+
var WorkspaceReleaseConfigSchema = z.object({
|
|
387
|
+
banner: z.string().trim().optional().describe(
|
|
388
|
+
"A URL to a banner image used to display the workspace's release"
|
|
389
|
+
),
|
|
390
|
+
header: z.string().trim().optional().describe(
|
|
391
|
+
"A header message appended to the start of the workspace's release notes"
|
|
392
|
+
),
|
|
393
|
+
footer: z.string().trim().optional().describe(
|
|
394
|
+
"A footer message appended to the end of the workspace's release notes"
|
|
395
|
+
)
|
|
396
|
+
}).describe("The workspace's release config used during the release process");
|
|
397
|
+
var WorkspaceSocialsConfigSchema = z.object({
|
|
398
|
+
twitter: z.string().trim().default(STORM_DEFAULT_SOCIAL_TWITTER).describe("A Twitter/X account associated with the organization/project"),
|
|
399
|
+
discord: z.string().trim().default(STORM_DEFAULT_SOCIAL_DISCORD).describe("A Discord account associated with the organization/project"),
|
|
400
|
+
telegram: z.string().trim().default(STORM_DEFAULT_SOCIAL_TELEGRAM).describe("A Telegram account associated with the organization/project"),
|
|
401
|
+
slack: z.string().trim().default(STORM_DEFAULT_SOCIAL_SLACK).describe("A Slack account associated with the organization/project"),
|
|
402
|
+
medium: z.string().trim().default(STORM_DEFAULT_SOCIAL_MEDIUM).describe("A Medium account associated with the organization/project"),
|
|
403
|
+
github: z.string().trim().default(STORM_DEFAULT_SOCIAL_GITHUB).describe("A GitHub account associated with the organization/project")
|
|
404
|
+
}).describe(
|
|
405
|
+
"The workspace's account config used to store various social media links"
|
|
406
|
+
);
|
|
407
|
+
var WorkspaceDirectoryConfigSchema = z.object({
|
|
408
|
+
cache: z.string().trim().optional().describe(
|
|
409
|
+
"The directory used to store the environment's cached file data"
|
|
410
|
+
),
|
|
411
|
+
data: z.string().trim().optional().describe("The directory used to store the environment's data files"),
|
|
412
|
+
config: z.string().trim().optional().describe(
|
|
413
|
+
"The directory used to store the environment's configuration files"
|
|
414
|
+
),
|
|
415
|
+
temp: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
416
|
+
log: z.string().trim().optional().describe("The directory used to store the environment's temp files"),
|
|
417
|
+
build: z.string().trim().default("dist").describe(
|
|
418
|
+
"The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
|
|
419
|
+
)
|
|
420
|
+
}).describe(
|
|
421
|
+
"Various directories used by the workspace to store data, cache, and configuration files"
|
|
422
|
+
);
|
|
423
|
+
var errorConfigSchema = z.object({
|
|
424
|
+
codesFile: z.string().trim().default(STORM_DEFAULT_ERROR_CODES_FILE).describe("The path to the workspace's error codes JSON file"),
|
|
425
|
+
url: z.url().optional().describe(
|
|
426
|
+
"A URL to a page that looks up the workspace's error messages given a specific error code"
|
|
427
|
+
)
|
|
428
|
+
}).describe("The workspace's error config used during the error process");
|
|
429
|
+
var organizationConfigSchema = z.object({
|
|
430
|
+
name: z.string().trim().describe("The name of the organization"),
|
|
431
|
+
description: z.string().trim().optional().describe("A description of the organization"),
|
|
432
|
+
logo: z.url().optional().describe("A URL to the organization's logo image"),
|
|
433
|
+
icon: z.url().optional().describe("A URL to the organization's icon image"),
|
|
434
|
+
url: z.url().optional().describe(
|
|
435
|
+
"A URL to a page that provides more information about the organization"
|
|
436
|
+
)
|
|
437
|
+
}).describe("The workspace's organization details");
|
|
438
|
+
var stormWorkspaceConfigSchema = z.object({
|
|
439
|
+
$schema: z.string().trim().default(
|
|
440
|
+
"https://public.storm-cdn.com/schemas/storm-workspace.schema.json"
|
|
441
|
+
).describe(
|
|
442
|
+
"The URL or file path to the JSON schema file that describes the Storm configuration file"
|
|
443
|
+
),
|
|
444
|
+
extends: ExtendsSchema.optional(),
|
|
445
|
+
name: z.string().trim().toLowerCase().optional().describe(
|
|
446
|
+
"The name of the service/package/scope using this configuration"
|
|
447
|
+
),
|
|
448
|
+
namespace: z.string().trim().toLowerCase().optional().describe("The namespace of the package"),
|
|
449
|
+
organization: organizationConfigSchema.or(z.string().trim().describe("The organization of the workspace")).optional().describe(
|
|
450
|
+
"The organization of the workspace. This can be a string or an object containing the organization's details"
|
|
451
|
+
),
|
|
452
|
+
repository: z.string().trim().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
|
|
453
|
+
license: z.string().trim().default("Apache-2.0").describe("The license type of the package"),
|
|
454
|
+
homepage: z.url().optional().describe("The homepage of the workspace"),
|
|
455
|
+
docs: z.url().optional().describe("The documentation site for the workspace"),
|
|
456
|
+
portal: z.url().optional().describe("The development portal site for the workspace"),
|
|
457
|
+
licensing: z.url().optional().describe("The licensing site for the workspace"),
|
|
458
|
+
contact: z.url().optional().describe("The contact site for the workspace"),
|
|
459
|
+
support: z.url().optional().describe(
|
|
460
|
+
"The support site for the workspace. If not provided, this is defaulted to the `contact` config value"
|
|
461
|
+
),
|
|
462
|
+
branch: z.string().trim().default("main").describe("The branch of the workspace"),
|
|
463
|
+
preid: z.string().optional().describe("A tag specifying the version pre-release identifier"),
|
|
464
|
+
owner: z.string().trim().default("@storm-software/admin").describe("The owner of the package"),
|
|
465
|
+
bot: WorkspaceBotConfigSchema,
|
|
466
|
+
release: WorkspaceReleaseConfigSchema,
|
|
467
|
+
socials: WorkspaceSocialsConfigSchema,
|
|
468
|
+
error: errorConfigSchema,
|
|
469
|
+
mode: z.string().trim().default("production").describe("The current runtime environment mode for the package"),
|
|
470
|
+
workspaceRoot: z.string().trim().describe("The root directory of the workspace"),
|
|
471
|
+
skipCache: z.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
|
|
472
|
+
directories: WorkspaceDirectoryConfigSchema,
|
|
473
|
+
packageManager: z.enum(["npm", "yarn", "pnpm", "bun"]).default("npm").describe(
|
|
474
|
+
"The JavaScript/TypeScript package manager used by the repository"
|
|
475
|
+
),
|
|
476
|
+
timezone: z.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
|
|
477
|
+
locale: z.string().trim().default("en-US").describe("The default locale of the workspace"),
|
|
478
|
+
logLevel: z.enum([
|
|
479
|
+
"silent",
|
|
480
|
+
"fatal",
|
|
481
|
+
"error",
|
|
482
|
+
"warn",
|
|
483
|
+
"success",
|
|
484
|
+
"info",
|
|
485
|
+
"debug",
|
|
486
|
+
"trace",
|
|
487
|
+
"all"
|
|
488
|
+
]).default("info").describe(
|
|
489
|
+
"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`)."
|
|
490
|
+
),
|
|
491
|
+
skipConfigLogging: z.boolean().optional().describe(
|
|
492
|
+
"Should the logging of the current Storm Workspace configuration be skipped?"
|
|
493
|
+
),
|
|
494
|
+
registry: RegistryConfigSchema,
|
|
495
|
+
configFile: z.string().trim().nullable().default(null).describe(
|
|
496
|
+
"The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
|
|
497
|
+
),
|
|
498
|
+
colors: ColorConfigSchema.or(ColorConfigMapSchema).describe(
|
|
499
|
+
"Storm theme config values used for styling various package elements"
|
|
500
|
+
),
|
|
501
|
+
extensions: z.record(z.string(), z.any()).optional().default({}).describe("Configuration of each used extension")
|
|
502
|
+
}).describe(
|
|
503
|
+
"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."
|
|
504
|
+
);
|
|
19
505
|
|
|
20
506
|
// ../config-tools/src/create-storm-config.ts
|
|
21
507
|
import defu2 from "defu";
|
|
@@ -23,6 +509,114 @@ import defu2 from "defu";
|
|
|
23
509
|
// ../config-tools/src/config-file/get-config-file.ts
|
|
24
510
|
import { loadConfig } from "c12";
|
|
25
511
|
import defu from "defu";
|
|
512
|
+
|
|
513
|
+
// ../config/src/types.ts
|
|
514
|
+
var COLOR_KEYS = [
|
|
515
|
+
"dark",
|
|
516
|
+
"light",
|
|
517
|
+
"base",
|
|
518
|
+
"brand",
|
|
519
|
+
"alternate",
|
|
520
|
+
"accent",
|
|
521
|
+
"link",
|
|
522
|
+
"success",
|
|
523
|
+
"help",
|
|
524
|
+
"info",
|
|
525
|
+
"warning",
|
|
526
|
+
"danger",
|
|
527
|
+
"fatal",
|
|
528
|
+
"positive",
|
|
529
|
+
"negative"
|
|
530
|
+
];
|
|
531
|
+
|
|
532
|
+
// ../config-tools/src/utilities/get-default-config.ts
|
|
533
|
+
import { existsSync as existsSync2 } from "node:fs";
|
|
534
|
+
import { readFile } from "node:fs/promises";
|
|
535
|
+
import { join as join2 } from "node:path";
|
|
536
|
+
async function getPackageJsonConfig(root) {
|
|
537
|
+
let license = STORM_DEFAULT_LICENSE;
|
|
538
|
+
let homepage = void 0;
|
|
539
|
+
let support = void 0;
|
|
540
|
+
let name = void 0;
|
|
541
|
+
let namespace = void 0;
|
|
542
|
+
let repository = void 0;
|
|
543
|
+
const workspaceRoot = findWorkspaceRoot(root);
|
|
544
|
+
if (existsSync2(join2(workspaceRoot, "package.json"))) {
|
|
545
|
+
const file = await readFile(
|
|
546
|
+
joinPaths(workspaceRoot, "package.json"),
|
|
547
|
+
"utf8"
|
|
548
|
+
);
|
|
549
|
+
if (file) {
|
|
550
|
+
const packageJson = JSON.parse(file);
|
|
551
|
+
if (packageJson.name) {
|
|
552
|
+
name = packageJson.name;
|
|
553
|
+
}
|
|
554
|
+
if (packageJson.namespace) {
|
|
555
|
+
namespace = packageJson.namespace;
|
|
556
|
+
}
|
|
557
|
+
if (packageJson.repository) {
|
|
558
|
+
if (typeof packageJson.repository === "string") {
|
|
559
|
+
repository = packageJson.repository;
|
|
560
|
+
} else if (packageJson.repository.url) {
|
|
561
|
+
repository = packageJson.repository.url;
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
if (packageJson.license) {
|
|
565
|
+
license = packageJson.license;
|
|
566
|
+
}
|
|
567
|
+
if (packageJson.homepage) {
|
|
568
|
+
homepage = packageJson.homepage;
|
|
569
|
+
}
|
|
570
|
+
if (packageJson.bugs) {
|
|
571
|
+
if (typeof packageJson.bugs === "string") {
|
|
572
|
+
support = packageJson.bugs;
|
|
573
|
+
} else if (packageJson.bugs.url) {
|
|
574
|
+
support = packageJson.bugs.url;
|
|
575
|
+
}
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
return {
|
|
580
|
+
workspaceRoot,
|
|
581
|
+
name,
|
|
582
|
+
namespace,
|
|
583
|
+
repository,
|
|
584
|
+
license,
|
|
585
|
+
homepage,
|
|
586
|
+
support
|
|
587
|
+
};
|
|
588
|
+
}
|
|
589
|
+
function applyDefaultConfig(config) {
|
|
590
|
+
if (!config.support && config.contact) {
|
|
591
|
+
config.support = config.contact;
|
|
592
|
+
}
|
|
593
|
+
if (!config.contact && config.support) {
|
|
594
|
+
config.contact = config.support;
|
|
595
|
+
}
|
|
596
|
+
if (config.homepage) {
|
|
597
|
+
if (!config.docs) {
|
|
598
|
+
config.docs = `${config.homepage}/docs`;
|
|
599
|
+
}
|
|
600
|
+
if (!config.license) {
|
|
601
|
+
config.license = `${config.homepage}/license`;
|
|
602
|
+
}
|
|
603
|
+
if (!config.support) {
|
|
604
|
+
config.support = `${config.homepage}/support`;
|
|
605
|
+
}
|
|
606
|
+
if (!config.contact) {
|
|
607
|
+
config.contact = `${config.homepage}/contact`;
|
|
608
|
+
}
|
|
609
|
+
if (!config.error?.codesFile || !config?.error?.url) {
|
|
610
|
+
config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
|
|
611
|
+
if (config.homepage) {
|
|
612
|
+
config.error.url ??= `${config.homepage}/errors`;
|
|
613
|
+
}
|
|
614
|
+
}
|
|
615
|
+
}
|
|
616
|
+
return config;
|
|
617
|
+
}
|
|
618
|
+
|
|
619
|
+
// ../config-tools/src/config-file/get-config-file.ts
|
|
26
620
|
var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
27
621
|
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
28
622
|
const configs = await Promise.all([
|
|
@@ -236,6 +830,19 @@ var getThemeColorConfigEnv = (prefix, theme) => {
|
|
|
236
830
|
return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorConfigEnv(prefix + themeName) : getSingleThemeColorConfigEnv(prefix + themeName);
|
|
237
831
|
};
|
|
238
832
|
var getSingleThemeColorConfigEnv = (prefix) => {
|
|
833
|
+
const gradient = [];
|
|
834
|
+
if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
|
|
835
|
+
gradient.push(
|
|
836
|
+
process.env[`${prefix}GRADIENT_START`],
|
|
837
|
+
process.env[`${prefix}GRADIENT_END`]
|
|
838
|
+
);
|
|
839
|
+
} else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
|
|
840
|
+
let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
|
|
841
|
+
while (process.env[`${prefix}GRADIENT_${index}`]) {
|
|
842
|
+
gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
|
|
843
|
+
index++;
|
|
844
|
+
}
|
|
845
|
+
}
|
|
239
846
|
return {
|
|
240
847
|
dark: process.env[`${prefix}DARK`],
|
|
241
848
|
light: process.env[`${prefix}LIGHT`],
|
|
@@ -250,7 +857,8 @@ var getSingleThemeColorConfigEnv = (prefix) => {
|
|
|
250
857
|
danger: process.env[`${prefix}DANGER`],
|
|
251
858
|
fatal: process.env[`${prefix}FATAL`],
|
|
252
859
|
positive: process.env[`${prefix}POSITIVE`],
|
|
253
|
-
negative: process.env[`${prefix}NEGATIVE`]
|
|
860
|
+
negative: process.env[`${prefix}NEGATIVE`],
|
|
861
|
+
gradient
|
|
254
862
|
};
|
|
255
863
|
};
|
|
256
864
|
var getMultiThemeColorConfigEnv = (prefix) => {
|
|
@@ -262,6 +870,19 @@ var getMultiThemeColorConfigEnv = (prefix) => {
|
|
|
262
870
|
};
|
|
263
871
|
};
|
|
264
872
|
var getBaseThemeColorConfigEnv = (prefix) => {
|
|
873
|
+
const gradient = [];
|
|
874
|
+
if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
|
|
875
|
+
gradient.push(
|
|
876
|
+
process.env[`${prefix}GRADIENT_START`],
|
|
877
|
+
process.env[`${prefix}GRADIENT_END`]
|
|
878
|
+
);
|
|
879
|
+
} else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
|
|
880
|
+
let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
|
|
881
|
+
while (process.env[`${prefix}GRADIENT_${index}`]) {
|
|
882
|
+
gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
|
|
883
|
+
index++;
|
|
884
|
+
}
|
|
885
|
+
}
|
|
265
886
|
return {
|
|
266
887
|
foreground: process.env[`${prefix}FOREGROUND`],
|
|
267
888
|
background: process.env[`${prefix}BACKGROUND`],
|
|
@@ -276,7 +897,8 @@ var getBaseThemeColorConfigEnv = (prefix) => {
|
|
|
276
897
|
danger: process.env[`${prefix}DANGER`],
|
|
277
898
|
fatal: process.env[`${prefix}FATAL`],
|
|
278
899
|
positive: process.env[`${prefix}POSITIVE`],
|
|
279
|
-
negative: process.env[`${prefix}NEGATIVE`]
|
|
900
|
+
negative: process.env[`${prefix}NEGATIVE`],
|
|
901
|
+
gradient
|
|
280
902
|
};
|
|
281
903
|
};
|
|
282
904
|
|
|
@@ -407,11 +1029,12 @@ var setConfigEnv = (config) => {
|
|
|
407
1029
|
process.env[`${prefix}TIMEZONE`] = config.timezone;
|
|
408
1030
|
process.env.TZ = config.timezone;
|
|
409
1031
|
process.env.DEFAULT_TIMEZONE = config.timezone;
|
|
1032
|
+
process.env.TIMEZONE = config.timezone;
|
|
410
1033
|
}
|
|
411
1034
|
if (config.locale) {
|
|
412
1035
|
process.env[`${prefix}LOCALE`] = config.locale;
|
|
413
|
-
process.env.LOCALE = config.locale;
|
|
414
1036
|
process.env.DEFAULT_LOCALE = config.locale;
|
|
1037
|
+
process.env.LOCALE = config.locale;
|
|
415
1038
|
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
416
1039
|
}
|
|
417
1040
|
if (config.configFile) {
|
|
@@ -572,6 +1195,11 @@ var setSingleThemeColorConfigEnv = (prefix, config) => {
|
|
|
572
1195
|
if (config.negative) {
|
|
573
1196
|
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
574
1197
|
}
|
|
1198
|
+
if (config.gradient) {
|
|
1199
|
+
for (let i = 0; i < config.gradient.length; i++) {
|
|
1200
|
+
process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
|
|
1201
|
+
}
|
|
1202
|
+
}
|
|
575
1203
|
};
|
|
576
1204
|
var setMultiThemeColorConfigEnv = (prefix, config) => {
|
|
577
1205
|
return {
|
|
@@ -622,6 +1250,11 @@ var setBaseThemeColorConfigEnv = (prefix, config) => {
|
|
|
622
1250
|
if (config.negative) {
|
|
623
1251
|
process.env[`${prefix}NEGATIVE`] = config.negative;
|
|
624
1252
|
}
|
|
1253
|
+
if (config.gradient) {
|
|
1254
|
+
for (let i = 0; i < config.gradient.length; i++) {
|
|
1255
|
+
process.env[`${prefix}GRADIENT_${i}`] = config.gradient[i];
|
|
1256
|
+
}
|
|
1257
|
+
}
|
|
625
1258
|
};
|
|
626
1259
|
|
|
627
1260
|
// ../config-tools/src/create-storm-config.ts
|
|
@@ -729,6 +1362,9 @@ var getWorkspaceConfig = (skipLogs = true, options = {}) => {
|
|
|
729
1362
|
};
|
|
730
1363
|
|
|
731
1364
|
export {
|
|
1365
|
+
joinPaths,
|
|
1366
|
+
findWorkspaceRoot,
|
|
1367
|
+
stormWorkspaceConfigSchema,
|
|
732
1368
|
getConfig,
|
|
733
1369
|
getWorkspaceConfig
|
|
734
1370
|
};
|