@storm-software/cloudflare-tools 0.71.53 → 0.71.55
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/README.md +1 -1
- package/dist/{chunk-Z32NCHCF.mjs → chunk-276PU2JK.mjs} +4 -4
- package/dist/{chunk-BT5ICL3J.mjs → chunk-2VLUD7ES.mjs} +1 -1
- package/dist/{chunk-KDPVEDXB.mjs → chunk-74DC5UCP.mjs} +2 -2
- package/dist/chunk-C2B5Y63S.js +231 -0
- package/dist/chunk-C2TW7OEJ.mjs +269 -0
- package/dist/{chunk-SVDNIWTG.js → chunk-E7SXH3BE.js} +1 -1
- package/dist/{chunk-5YGEOERJ.js → chunk-J5TCUMBD.js} +4 -4
- package/dist/{chunk-6RLHG2N7.mjs → chunk-PTD74LWF.mjs} +1 -1
- package/dist/chunk-QTUMOPFF.mjs +231 -0
- package/dist/{chunk-NSRFFUDV.js → chunk-SZIF5PWY.js} +2 -2
- package/dist/chunk-VQ7CQDF7.js +266 -0
- package/dist/{chunk-XSHLEP6G.mjs → chunk-Y6QXVEOO.mjs} +5 -5
- package/dist/executors.js +1 -1
- package/dist/executors.mjs +3 -3
- package/dist/generators.js +3 -3
- package/dist/generators.mjs +3 -3
- package/dist/index.js +4 -4
- package/dist/index.mjs +5 -5
- package/dist/src/executors/cloudflare-publish/executor.js +1 -1
- package/dist/src/executors/cloudflare-publish/executor.mjs +3 -3
- package/dist/src/executors/r2-upload-publish/executor.mjs +1 -1
- package/dist/src/executors/serve/executor.js +2 -2
- package/dist/src/executors/serve/executor.mjs +2 -2
- package/dist/src/generators/init/generator.js +2 -2
- package/dist/src/generators/init/generator.mjs +2 -2
- package/dist/src/generators/worker/generator.js +3 -3
- package/dist/src/generators/worker/generator.mjs +3 -3
- package/dist/src/utils/http-handler.mjs +1 -1
- package/dist/src/utils/index.mjs +1 -1
- package/dist/src/utils/r2-bucket-helpers.mjs +1 -1
- package/dist/tsup.config.mjs +1 -1
- package/package.json +5 -5
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createCliOptions,
|
|
3
|
+
getPackageInfo
|
|
4
|
+
} from "./chunk-3MAI3FU2.mjs";
|
|
5
|
+
import {
|
|
6
|
+
findWorkspaceRoot,
|
|
7
|
+
getConfig
|
|
8
|
+
} from "./chunk-P42MQNVF.mjs";
|
|
9
|
+
import {
|
|
10
|
+
createHttpHandler
|
|
11
|
+
} from "./chunk-SWYYMID7.mjs";
|
|
12
|
+
import {
|
|
13
|
+
getEncoding,
|
|
14
|
+
getInternalDependencies,
|
|
15
|
+
uploadFile
|
|
16
|
+
} from "./chunk-OPXJUL5V.mjs";
|
|
17
|
+
import {
|
|
18
|
+
correctPaths,
|
|
19
|
+
joinPaths,
|
|
20
|
+
writeDebug,
|
|
21
|
+
writeSuccess,
|
|
22
|
+
writeTrace,
|
|
23
|
+
writeWarning
|
|
24
|
+
} from "./chunk-52X4GPEN.mjs";
|
|
25
|
+
|
|
26
|
+
// src/executors/r2-upload-publish/executor.ts
|
|
27
|
+
import {
|
|
28
|
+
DeleteObjectsCommand,
|
|
29
|
+
ListObjectsCommand,
|
|
30
|
+
S3Client
|
|
31
|
+
} from "@aws-sdk/client-s3";
|
|
32
|
+
import {
|
|
33
|
+
createProjectGraphAsync,
|
|
34
|
+
readCachedProjectGraph
|
|
35
|
+
} from "@nx/devkit";
|
|
36
|
+
import { glob } from "glob";
|
|
37
|
+
import mime from "mime-types";
|
|
38
|
+
import { execSync } from "node:child_process";
|
|
39
|
+
import { statSync } from "node:fs";
|
|
40
|
+
import { readFile } from "node:fs/promises";
|
|
41
|
+
async function runExecutor(options, context) {
|
|
42
|
+
const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
|
|
43
|
+
if (!context.projectName) {
|
|
44
|
+
throw new Error("The executor requires a projectName.");
|
|
45
|
+
}
|
|
46
|
+
if (!options.path) {
|
|
47
|
+
throw new Error("The executor requires the `path` option to upload.");
|
|
48
|
+
}
|
|
49
|
+
console.info(
|
|
50
|
+
`\u{1F680} Running Storm Cloudflare Publish executor on the ${context.projectName} worker`
|
|
51
|
+
);
|
|
52
|
+
if (!context.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
|
|
53
|
+
throw new Error("The executor requires projectsConfigurations.");
|
|
54
|
+
}
|
|
55
|
+
try {
|
|
56
|
+
const workspaceRoot = findWorkspaceRoot();
|
|
57
|
+
const config = await getConfig(workspaceRoot);
|
|
58
|
+
const projectName = context.projectsConfigurations.projects[context.projectName]?.name ?? context.projectName;
|
|
59
|
+
const projectDetails = getPackageInfo(
|
|
60
|
+
context.projectsConfigurations.projects[context.projectName]
|
|
61
|
+
);
|
|
62
|
+
const bucketId = options.bucketId;
|
|
63
|
+
const bucketPath = options.bucketPath || "/";
|
|
64
|
+
if (!bucketId) {
|
|
65
|
+
throw new Error("The executor requires a bucketId.");
|
|
66
|
+
}
|
|
67
|
+
const args = createCliOptions({ ...options });
|
|
68
|
+
if (isDryRun) {
|
|
69
|
+
args.push("--dry-run");
|
|
70
|
+
}
|
|
71
|
+
const cloudflareAccountId = process.env.CLOUDFLARE_ACCOUNT_ID || process.env.STORM_BOT_CLOUDFLARE_ACCOUNT;
|
|
72
|
+
if (!options?.registry && !cloudflareAccountId) {
|
|
73
|
+
throw new Error(
|
|
74
|
+
"The registry option and `CLOUDFLARE_ACCOUNT_ID` (or `STORM_BOT_CLOUDFLARE_ACCOUNT`) environment variable are not set. Please set one of these values to upload to the Cloudflare R2 bucket."
|
|
75
|
+
);
|
|
76
|
+
}
|
|
77
|
+
if (!process.env.STORM_BOT_ACCESS_KEY_ID && !process.env.ACCESS_KEY_ID && !process.env.CLOUDFLARE_ACCESS_KEY_ID && !process.env.AWS_ACCESS_KEY_ID || !process.env.STORM_BOT_SECRET_ACCESS_KEY && !process.env.CLOUDFLARE_SECRET_ACCESS_KEY && !process.env.SECRET_ACCESS_KEY && !process.env.AWS_SECRET_ACCESS_KEY) {
|
|
78
|
+
throw new Error(
|
|
79
|
+
"The `ACCESS_KEY_ID` (or `STORM_BOT_ACCESS_KEY_ID`) and `SECRET_ACCESS_KEY` (or `STORM_BOT_SECRET_ACCESS_KEY`) environment variables are not set. Please set these environment variables to upload to the Cloudflare R2 bucket."
|
|
80
|
+
);
|
|
81
|
+
}
|
|
82
|
+
const registry = options?.registry ? options.registry : `https://${cloudflareAccountId}.r2.cloudflarestorage.com`;
|
|
83
|
+
let projectGraph;
|
|
84
|
+
try {
|
|
85
|
+
projectGraph = readCachedProjectGraph();
|
|
86
|
+
} catch {
|
|
87
|
+
await createProjectGraphAsync();
|
|
88
|
+
projectGraph = readCachedProjectGraph();
|
|
89
|
+
}
|
|
90
|
+
if (!projectGraph) {
|
|
91
|
+
throw new Error(
|
|
92
|
+
"The executor failed because the project graph is not available. Please run the build command again."
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
writeDebug(
|
|
96
|
+
`Publishing ${context.projectName} to the ${bucketId} R2 Bucket (at ${registry})`
|
|
97
|
+
);
|
|
98
|
+
const client = new S3Client({
|
|
99
|
+
region: "auto",
|
|
100
|
+
endpoint: registry,
|
|
101
|
+
credentials: {
|
|
102
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
103
|
+
accessKeyId: process.env.STORM_BOT_ACCESS_KEY_ID || process.env.CLOUDFLARE_ACCESS_KEY_ID || process.env.AWS_ACCESS_KEY_ID || process.env.ACCESS_KEY_ID,
|
|
104
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
105
|
+
secretAccessKey: process.env.STORM_BOT_SECRET_ACCESS_KEY || process.env.CLOUDFLARE_SECRET_ACCESS_KEY || process.env.AWS_SECRET_ACCESS_KEY || process.env.SECRET_ACCESS_KEY
|
|
106
|
+
},
|
|
107
|
+
requestHandler: createHttpHandler()
|
|
108
|
+
});
|
|
109
|
+
const version = projectDetails?.content?.version;
|
|
110
|
+
if (version) {
|
|
111
|
+
writeDebug(`Starting upload version ${version}`);
|
|
112
|
+
}
|
|
113
|
+
const basePath = options.path;
|
|
114
|
+
const files = await glob(joinPaths(basePath, "**/*"), {
|
|
115
|
+
ignore: "**/{*.stories.tsx,*.stories.ts,*.spec.tsx,*.spec.ts}"
|
|
116
|
+
});
|
|
117
|
+
const internalDependencies = await getInternalDependencies(
|
|
118
|
+
context.projectName,
|
|
119
|
+
projectGraph
|
|
120
|
+
);
|
|
121
|
+
const dependencies = internalDependencies.filter(
|
|
122
|
+
(projectNode) => !projectNode.data.tags || projectNode.data.tags.every((tag) => tag.toLowerCase() !== "component")
|
|
123
|
+
).reduce((ret, dep) => {
|
|
124
|
+
if (!ret[dep.name]) {
|
|
125
|
+
ret[dep.name] = "latest";
|
|
126
|
+
}
|
|
127
|
+
return ret;
|
|
128
|
+
}, projectDetails?.content.dependencies ?? {});
|
|
129
|
+
const release = options.tag ?? execSync("npm config get tag").toString().trim();
|
|
130
|
+
if (options.clean === true) {
|
|
131
|
+
writeDebug(`Clearing out existing items in ${bucketPath}`);
|
|
132
|
+
if (!isDryRun) {
|
|
133
|
+
const response = await client.send(
|
|
134
|
+
new ListObjectsCommand({
|
|
135
|
+
Bucket: bucketId,
|
|
136
|
+
Prefix: !bucketPath || bucketPath === "/" ? void 0 : bucketPath
|
|
137
|
+
})
|
|
138
|
+
);
|
|
139
|
+
if (response?.Contents && response.Contents.length > 0) {
|
|
140
|
+
writeTrace(
|
|
141
|
+
`Deleting the following existing items from the R2 bucket path ${bucketPath}: ${response.Contents.map((item) => item.Key).join(", ")}`
|
|
142
|
+
);
|
|
143
|
+
await client.send(
|
|
144
|
+
new DeleteObjectsCommand({
|
|
145
|
+
Bucket: bucketId,
|
|
146
|
+
Delete: {
|
|
147
|
+
Objects: response.Contents.map((item) => ({
|
|
148
|
+
Key: item.Key
|
|
149
|
+
})),
|
|
150
|
+
Quiet: false
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
);
|
|
154
|
+
} else {
|
|
155
|
+
writeDebug(
|
|
156
|
+
`No existing items to delete in the R2 bucket path ${bucketPath}`
|
|
157
|
+
);
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
writeWarning("[Dry run]: Skipping R2 bucket clean.");
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
if (options.writeMetaJson === true) {
|
|
164
|
+
const meta = {
|
|
165
|
+
name: context.projectName,
|
|
166
|
+
version,
|
|
167
|
+
release,
|
|
168
|
+
description: projectDetails?.content?.description,
|
|
169
|
+
tags: projectDetails?.content?.keywords,
|
|
170
|
+
dependencies,
|
|
171
|
+
devDependencies: null,
|
|
172
|
+
internalDependencies: internalDependencies.filter(
|
|
173
|
+
(projectNode) => projectNode.data.tags && projectNode.data.tags.some(
|
|
174
|
+
(tag) => tag.toLowerCase() === "component"
|
|
175
|
+
)
|
|
176
|
+
).map((dep) => dep.name)
|
|
177
|
+
};
|
|
178
|
+
if (projectDetails?.type === "package.json") {
|
|
179
|
+
meta.devDependencies = projectDetails?.content?.devDependencies;
|
|
180
|
+
}
|
|
181
|
+
await uploadFile(
|
|
182
|
+
client,
|
|
183
|
+
bucketId,
|
|
184
|
+
bucketPath,
|
|
185
|
+
"meta.json",
|
|
186
|
+
version,
|
|
187
|
+
JSON.stringify(meta),
|
|
188
|
+
"application/json",
|
|
189
|
+
isDryRun
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
await Promise.all(
|
|
193
|
+
files.map(async (file) => {
|
|
194
|
+
if (statSync(file, {
|
|
195
|
+
throwIfNoEntry: false
|
|
196
|
+
})?.isFile()) {
|
|
197
|
+
const name = correctPaths(file).replace(correctPaths(basePath), "");
|
|
198
|
+
const type = mime.lookup(name) || "application/octet-stream";
|
|
199
|
+
await uploadFile(
|
|
200
|
+
client,
|
|
201
|
+
bucketId,
|
|
202
|
+
bucketPath,
|
|
203
|
+
name,
|
|
204
|
+
version,
|
|
205
|
+
await readFile(file, getEncoding(type)),
|
|
206
|
+
type,
|
|
207
|
+
isDryRun
|
|
208
|
+
);
|
|
209
|
+
}
|
|
210
|
+
})
|
|
211
|
+
);
|
|
212
|
+
writeSuccess(
|
|
213
|
+
`Successfully uploaded the ${projectName} project to the Cloudflare R2 bucket.`,
|
|
214
|
+
config
|
|
215
|
+
);
|
|
216
|
+
return {
|
|
217
|
+
success: true
|
|
218
|
+
};
|
|
219
|
+
} catch (error) {
|
|
220
|
+
console.error("Failed to publish to Cloudflare R2 bucket");
|
|
221
|
+
console.error(error);
|
|
222
|
+
console.log("");
|
|
223
|
+
return {
|
|
224
|
+
success: false
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export {
|
|
230
|
+
runExecutor
|
|
231
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkJ5TCUMBDjs = require('./chunk-J5TCUMBD.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -70,7 +70,7 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[
|
|
|
70
70
|
const options = await normalizeOptions(tree, schema, config);
|
|
71
71
|
const tasks = [];
|
|
72
72
|
tasks.push(
|
|
73
|
-
await
|
|
73
|
+
await _chunkJ5TCUMBDjs.generator_default.call(void 0, tree, {
|
|
74
74
|
...options,
|
|
75
75
|
skipFormat: true
|
|
76
76
|
})
|
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkQWSTQIUAjs = require('./chunk-QWSTQIUA.js');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
var _chunk2KWRE5Y5js = require('./chunk-2KWRE5Y5.js');
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
var _chunkJ5TCUMBDjs = require('./chunk-J5TCUMBD.js');
|
|
17
|
+
|
|
18
|
+
// src/generators/worker/generator.ts
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
var _devkit = require('@nx/devkit');
|
|
31
|
+
var _projectnameandrootutils = require('@nx/devkit/src/generators/project-name-and-root-utils');
|
|
32
|
+
var _node = require('@nx/node');
|
|
33
|
+
var _versions = require('@nx/node/src/utils/versions');
|
|
34
|
+
var _path = require('path');
|
|
35
|
+
|
|
36
|
+
// src/generators/worker/libs/get-account-id.ts
|
|
37
|
+
function getAccountId(accountId) {
|
|
38
|
+
return `account_id = "${accountId}"`;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
// src/generators/worker/libs/vitest-imports.ts
|
|
42
|
+
var vitestImports = `import { describe, expect, it, beforeAll, afterAll } from 'vitest';`;
|
|
43
|
+
|
|
44
|
+
// src/generators/worker/libs/vitest-script.ts
|
|
45
|
+
var vitestScript = `"test": "vitest run"`;
|
|
46
|
+
|
|
47
|
+
// src/generators/worker/generator.ts
|
|
48
|
+
async function applicationGenerator(tree, schema) {
|
|
49
|
+
const stopwatch = _chunk2KWRE5Y5js.getStopwatch.call(void 0, "Storm Worker generator");
|
|
50
|
+
let config;
|
|
51
|
+
try {
|
|
52
|
+
const workspaceRoot = _chunkQWSTQIUAjs.findWorkspaceRoot.call(void 0, );
|
|
53
|
+
config = await _chunkQWSTQIUAjs.getConfig.call(void 0, workspaceRoot);
|
|
54
|
+
_chunk2KWRE5Y5js.writeInfo.call(void 0,
|
|
55
|
+
`${_chunk2KWRE5Y5js.brandIcon.call(void 0, config)} Running the Storm Worker generator...
|
|
56
|
+
|
|
57
|
+
`,
|
|
58
|
+
config
|
|
59
|
+
);
|
|
60
|
+
_chunk2KWRE5Y5js.writeDebug.call(void 0,
|
|
61
|
+
`Loading the Storm Config from environment variables and storm.json file...
|
|
62
|
+
- workspaceRoot: ${workspaceRoot}`,
|
|
63
|
+
config
|
|
64
|
+
);
|
|
65
|
+
_chunk2KWRE5Y5js.writeTrace.call(void 0,
|
|
66
|
+
`Loaded Storm config into env:
|
|
67
|
+
${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[key])}`).join("\n")}`,
|
|
68
|
+
config
|
|
69
|
+
);
|
|
70
|
+
const options = await normalizeOptions(tree, schema, config);
|
|
71
|
+
const tasks = [];
|
|
72
|
+
tasks.push(
|
|
73
|
+
await _chunkJ5TCUMBDjs.generator_default.call(void 0, tree, {
|
|
74
|
+
...options,
|
|
75
|
+
skipFormat: true
|
|
76
|
+
})
|
|
77
|
+
);
|
|
78
|
+
tasks.push(
|
|
79
|
+
await _node.applicationGenerator.call(void 0, tree, {
|
|
80
|
+
...options,
|
|
81
|
+
framework: "none",
|
|
82
|
+
skipFormat: true,
|
|
83
|
+
unitTestRunner: options.unitTestRunner == "vitest" ? "none" : options.unitTestRunner,
|
|
84
|
+
e2eTestRunner: "none",
|
|
85
|
+
name: schema.name
|
|
86
|
+
})
|
|
87
|
+
);
|
|
88
|
+
if (options.unitTestRunner === "vitest") {
|
|
89
|
+
const { vitestGenerator, createOrEditViteConfig } = _devkit.ensurePackage.call(void 0,
|
|
90
|
+
"@nx/vite",
|
|
91
|
+
_versions.nxVersion
|
|
92
|
+
);
|
|
93
|
+
const vitestTask = await vitestGenerator(tree, {
|
|
94
|
+
project: options.name,
|
|
95
|
+
uiFramework: "none",
|
|
96
|
+
coverageProvider: "v8",
|
|
97
|
+
skipFormat: true,
|
|
98
|
+
testEnvironment: "node"
|
|
99
|
+
});
|
|
100
|
+
tasks.push(vitestTask);
|
|
101
|
+
createOrEditViteConfig(
|
|
102
|
+
tree,
|
|
103
|
+
{
|
|
104
|
+
project: options.name,
|
|
105
|
+
includeLib: false,
|
|
106
|
+
includeVitest: true,
|
|
107
|
+
testEnvironment: "node"
|
|
108
|
+
},
|
|
109
|
+
true
|
|
110
|
+
);
|
|
111
|
+
}
|
|
112
|
+
addCloudflareFiles(tree, options);
|
|
113
|
+
updateTsAppConfig(tree, options);
|
|
114
|
+
addTargets(tree, options);
|
|
115
|
+
if (options.unitTestRunner === "none") {
|
|
116
|
+
removeTestFiles(tree, options);
|
|
117
|
+
}
|
|
118
|
+
if (!options.skipFormat) {
|
|
119
|
+
await _devkit.formatFiles.call(void 0, tree);
|
|
120
|
+
}
|
|
121
|
+
if (options.template === "hono") {
|
|
122
|
+
tasks.push(() => {
|
|
123
|
+
const packageJsonPath = _devkit.joinPathFragments.call(void 0,
|
|
124
|
+
_nullishCoalesce(options.directory, () => ( "")),
|
|
125
|
+
"package.json"
|
|
126
|
+
);
|
|
127
|
+
if (tree.exists(packageJsonPath)) {
|
|
128
|
+
_devkit.updateJson.call(void 0, tree, packageJsonPath, (json) => ({
|
|
129
|
+
...json,
|
|
130
|
+
dependencies: {
|
|
131
|
+
hono: "4.4.0",
|
|
132
|
+
..._optionalChain([json, 'optionalAccess', _ => _.dependencies])
|
|
133
|
+
}
|
|
134
|
+
}));
|
|
135
|
+
}
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
return _devkit.runTasksInSerial.call(void 0, ...tasks);
|
|
139
|
+
} catch (error) {
|
|
140
|
+
return () => {
|
|
141
|
+
_chunk2KWRE5Y5js.writeFatal.call(void 0,
|
|
142
|
+
"A fatal error occurred while running the generator - the process was forced to terminate",
|
|
143
|
+
config
|
|
144
|
+
);
|
|
145
|
+
_chunk2KWRE5Y5js.writeError.call(void 0,
|
|
146
|
+
`An exception was thrown in the generator's process
|
|
147
|
+
- Details: ${error.message}
|
|
148
|
+
- Stacktrace: ${error.stack}`,
|
|
149
|
+
config
|
|
150
|
+
);
|
|
151
|
+
};
|
|
152
|
+
} finally {
|
|
153
|
+
stopwatch();
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
function updateTsAppConfig(tree, options) {
|
|
157
|
+
_devkit.updateJson.call(void 0, tree, _path.join.call(void 0, options.appProjectRoot, "tsconfig.app.json"), (json) => {
|
|
158
|
+
json.compilerOptions = {
|
|
159
|
+
...json.compilerOptions,
|
|
160
|
+
esModuleInterop: true,
|
|
161
|
+
target: "es2021",
|
|
162
|
+
lib: ["es2021"],
|
|
163
|
+
module: "es2022",
|
|
164
|
+
moduleResolution: "node",
|
|
165
|
+
resolveJsonModule: true,
|
|
166
|
+
allowJs: true,
|
|
167
|
+
checkJs: false,
|
|
168
|
+
noEmit: true,
|
|
169
|
+
isolatedModules: true,
|
|
170
|
+
allowSyntheticDefaultImports: true,
|
|
171
|
+
forceConsistentCasingInFileNames: true,
|
|
172
|
+
strict: true,
|
|
173
|
+
skipLibCheck: true
|
|
174
|
+
};
|
|
175
|
+
json.compilerOptions.types = [
|
|
176
|
+
...json.compilerOptions.types,
|
|
177
|
+
"@cloudflare/workers-types"
|
|
178
|
+
];
|
|
179
|
+
return json;
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
function addCloudflareFiles(tree, options) {
|
|
183
|
+
tree.delete(_path.join.call(void 0, options.appProjectRoot, "src/main.ts"));
|
|
184
|
+
_devkit.generateFiles.call(void 0,
|
|
185
|
+
tree,
|
|
186
|
+
_path.join.call(void 0, __dirname, "./files/common"),
|
|
187
|
+
options.appProjectRoot,
|
|
188
|
+
{
|
|
189
|
+
...options,
|
|
190
|
+
tmpl: "",
|
|
191
|
+
name: options.name,
|
|
192
|
+
accountId: options.accountId ? getAccountId(options.accountId) : "",
|
|
193
|
+
vitestScript: options.unitTestRunner === "vitest" ? vitestScript : ""
|
|
194
|
+
}
|
|
195
|
+
);
|
|
196
|
+
if (options.template && options.template !== "none") {
|
|
197
|
+
_devkit.generateFiles.call(void 0,
|
|
198
|
+
tree,
|
|
199
|
+
_path.join.call(void 0, __dirname, `./files/${options.template}`),
|
|
200
|
+
_path.join.call(void 0, options.appProjectRoot, "src"),
|
|
201
|
+
{
|
|
202
|
+
...options,
|
|
203
|
+
tmpl: "",
|
|
204
|
+
name: options.name,
|
|
205
|
+
accountId: options.accountId ? getAccountId(options.accountId) : "",
|
|
206
|
+
vitestScript: options.unitTestRunner === "vitest" ? vitestScript : "",
|
|
207
|
+
vitestImports: options.unitTestRunner === "vitest" ? vitestImports : ""
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
function addTargets(tree, options) {
|
|
213
|
+
try {
|
|
214
|
+
const projectConfiguration = _devkit.readProjectConfiguration.call(void 0, tree, options.name);
|
|
215
|
+
projectConfiguration.targets = {
|
|
216
|
+
..._nullishCoalesce(projectConfiguration.targets, () => ( {})),
|
|
217
|
+
serve: {
|
|
218
|
+
executor: "@storm-software/cloudflare-tools:serve",
|
|
219
|
+
options: {
|
|
220
|
+
port: options.port
|
|
221
|
+
}
|
|
222
|
+
},
|
|
223
|
+
"nx-release-publish": {
|
|
224
|
+
executor: "@storm-software/cloudflare-tools:cloudflare-publish"
|
|
225
|
+
}
|
|
226
|
+
};
|
|
227
|
+
if (projectConfiguration.targets.build) {
|
|
228
|
+
delete projectConfiguration.targets.build;
|
|
229
|
+
}
|
|
230
|
+
_devkit.updateProjectConfiguration.call(void 0, tree, options.name, projectConfiguration);
|
|
231
|
+
} catch (e) {
|
|
232
|
+
console.error(e);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
function removeTestFiles(tree, options) {
|
|
236
|
+
tree.delete(_path.join.call(void 0, options.appProjectRoot, "src", "index.test.ts"));
|
|
237
|
+
}
|
|
238
|
+
async function normalizeOptions(host, options, config) {
|
|
239
|
+
const { projectName: appProjectName, projectRoot: appProjectRoot } = await _projectnameandrootutils.determineProjectNameAndRootOptions.call(void 0, host, {
|
|
240
|
+
name: options.name,
|
|
241
|
+
projectType: "application",
|
|
242
|
+
directory: options.directory,
|
|
243
|
+
rootProject: options.rootProject
|
|
244
|
+
});
|
|
245
|
+
options.rootProject = appProjectRoot === ".";
|
|
246
|
+
return {
|
|
247
|
+
addPlugin: process.env.NX_ADD_PLUGINS !== "false",
|
|
248
|
+
accountId: process.env.STORM_BOT_CLOUDFLARE_ACCOUNT,
|
|
249
|
+
...options,
|
|
250
|
+
name: _devkit.names.call(void 0, appProjectName).fileName,
|
|
251
|
+
frontendProject: options.frontendProject ? _devkit.names.call(void 0, options.frontendProject).fileName : void 0,
|
|
252
|
+
appProjectRoot,
|
|
253
|
+
unitTestRunner: _nullishCoalesce(options.unitTestRunner, () => ( "vitest")),
|
|
254
|
+
rootProject: _nullishCoalesce(options.rootProject, () => ( false)),
|
|
255
|
+
template: _nullishCoalesce(options.template, () => ( "fetch-handler")),
|
|
256
|
+
port: _nullishCoalesce(options.port, () => ( 3e3))
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
var generator_default2 = applicationGenerator;
|
|
260
|
+
var applicationSchematic = _devkit.convertNxGenerator.call(void 0, applicationGenerator);
|
|
261
|
+
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
|
|
266
|
+
exports.applicationGenerator = applicationGenerator; exports.generator_default = generator_default2; exports.applicationSchematic = applicationSchematic;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__commonJS
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-2VLUD7ES.mjs";
|
|
4
4
|
|
|
5
5
|
// package.json
|
|
6
6
|
var require_package = __commonJS({
|
|
7
7
|
"package.json"(exports, module) {
|
|
8
8
|
module.exports = {
|
|
9
9
|
name: "@storm-software/cloudflare-tools",
|
|
10
|
-
version: "0.71.
|
|
10
|
+
version: "0.71.54",
|
|
11
11
|
description: "A Nx plugin package that contains various executors, generators, and utilities that assist in managing Cloudflare services.",
|
|
12
12
|
repository: {
|
|
13
13
|
type: "github",
|
|
@@ -136,9 +136,9 @@ var require_package = __commonJS({
|
|
|
136
136
|
"@nx/js": "catalog:",
|
|
137
137
|
"@nx/node": "catalog:",
|
|
138
138
|
"@nx/web": "catalog:",
|
|
139
|
-
"@storm-software/config": "1.135.
|
|
140
|
-
"@storm-software/config-tools": "1.189.
|
|
141
|
-
"@storm-software/workspace-tools": "1.294.
|
|
139
|
+
"@storm-software/config": "1.135.7",
|
|
140
|
+
"@storm-software/config-tools": "1.189.6",
|
|
141
|
+
"@storm-software/workspace-tools": "1.294.39",
|
|
142
142
|
nx: "catalog:",
|
|
143
143
|
tsup: "catalog:",
|
|
144
144
|
wrangler: ">=3.58.0"
|
package/dist/executors.js
CHANGED
|
@@ -3,7 +3,7 @@ require('./chunk-IH7USDLX.js');
|
|
|
3
3
|
require('./chunk-KUGEZPUO.js');
|
|
4
4
|
require('./chunk-6JVDTXHT.js');
|
|
5
5
|
require('./chunk-QBD2OGUY.js');
|
|
6
|
-
require('./chunk-
|
|
6
|
+
require('./chunk-E7SXH3BE.js');
|
|
7
7
|
require('./chunk-N7FW365Q.js');
|
|
8
8
|
require('./chunk-QWSTQIUA.js');
|
|
9
9
|
require('./chunk-2KWRE5Y5.js');
|
package/dist/executors.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import "./chunk-YSCEY447.mjs";
|
|
|
2
2
|
import "./chunk-3SX7VAO7.mjs";
|
|
3
3
|
import "./chunk-SWYYMID7.mjs";
|
|
4
4
|
import "./chunk-OPXJUL5V.mjs";
|
|
5
|
-
import "./chunk-
|
|
6
|
-
import "./chunk-
|
|
5
|
+
import "./chunk-PTD74LWF.mjs";
|
|
6
|
+
import "./chunk-74DC5UCP.mjs";
|
|
7
7
|
import "./chunk-3MAI3FU2.mjs";
|
|
8
8
|
import "./chunk-P42MQNVF.mjs";
|
|
9
9
|
import "./chunk-52X4GPEN.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-2VLUD7ES.mjs";
|
package/dist/generators.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkSZIF5PWYjs = require('./chunk-SZIF5PWY.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkJ5TCUMBDjs = require('./chunk-J5TCUMBD.js');
|
|
10
10
|
require('./chunk-QWSTQIUA.js');
|
|
11
11
|
require('./chunk-2KWRE5Y5.js');
|
|
12
12
|
require('./chunk-MCKGQKYU.js');
|
|
@@ -15,4 +15,4 @@ require('./chunk-MCKGQKYU.js');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
exports.applicationGenerator =
|
|
18
|
+
exports.applicationGenerator = _chunkSZIF5PWYjs.applicationGenerator; exports.applicationSchematic = _chunkSZIF5PWYjs.applicationSchematic; exports.initGenerator = _chunkJ5TCUMBDjs.initGenerator; exports.initSchematic = _chunkJ5TCUMBDjs.initSchematic;
|
package/dist/generators.mjs
CHANGED
|
@@ -2,14 +2,14 @@ import "./chunk-3J7KBHMJ.mjs";
|
|
|
2
2
|
import {
|
|
3
3
|
applicationGenerator,
|
|
4
4
|
applicationSchematic
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-C2TW7OEJ.mjs";
|
|
6
6
|
import {
|
|
7
7
|
initGenerator,
|
|
8
8
|
initSchematic
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-Y6QXVEOO.mjs";
|
|
10
10
|
import "./chunk-P42MQNVF.mjs";
|
|
11
11
|
import "./chunk-52X4GPEN.mjs";
|
|
12
|
-
import "./chunk-
|
|
12
|
+
import "./chunk-2VLUD7ES.mjs";
|
|
13
13
|
export {
|
|
14
14
|
applicationGenerator,
|
|
15
15
|
applicationSchematic,
|
package/dist/index.js
CHANGED
|
@@ -4,11 +4,11 @@ require('./chunk-DHBG5ASJ.js');
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkSZIF5PWYjs = require('./chunk-SZIF5PWY.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkJ5TCUMBDjs = require('./chunk-J5TCUMBD.js');
|
|
12
12
|
require('./chunk-KUGEZPUO.js');
|
|
13
13
|
require('./chunk-CVGPWUNP.js');
|
|
14
14
|
|
|
@@ -18,7 +18,7 @@ require('./chunk-CVGPWUNP.js');
|
|
|
18
18
|
|
|
19
19
|
var _chunk6JVDTXHTjs = require('./chunk-6JVDTXHT.js');
|
|
20
20
|
require('./chunk-QBD2OGUY.js');
|
|
21
|
-
require('./chunk-
|
|
21
|
+
require('./chunk-E7SXH3BE.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
|
@@ -160,4 +160,4 @@ function createPackageJson(projectJsonPath, workspaceRoot) {
|
|
|
160
160
|
|
|
161
161
|
|
|
162
162
|
|
|
163
|
-
exports.applicationGenerator =
|
|
163
|
+
exports.applicationGenerator = _chunkSZIF5PWYjs.applicationGenerator; exports.applicationSchematic = _chunkSZIF5PWYjs.applicationSchematic; exports.createNodesV2 = createNodesV2; exports.getEncoding = _chunk6JVDTXHTjs.getEncoding; exports.getInternalDependencies = _chunk6JVDTXHTjs.getInternalDependencies; exports.initGenerator = _chunkJ5TCUMBDjs.initGenerator; exports.initSchematic = _chunkJ5TCUMBDjs.initSchematic; exports.isTextFile = _chunk6JVDTXHTjs.isTextFile; exports.name = name; exports.uploadFile = _chunk6JVDTXHTjs.uploadFile;
|
package/dist/index.mjs
CHANGED
|
@@ -4,11 +4,11 @@ import "./chunk-3J7KBHMJ.mjs";
|
|
|
4
4
|
import {
|
|
5
5
|
applicationGenerator,
|
|
6
6
|
applicationSchematic
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-C2TW7OEJ.mjs";
|
|
8
8
|
import {
|
|
9
9
|
initGenerator,
|
|
10
10
|
initSchematic
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-Y6QXVEOO.mjs";
|
|
12
12
|
import "./chunk-SWYYMID7.mjs";
|
|
13
13
|
import "./chunk-7Z5PILRU.mjs";
|
|
14
14
|
import {
|
|
@@ -17,15 +17,15 @@ import {
|
|
|
17
17
|
isTextFile,
|
|
18
18
|
uploadFile
|
|
19
19
|
} from "./chunk-OPXJUL5V.mjs";
|
|
20
|
-
import "./chunk-
|
|
21
|
-
import "./chunk-
|
|
20
|
+
import "./chunk-PTD74LWF.mjs";
|
|
21
|
+
import "./chunk-74DC5UCP.mjs";
|
|
22
22
|
import {
|
|
23
23
|
ProjectTagConstants,
|
|
24
24
|
addProjectTag
|
|
25
25
|
} from "./chunk-3MAI3FU2.mjs";
|
|
26
26
|
import "./chunk-P42MQNVF.mjs";
|
|
27
27
|
import "./chunk-52X4GPEN.mjs";
|
|
28
|
-
import "./chunk-
|
|
28
|
+
import "./chunk-2VLUD7ES.mjs";
|
|
29
29
|
|
|
30
30
|
// src/plugins/index.ts
|
|
31
31
|
import {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
var _chunkQBD2OGUYjs = require('../../../chunk-QBD2OGUY.js');
|
|
4
|
-
require('../../../chunk-
|
|
4
|
+
require('../../../chunk-E7SXH3BE.js');
|
|
5
5
|
require('../../../chunk-N7FW365Q.js');
|
|
6
6
|
require('../../../chunk-QWSTQIUA.js');
|
|
7
7
|
require('../../../chunk-2KWRE5Y5.js');
|