@storm-software/cloudflare-tools 0.55.85 → 0.55.87
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 +24 -0
- package/README.md +1 -1
- package/dist/{chunk-VTHBMY4B.js → chunk-6XDOBG77.js} +39 -28
- package/dist/{chunk-FUE3PSOC.mjs → chunk-CW6SXRL4.mjs} +825 -544
- package/dist/{chunk-VRLPVMXP.mjs → chunk-FABNT5TZ.mjs} +15 -13
- package/dist/{chunk-QQJ225UZ.mjs → chunk-GPAI4NHQ.mjs} +141 -87
- package/dist/{chunk-YNJJF3XM.mjs → chunk-H4XWGL24.mjs} +93 -56
- package/dist/{chunk-IVLCYFXD.js → chunk-HBASMEU5.js} +168 -114
- package/dist/{chunk-6B5PUF7X.js → chunk-HIUZ6UL7.js} +97 -47
- package/dist/{chunk-R7AIVBS7.js → chunk-I4P7DVDN.js} +19 -24
- package/dist/{chunk-KWHACLHR.mjs → chunk-ISGKIYF5.mjs} +92 -42
- package/dist/{chunk-5RE7UZTH.mjs → chunk-L4WFYC7K.mjs} +39 -28
- package/dist/{chunk-PWYTCJYX.js → chunk-LDHIZ5T7.js} +875 -594
- package/dist/{chunk-J5SB6L2L.js → chunk-MCKGQKYU.js} +2 -5
- package/dist/{chunk-DEJ5S46A.mjs → chunk-MV24QW26.mjs} +195 -127
- package/dist/{chunk-V7LBWOVV.js → chunk-PZ5CI56F.js} +196 -128
- package/dist/{chunk-AOEF7EWN.mjs → chunk-QPABB45G.mjs} +19 -24
- package/dist/{chunk-TLFPZXKG.mjs → chunk-QQ22YQSB.mjs} +3 -6
- package/dist/{chunk-QGRENI3O.js → chunk-RIUVF72K.js} +17 -15
- package/dist/{chunk-PKQBY4ZM.js → chunk-X4Y76AIM.js} +26 -20
- package/dist/{chunk-CNGX2WYG.js → chunk-XCEENUJB.js} +93 -58
- package/dist/{chunk-N4KJP2OA.mjs → chunk-YJOYATEB.mjs} +27 -21
- package/dist/executors.js +8 -8
- package/dist/executors.mjs +8 -8
- package/dist/generators.js +6 -6
- package/dist/generators.mjs +5 -5
- package/dist/index.js +41 -49
- package/dist/index.mjs +40 -48
- package/dist/src/executors/cloudflare-publish/executor.js +7 -7
- package/dist/src/executors/cloudflare-publish/executor.mjs +6 -6
- package/dist/src/executors/r2-upload-publish/executor.js +7 -7
- package/dist/src/executors/r2-upload-publish/executor.mjs +6 -6
- package/dist/src/executors/serve/executor.js +49 -50
- package/dist/src/executors/serve/executor.mjs +48 -49
- package/dist/src/generators/init/generator.js +3 -3
- package/dist/src/generators/init/generator.mjs +2 -2
- package/dist/src/generators/worker/generator.js +6 -6
- package/dist/src/generators/worker/generator.mjs +5 -5
- package/dist/src/utils/index.js +4 -4
- package/dist/src/utils/index.mjs +3 -3
- package/dist/src/utils/r2-bucket-helpers.js +4 -4
- package/dist/src/utils/r2-bucket-helpers.mjs +3 -3
- package/dist/tsup.config.js +3 -8
- package/dist/tsup.config.mjs +3 -8
- package/package.json +1 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
generator_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-YJOYATEB.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getConfig
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-GPAI4NHQ.mjs";
|
|
7
7
|
import {
|
|
8
8
|
findWorkspaceRoot,
|
|
9
9
|
getStopwatch,
|
|
@@ -12,14 +12,24 @@ import {
|
|
|
12
12
|
writeFatal,
|
|
13
13
|
writeInfo,
|
|
14
14
|
writeTrace
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-MV24QW26.mjs";
|
|
16
16
|
import {
|
|
17
|
-
__dirname
|
|
18
|
-
|
|
19
|
-
} from "./chunk-TLFPZXKG.mjs";
|
|
17
|
+
__dirname
|
|
18
|
+
} from "./chunk-QQ22YQSB.mjs";
|
|
20
19
|
|
|
21
20
|
// src/generators/worker/generator.ts
|
|
22
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
convertNxGenerator,
|
|
23
|
+
ensurePackage,
|
|
24
|
+
formatFiles,
|
|
25
|
+
generateFiles,
|
|
26
|
+
joinPathFragments,
|
|
27
|
+
names,
|
|
28
|
+
readProjectConfiguration,
|
|
29
|
+
runTasksInSerial,
|
|
30
|
+
updateJson,
|
|
31
|
+
updateProjectConfiguration
|
|
32
|
+
} from "@nx/devkit";
|
|
23
33
|
import { determineProjectNameAndRootOptions } from "@nx/devkit/src/generators/project-name-and-root-utils";
|
|
24
34
|
import { applicationGenerator as nodeApplicationGenerator } from "@nx/node";
|
|
25
35
|
import { nxVersion } from "@nx/node/src/utils/versions";
|
|
@@ -29,7 +39,6 @@ import { join } from "path";
|
|
|
29
39
|
function getAccountId(accountId) {
|
|
30
40
|
return `account_id = "${accountId}"`;
|
|
31
41
|
}
|
|
32
|
-
__name(getAccountId, "getAccountId");
|
|
33
42
|
|
|
34
43
|
// src/generators/worker/libs/vitest-imports.ts
|
|
35
44
|
var vitestImports = `import { describe, expect, it, beforeAll, afterAll } from 'vitest';`;
|
|
@@ -46,27 +55,40 @@ async function applicationGenerator(tree, schema) {
|
|
|
46
55
|
|
|
47
56
|
`, config);
|
|
48
57
|
const workspaceRoot = findWorkspaceRoot();
|
|
49
|
-
writeDebug(
|
|
50
|
-
|
|
58
|
+
writeDebug(
|
|
59
|
+
`Loading the Storm Config from environment variables and storm.json file...
|
|
60
|
+
- workspaceRoot: ${workspaceRoot}`,
|
|
61
|
+
config
|
|
62
|
+
);
|
|
51
63
|
config = await getConfig(workspaceRoot);
|
|
52
|
-
writeTrace(
|
|
53
|
-
|
|
64
|
+
writeTrace(
|
|
65
|
+
`Loaded Storm config into env:
|
|
66
|
+
${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[key])}`).join("\n")}`,
|
|
67
|
+
config
|
|
68
|
+
);
|
|
54
69
|
const options = await normalizeOptions(tree, schema, config);
|
|
55
70
|
const tasks = [];
|
|
56
|
-
tasks.push(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
tasks.push(
|
|
72
|
+
await generator_default(tree, {
|
|
73
|
+
...options,
|
|
74
|
+
skipFormat: true
|
|
75
|
+
})
|
|
76
|
+
);
|
|
77
|
+
tasks.push(
|
|
78
|
+
await nodeApplicationGenerator(tree, {
|
|
79
|
+
...options,
|
|
80
|
+
framework: "none",
|
|
81
|
+
skipFormat: true,
|
|
82
|
+
unitTestRunner: options.unitTestRunner == "vitest" ? "none" : options.unitTestRunner,
|
|
83
|
+
e2eTestRunner: "none",
|
|
84
|
+
name: schema.name
|
|
85
|
+
})
|
|
86
|
+
);
|
|
68
87
|
if (options.unitTestRunner === "vitest") {
|
|
69
|
-
const { vitestGenerator, createOrEditViteConfig } = ensurePackage(
|
|
88
|
+
const { vitestGenerator, createOrEditViteConfig } = ensurePackage(
|
|
89
|
+
"@nx/vite",
|
|
90
|
+
nxVersion
|
|
91
|
+
);
|
|
70
92
|
const vitestTask = await vitestGenerator(tree, {
|
|
71
93
|
project: options.name,
|
|
72
94
|
uiFramework: "none",
|
|
@@ -75,12 +97,16 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[
|
|
|
75
97
|
testEnvironment: "node"
|
|
76
98
|
});
|
|
77
99
|
tasks.push(vitestTask);
|
|
78
|
-
createOrEditViteConfig(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
100
|
+
createOrEditViteConfig(
|
|
101
|
+
tree,
|
|
102
|
+
{
|
|
103
|
+
project: options.name,
|
|
104
|
+
includeLib: false,
|
|
105
|
+
includeVitest: true,
|
|
106
|
+
testEnvironment: "node"
|
|
107
|
+
},
|
|
108
|
+
true
|
|
109
|
+
);
|
|
84
110
|
}
|
|
85
111
|
addCloudflareFiles(tree, options);
|
|
86
112
|
updateTsAppConfig(tree, options);
|
|
@@ -93,7 +119,10 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[
|
|
|
93
119
|
}
|
|
94
120
|
if (options.template === "hono") {
|
|
95
121
|
tasks.push(() => {
|
|
96
|
-
const packageJsonPath = joinPathFragments(
|
|
122
|
+
const packageJsonPath = joinPathFragments(
|
|
123
|
+
options.directory ?? "",
|
|
124
|
+
"package.json"
|
|
125
|
+
);
|
|
97
126
|
if (tree.exists(packageJsonPath)) {
|
|
98
127
|
updateJson(tree, packageJsonPath, (json) => ({
|
|
99
128
|
...json,
|
|
@@ -108,25 +137,28 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[
|
|
|
108
137
|
return runTasksInSerial(...tasks);
|
|
109
138
|
} catch (error) {
|
|
110
139
|
return () => {
|
|
111
|
-
writeFatal(
|
|
112
|
-
|
|
140
|
+
writeFatal(
|
|
141
|
+
"A fatal error occurred while running the generator - the process was forced to terminate",
|
|
142
|
+
config
|
|
143
|
+
);
|
|
144
|
+
writeError(
|
|
145
|
+
`An exception was thrown in the generator's process
|
|
113
146
|
- Details: ${error.message}
|
|
114
|
-
- Stacktrace: ${error.stack}`,
|
|
147
|
+
- Stacktrace: ${error.stack}`,
|
|
148
|
+
config
|
|
149
|
+
);
|
|
115
150
|
};
|
|
116
151
|
} finally {
|
|
117
152
|
stopwatch();
|
|
118
153
|
}
|
|
119
154
|
}
|
|
120
|
-
__name(applicationGenerator, "applicationGenerator");
|
|
121
155
|
function updateTsAppConfig(tree, options) {
|
|
122
156
|
updateJson(tree, join(options.appProjectRoot, "tsconfig.app.json"), (json) => {
|
|
123
157
|
json.compilerOptions = {
|
|
124
158
|
...json.compilerOptions,
|
|
125
159
|
esModuleInterop: true,
|
|
126
160
|
target: "es2021",
|
|
127
|
-
lib: [
|
|
128
|
-
"es2021"
|
|
129
|
-
],
|
|
161
|
+
lib: ["es2021"],
|
|
130
162
|
module: "es2022",
|
|
131
163
|
moduleResolution: "node",
|
|
132
164
|
resolveJsonModule: true,
|
|
@@ -146,28 +178,36 @@ function updateTsAppConfig(tree, options) {
|
|
|
146
178
|
return json;
|
|
147
179
|
});
|
|
148
180
|
}
|
|
149
|
-
__name(updateTsAppConfig, "updateTsAppConfig");
|
|
150
181
|
function addCloudflareFiles(tree, options) {
|
|
151
182
|
tree.delete(join(options.appProjectRoot, "src/main.ts"));
|
|
152
|
-
generateFiles(
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
vitestScript: options.unitTestRunner === "vitest" ? vitestScript : ""
|
|
158
|
-
});
|
|
159
|
-
if (options.template && options.template !== "none") {
|
|
160
|
-
generateFiles(tree, join(__dirname, `./files/${options.template}`), join(options.appProjectRoot, "src"), {
|
|
183
|
+
generateFiles(
|
|
184
|
+
tree,
|
|
185
|
+
join(__dirname, "./files/common"),
|
|
186
|
+
options.appProjectRoot,
|
|
187
|
+
{
|
|
161
188
|
...options,
|
|
162
189
|
tmpl: "",
|
|
163
190
|
name: options.name,
|
|
164
191
|
accountId: options.accountId ? getAccountId(options.accountId) : "",
|
|
165
|
-
vitestScript: options.unitTestRunner === "vitest" ? vitestScript : ""
|
|
166
|
-
|
|
167
|
-
|
|
192
|
+
vitestScript: options.unitTestRunner === "vitest" ? vitestScript : ""
|
|
193
|
+
}
|
|
194
|
+
);
|
|
195
|
+
if (options.template && options.template !== "none") {
|
|
196
|
+
generateFiles(
|
|
197
|
+
tree,
|
|
198
|
+
join(__dirname, `./files/${options.template}`),
|
|
199
|
+
join(options.appProjectRoot, "src"),
|
|
200
|
+
{
|
|
201
|
+
...options,
|
|
202
|
+
tmpl: "",
|
|
203
|
+
name: options.name,
|
|
204
|
+
accountId: options.accountId ? getAccountId(options.accountId) : "",
|
|
205
|
+
vitestScript: options.unitTestRunner === "vitest" ? vitestScript : "",
|
|
206
|
+
vitestImports: options.unitTestRunner === "vitest" ? vitestImports : ""
|
|
207
|
+
}
|
|
208
|
+
);
|
|
168
209
|
}
|
|
169
210
|
}
|
|
170
|
-
__name(addCloudflareFiles, "addCloudflareFiles");
|
|
171
211
|
function addTargets(tree, options) {
|
|
172
212
|
try {
|
|
173
213
|
const projectConfiguration = readProjectConfiguration(tree, options.name);
|
|
@@ -191,11 +231,9 @@ function addTargets(tree, options) {
|
|
|
191
231
|
console.error(e);
|
|
192
232
|
}
|
|
193
233
|
}
|
|
194
|
-
__name(addTargets, "addTargets");
|
|
195
234
|
function removeTestFiles(tree, options) {
|
|
196
235
|
tree.delete(join(options.appProjectRoot, "src", "index.test.ts"));
|
|
197
236
|
}
|
|
198
|
-
__name(removeTestFiles, "removeTestFiles");
|
|
199
237
|
async function normalizeOptions(host, options, config) {
|
|
200
238
|
const { projectName: appProjectName, projectRoot: appProjectRoot } = await determineProjectNameAndRootOptions(host, {
|
|
201
239
|
name: options.name,
|
|
@@ -217,7 +255,6 @@ async function normalizeOptions(host, options, config) {
|
|
|
217
255
|
port: options.port ?? 3e3
|
|
218
256
|
};
|
|
219
257
|
}
|
|
220
|
-
__name(normalizeOptions, "normalizeOptions");
|
|
221
258
|
var generator_default2 = applicationGenerator;
|
|
222
259
|
var applicationSchematic = convertNxGenerator(applicationGenerator);
|
|
223
260
|
|