@storm-software/cloudflare-tools 0.48.0 → 0.49.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/chunk-3J7KBHMJ.mjs +0 -0
  3. package/dist/chunk-7Z5PILRU.mjs +0 -0
  4. package/dist/chunk-A4ZIZ2JU.mjs +228 -0
  5. package/dist/chunk-A7FFSBE6.mjs +26 -0
  6. package/dist/chunk-CVGPWUNP.js +1 -0
  7. package/dist/chunk-DHBG5ASJ.js +1 -0
  8. package/dist/chunk-I4XNMV5U.js +227 -0
  9. package/dist/chunk-J5SB6L2L.js +18 -0
  10. package/dist/chunk-JCB2DTP6.js +42 -0
  11. package/dist/chunk-KKOHB7JH.js +239 -0
  12. package/dist/chunk-MTM5OTKD.mjs +239 -0
  13. package/dist/chunk-NKCR3FSU.js +153 -0
  14. package/dist/chunk-NSLK6ZDO.mjs +603 -0
  15. package/dist/chunk-OARYMVO7.mjs +501 -0
  16. package/dist/chunk-OJNZ4PXQ.mjs +3466 -0
  17. package/dist/chunk-QEWY5YJA.mjs +89 -0
  18. package/dist/chunk-R7AIVBS7.js +89 -0
  19. package/dist/chunk-RCE3CC76.js +603 -0
  20. package/dist/chunk-VPT6GF3S.mjs +153 -0
  21. package/dist/chunk-VTHBMY4B.js +133 -0
  22. package/dist/chunk-VYOULWAK.mjs +42 -0
  23. package/dist/chunk-XO66D74Z.js +1 -0
  24. package/dist/chunk-XU6MTFCV.mjs +133 -0
  25. package/dist/chunk-YE4FHRXJ.js +501 -0
  26. package/dist/chunk-YSCEY447.mjs +0 -0
  27. package/dist/chunk-Z46UO4N7.js +3465 -0
  28. package/dist/executors.d.mts +2 -0
  29. package/dist/executors.d.ts +2 -0
  30. package/dist/executors.js +9 -0
  31. package/dist/executors.mjs +9 -0
  32. package/dist/generator-DJ1RuHyR.d.mts +14 -0
  33. package/dist/generator-DJ1RuHyR.d.ts +14 -0
  34. package/dist/generator-DW-9W9Fk.d.mts +22 -0
  35. package/dist/generator-DW-9W9Fk.d.ts +22 -0
  36. package/dist/generators.d.mts +4 -0
  37. package/dist/generators.d.ts +4 -0
  38. package/dist/generators.js +18 -0
  39. package/dist/generators.mjs +18 -0
  40. package/dist/index.d.mts +45 -0
  41. package/dist/index.d.ts +45 -0
  42. package/dist/index.js +151 -0
  43. package/dist/index.mjs +151 -0
  44. package/dist/schema.d-DgA16PUG.d.mts +24 -0
  45. package/dist/schema.d-DgA16PUG.d.ts +24 -0
  46. package/dist/schema.d-oSirXiCO.d.mts +11 -0
  47. package/dist/schema.d-oSirXiCO.d.ts +11 -0
  48. package/dist/src/executors/cloudflare-publish/executor.d.mts +8 -0
  49. package/dist/src/executors/cloudflare-publish/executor.d.ts +8 -0
  50. package/dist/src/executors/cloudflare-publish/executor.js +11 -0
  51. package/dist/src/executors/cloudflare-publish/executor.mjs +11 -0
  52. package/dist/src/executors/r2-upload-publish/executor.d.mts +8 -0
  53. package/dist/src/executors/r2-upload-publish/executor.d.ts +8 -0
  54. package/dist/src/executors/r2-upload-publish/executor.js +11 -0
  55. package/dist/src/executors/r2-upload-publish/executor.mjs +11 -0
  56. package/dist/src/executors/serve/executor.d.mts +1240 -0
  57. package/dist/src/executors/serve/executor.d.ts +1240 -0
  58. package/dist/src/executors/serve/executor.js +75 -0
  59. package/dist/src/executors/serve/executor.mjs +75 -0
  60. package/dist/src/executors/serve/schema.d.ts +1 -1
  61. package/dist/src/generators/init/generator.d.mts +2 -0
  62. package/dist/src/generators/init/generator.d.ts +2 -0
  63. package/dist/src/generators/init/generator.js +11 -0
  64. package/dist/src/generators/init/generator.mjs +11 -0
  65. package/dist/src/generators/worker/generator.d.mts +3 -0
  66. package/dist/src/generators/worker/generator.d.ts +3 -0
  67. package/dist/src/generators/worker/generator.js +14 -0
  68. package/dist/src/generators/worker/generator.mjs +14 -0
  69. package/dist/src/utils/index.d.mts +3 -0
  70. package/dist/src/utils/index.d.ts +3 -0
  71. package/dist/src/utils/index.js +11 -0
  72. package/dist/src/utils/index.mjs +11 -0
  73. package/dist/src/utils/r2-bucket-helpers.d.mts +7 -0
  74. package/dist/src/utils/r2-bucket-helpers.d.ts +7 -0
  75. package/dist/src/utils/r2-bucket-helpers.js +10 -0
  76. package/dist/src/utils/r2-bucket-helpers.mjs +10 -0
  77. package/dist/tsup.config.d.mts +5 -0
  78. package/dist/tsup.config.d.ts +5 -0
  79. package/dist/tsup.config.js +35 -0
  80. package/dist/tsup.config.mjs +35 -0
  81. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 0.49.0 (2025-01-20)
2
+
3
+ ### Features
4
+
5
+ - **untyped:** Standard file name changes to avoid collisions ([71acf100](https://github.com/storm-software/storm-ops/commit/71acf100))
6
+
7
+ ### Bug Fixes
8
+
9
+ - **terraform-tools:** Resolve issue with invalid import path ([7a8ee2cf](https://github.com/storm-software/storm-ops/commit/7a8ee2cf))
10
+
1
11
  ## 0.48.0 (2025-01-20)
2
12
 
3
13
  ### Features
File without changes
File without changes
@@ -0,0 +1,228 @@
1
+ import {
2
+ generator_default
3
+ } from "./chunk-MTM5OTKD.mjs";
4
+ import {
5
+ loadStormConfig
6
+ } from "./chunk-OARYMVO7.mjs";
7
+ import {
8
+ findWorkspaceRoot,
9
+ getStopwatch,
10
+ writeDebug,
11
+ writeError,
12
+ writeFatal,
13
+ writeInfo,
14
+ writeTrace
15
+ } from "./chunk-NSLK6ZDO.mjs";
16
+ import {
17
+ __dirname,
18
+ __name
19
+ } from "./chunk-A7FFSBE6.mjs";
20
+
21
+ // src/generators/worker/generator.ts
22
+ import { convertNxGenerator, ensurePackage, formatFiles, generateFiles, joinPathFragments, names, readProjectConfiguration, runTasksInSerial, updateJson, updateProjectConfiguration } from "@nx/devkit";
23
+ import { determineProjectNameAndRootOptions } from "@nx/devkit/src/generators/project-name-and-root-utils";
24
+ import { applicationGenerator as nodeApplicationGenerator } from "@nx/node";
25
+ import { nxVersion } from "@nx/node/src/utils/versions";
26
+ import { join } from "path";
27
+
28
+ // src/generators/worker/libs/get-account-id.ts
29
+ function getAccountId(accountId) {
30
+ return `account_id = "${accountId}"`;
31
+ }
32
+ __name(getAccountId, "getAccountId");
33
+
34
+ // src/generators/worker/libs/vitest-imports.ts
35
+ var vitestImports = `import { describe, expect, it, beforeAll, afterAll } from 'vitest';`;
36
+
37
+ // src/generators/worker/libs/vitest-script.ts
38
+ var vitestScript = `"test": "vitest run"`;
39
+
40
+ // src/generators/worker/generator.ts
41
+ async function applicationGenerator(tree, schema) {
42
+ const stopwatch = getStopwatch("Storm Worker generator");
43
+ let config;
44
+ try {
45
+ writeInfo(`\u26A1 Running the Storm Worker generator...
46
+
47
+ `, config);
48
+ const workspaceRoot = findWorkspaceRoot();
49
+ writeDebug(`Loading the Storm Config from environment variables and storm.json file...
50
+ - workspaceRoot: ${workspaceRoot}`, config);
51
+ config = await loadStormConfig(workspaceRoot);
52
+ writeTrace(`Loaded Storm config into env:
53
+ ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[key])}`).join("\n")}`, config);
54
+ const options = await normalizeOptions(tree, schema, config);
55
+ const tasks = [];
56
+ tasks.push(await generator_default(tree, {
57
+ ...options,
58
+ skipFormat: true
59
+ }));
60
+ tasks.push(await nodeApplicationGenerator(tree, {
61
+ ...options,
62
+ framework: "none",
63
+ skipFormat: true,
64
+ unitTestRunner: options.unitTestRunner == "vitest" ? "none" : options.unitTestRunner,
65
+ e2eTestRunner: "none",
66
+ name: schema.name
67
+ }));
68
+ if (options.unitTestRunner === "vitest") {
69
+ const { vitestGenerator, createOrEditViteConfig } = ensurePackage("@nx/vite", nxVersion);
70
+ const vitestTask = await vitestGenerator(tree, {
71
+ project: options.name,
72
+ uiFramework: "none",
73
+ coverageProvider: "v8",
74
+ skipFormat: true,
75
+ testEnvironment: "node"
76
+ });
77
+ tasks.push(vitestTask);
78
+ createOrEditViteConfig(tree, {
79
+ project: options.name,
80
+ includeLib: false,
81
+ includeVitest: true,
82
+ testEnvironment: "node"
83
+ }, true);
84
+ }
85
+ addCloudflareFiles(tree, options);
86
+ updateTsAppConfig(tree, options);
87
+ addTargets(tree, options);
88
+ if (options.unitTestRunner === "none") {
89
+ removeTestFiles(tree, options);
90
+ }
91
+ if (!options.skipFormat) {
92
+ await formatFiles(tree);
93
+ }
94
+ if (options.template === "hono") {
95
+ tasks.push(() => {
96
+ const packageJsonPath = joinPathFragments(options.directory ?? "", "package.json");
97
+ if (tree.exists(packageJsonPath)) {
98
+ updateJson(tree, packageJsonPath, (json) => ({
99
+ ...json,
100
+ dependencies: {
101
+ hono: "4.4.0",
102
+ ...json?.dependencies
103
+ }
104
+ }));
105
+ }
106
+ });
107
+ }
108
+ return runTasksInSerial(...tasks);
109
+ } catch (error) {
110
+ return () => {
111
+ writeFatal("A fatal error occurred while running the generator - the process was forced to terminate", config);
112
+ writeError(`An exception was thrown in the generator's process
113
+ - Details: ${error.message}
114
+ - Stacktrace: ${error.stack}`, config);
115
+ };
116
+ } finally {
117
+ stopwatch();
118
+ }
119
+ }
120
+ __name(applicationGenerator, "applicationGenerator");
121
+ function updateTsAppConfig(tree, options) {
122
+ updateJson(tree, join(options.appProjectRoot, "tsconfig.app.json"), (json) => {
123
+ json.compilerOptions = {
124
+ ...json.compilerOptions,
125
+ esModuleInterop: true,
126
+ target: "es2021",
127
+ lib: [
128
+ "es2021"
129
+ ],
130
+ module: "es2022",
131
+ moduleResolution: "node",
132
+ resolveJsonModule: true,
133
+ allowJs: true,
134
+ checkJs: false,
135
+ noEmit: true,
136
+ isolatedModules: true,
137
+ allowSyntheticDefaultImports: true,
138
+ forceConsistentCasingInFileNames: true,
139
+ strict: true,
140
+ skipLibCheck: true
141
+ };
142
+ json.compilerOptions.types = [
143
+ ...json.compilerOptions.types,
144
+ "@cloudflare/workers-types"
145
+ ];
146
+ return json;
147
+ });
148
+ }
149
+ __name(updateTsAppConfig, "updateTsAppConfig");
150
+ function addCloudflareFiles(tree, options) {
151
+ tree.delete(join(options.appProjectRoot, "src/main.ts"));
152
+ generateFiles(tree, join(__dirname, "./files/common"), options.appProjectRoot, {
153
+ ...options,
154
+ tmpl: "",
155
+ name: options.name,
156
+ accountId: options.accountId ? getAccountId(options.accountId) : "",
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"), {
161
+ ...options,
162
+ tmpl: "",
163
+ name: options.name,
164
+ accountId: options.accountId ? getAccountId(options.accountId) : "",
165
+ vitestScript: options.unitTestRunner === "vitest" ? vitestScript : "",
166
+ vitestImports: options.unitTestRunner === "vitest" ? vitestImports : ""
167
+ });
168
+ }
169
+ }
170
+ __name(addCloudflareFiles, "addCloudflareFiles");
171
+ function addTargets(tree, options) {
172
+ try {
173
+ const projectConfiguration = readProjectConfiguration(tree, options.name);
174
+ projectConfiguration.targets = {
175
+ ...projectConfiguration.targets ?? {},
176
+ serve: {
177
+ executor: "@storm-software/cloudflare-tools:serve",
178
+ options: {
179
+ port: options.port
180
+ }
181
+ },
182
+ "nx-release-publish": {
183
+ executor: "@storm-software/cloudflare-tools:cloudflare-publish"
184
+ }
185
+ };
186
+ if (projectConfiguration.targets.build) {
187
+ delete projectConfiguration.targets.build;
188
+ }
189
+ updateProjectConfiguration(tree, options.name, projectConfiguration);
190
+ } catch (e) {
191
+ console.error(e);
192
+ }
193
+ }
194
+ __name(addTargets, "addTargets");
195
+ function removeTestFiles(tree, options) {
196
+ tree.delete(join(options.appProjectRoot, "src", "index.test.ts"));
197
+ }
198
+ __name(removeTestFiles, "removeTestFiles");
199
+ async function normalizeOptions(host, options, config) {
200
+ const { projectName: appProjectName, projectRoot: appProjectRoot } = await determineProjectNameAndRootOptions(host, {
201
+ name: options.name,
202
+ projectType: "application",
203
+ directory: options.directory,
204
+ rootProject: options.rootProject
205
+ });
206
+ options.rootProject = appProjectRoot === ".";
207
+ return {
208
+ addPlugin: process.env.NX_ADD_PLUGINS !== "false",
209
+ accountId: process.env.STORM_BOT_CLOUDFLARE_ACCOUNT,
210
+ ...options,
211
+ name: names(appProjectName).fileName,
212
+ frontendProject: options.frontendProject ? names(options.frontendProject).fileName : void 0,
213
+ appProjectRoot,
214
+ unitTestRunner: options.unitTestRunner ?? "vitest",
215
+ rootProject: options.rootProject ?? false,
216
+ template: options.template ?? "fetch-handler",
217
+ port: options.port ?? 3e3
218
+ };
219
+ }
220
+ __name(normalizeOptions, "normalizeOptions");
221
+ var generator_default2 = applicationGenerator;
222
+ var applicationSchematic = convertNxGenerator(applicationGenerator);
223
+
224
+ export {
225
+ applicationGenerator,
226
+ generator_default2 as generator_default,
227
+ applicationSchematic
228
+ };
@@ -0,0 +1,26 @@
1
+ var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
+ }) : x)(function(x) {
7
+ if (typeof require !== "undefined") return require.apply(this, arguments);
8
+ throw Error('Dynamic require of "' + x + '" is not supported');
9
+ });
10
+ var __commonJS = (cb, mod) => function __require2() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+
14
+ // ../../node_modules/.pnpm/tsup@8.3.5_@microsoft+api-extractor@7.49.1_@types+node@22.10.7__@swc+core@1.7.26_@swc+helpers_ekim6y52mwpq6ssxiprcp44dam/node_modules/tsup/assets/esm_shims.js
15
+ import { fileURLToPath } from "url";
16
+ import path from "path";
17
+ var getFilename = /* @__PURE__ */ __name(() => fileURLToPath(import.meta.url), "getFilename");
18
+ var getDirname = /* @__PURE__ */ __name(() => path.dirname(getFilename()), "getDirname");
19
+ var __dirname = /* @__PURE__ */ getDirname();
20
+
21
+ export {
22
+ __name,
23
+ __require,
24
+ __commonJS,
25
+ __dirname
26
+ };
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,227 @@
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
+ var _chunkKKOHB7JHjs = require('./chunk-KKOHB7JH.js');
4
+
5
+
6
+ var _chunkYE4FHRXJjs = require('./chunk-YE4FHRXJ.js');
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+ var _chunkRCE3CC76js = require('./chunk-RCE3CC76.js');
16
+
17
+
18
+ var _chunkJ5SB6L2Ljs = require('./chunk-J5SB6L2L.js');
19
+
20
+ // src/generators/worker/generator.ts
21
+ var _devkit = require('@nx/devkit');
22
+ var _projectnameandrootutils = require('@nx/devkit/src/generators/project-name-and-root-utils');
23
+ var _node = require('@nx/node');
24
+ var _versions = require('@nx/node/src/utils/versions');
25
+ var _path = require('path');
26
+
27
+ // src/generators/worker/libs/get-account-id.ts
28
+ function getAccountId(accountId) {
29
+ return `account_id = "${accountId}"`;
30
+ }
31
+ _chunkJ5SB6L2Ljs.__name.call(void 0, getAccountId, "getAccountId");
32
+
33
+ // src/generators/worker/libs/vitest-imports.ts
34
+ var vitestImports = `import { describe, expect, it, beforeAll, afterAll } from 'vitest';`;
35
+
36
+ // src/generators/worker/libs/vitest-script.ts
37
+ var vitestScript = `"test": "vitest run"`;
38
+
39
+ // src/generators/worker/generator.ts
40
+ async function applicationGenerator(tree, schema) {
41
+ const stopwatch = _chunkRCE3CC76js.getStopwatch.call(void 0, "Storm Worker generator");
42
+ let config;
43
+ try {
44
+ _chunkRCE3CC76js.writeInfo.call(void 0, `\u26A1 Running the Storm Worker generator...
45
+
46
+ `, config);
47
+ const workspaceRoot = _chunkRCE3CC76js.findWorkspaceRoot.call(void 0, );
48
+ _chunkRCE3CC76js.writeDebug.call(void 0, `Loading the Storm Config from environment variables and storm.json file...
49
+ - workspaceRoot: ${workspaceRoot}`, config);
50
+ config = await _chunkYE4FHRXJjs.loadStormConfig.call(void 0, workspaceRoot);
51
+ _chunkRCE3CC76js.writeTrace.call(void 0, `Loaded Storm config into env:
52
+ ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[key])}`).join("\n")}`, config);
53
+ const options = await normalizeOptions(tree, schema, config);
54
+ const tasks = [];
55
+ tasks.push(await _chunkKKOHB7JHjs.generator_default.call(void 0, tree, {
56
+ ...options,
57
+ skipFormat: true
58
+ }));
59
+ tasks.push(await _node.applicationGenerator.call(void 0, tree, {
60
+ ...options,
61
+ framework: "none",
62
+ skipFormat: true,
63
+ unitTestRunner: options.unitTestRunner == "vitest" ? "none" : options.unitTestRunner,
64
+ e2eTestRunner: "none",
65
+ name: schema.name
66
+ }));
67
+ if (options.unitTestRunner === "vitest") {
68
+ const { vitestGenerator, createOrEditViteConfig } = _devkit.ensurePackage.call(void 0, "@nx/vite", _versions.nxVersion);
69
+ const vitestTask = await vitestGenerator(tree, {
70
+ project: options.name,
71
+ uiFramework: "none",
72
+ coverageProvider: "v8",
73
+ skipFormat: true,
74
+ testEnvironment: "node"
75
+ });
76
+ tasks.push(vitestTask);
77
+ createOrEditViteConfig(tree, {
78
+ project: options.name,
79
+ includeLib: false,
80
+ includeVitest: true,
81
+ testEnvironment: "node"
82
+ }, true);
83
+ }
84
+ addCloudflareFiles(tree, options);
85
+ updateTsAppConfig(tree, options);
86
+ addTargets(tree, options);
87
+ if (options.unitTestRunner === "none") {
88
+ removeTestFiles(tree, options);
89
+ }
90
+ if (!options.skipFormat) {
91
+ await _devkit.formatFiles.call(void 0, tree);
92
+ }
93
+ if (options.template === "hono") {
94
+ tasks.push(() => {
95
+ const packageJsonPath = _devkit.joinPathFragments.call(void 0, _nullishCoalesce(options.directory, () => ( "")), "package.json");
96
+ if (tree.exists(packageJsonPath)) {
97
+ _devkit.updateJson.call(void 0, tree, packageJsonPath, (json) => ({
98
+ ...json,
99
+ dependencies: {
100
+ hono: "4.4.0",
101
+ ..._optionalChain([json, 'optionalAccess', _ => _.dependencies])
102
+ }
103
+ }));
104
+ }
105
+ });
106
+ }
107
+ return _devkit.runTasksInSerial.call(void 0, ...tasks);
108
+ } catch (error) {
109
+ return () => {
110
+ _chunkRCE3CC76js.writeFatal.call(void 0, "A fatal error occurred while running the generator - the process was forced to terminate", config);
111
+ _chunkRCE3CC76js.writeError.call(void 0, `An exception was thrown in the generator's process
112
+ - Details: ${error.message}
113
+ - Stacktrace: ${error.stack}`, config);
114
+ };
115
+ } finally {
116
+ stopwatch();
117
+ }
118
+ }
119
+ _chunkJ5SB6L2Ljs.__name.call(void 0, applicationGenerator, "applicationGenerator");
120
+ function updateTsAppConfig(tree, options) {
121
+ _devkit.updateJson.call(void 0, tree, _path.join.call(void 0, options.appProjectRoot, "tsconfig.app.json"), (json) => {
122
+ json.compilerOptions = {
123
+ ...json.compilerOptions,
124
+ esModuleInterop: true,
125
+ target: "es2021",
126
+ lib: [
127
+ "es2021"
128
+ ],
129
+ module: "es2022",
130
+ moduleResolution: "node",
131
+ resolveJsonModule: true,
132
+ allowJs: true,
133
+ checkJs: false,
134
+ noEmit: true,
135
+ isolatedModules: true,
136
+ allowSyntheticDefaultImports: true,
137
+ forceConsistentCasingInFileNames: true,
138
+ strict: true,
139
+ skipLibCheck: true
140
+ };
141
+ json.compilerOptions.types = [
142
+ ...json.compilerOptions.types,
143
+ "@cloudflare/workers-types"
144
+ ];
145
+ return json;
146
+ });
147
+ }
148
+ _chunkJ5SB6L2Ljs.__name.call(void 0, updateTsAppConfig, "updateTsAppConfig");
149
+ function addCloudflareFiles(tree, options) {
150
+ tree.delete(_path.join.call(void 0, options.appProjectRoot, "src/main.ts"));
151
+ _devkit.generateFiles.call(void 0, tree, _path.join.call(void 0, __dirname, "./files/common"), options.appProjectRoot, {
152
+ ...options,
153
+ tmpl: "",
154
+ name: options.name,
155
+ accountId: options.accountId ? getAccountId(options.accountId) : "",
156
+ vitestScript: options.unitTestRunner === "vitest" ? vitestScript : ""
157
+ });
158
+ if (options.template && options.template !== "none") {
159
+ _devkit.generateFiles.call(void 0, tree, _path.join.call(void 0, __dirname, `./files/${options.template}`), _path.join.call(void 0, options.appProjectRoot, "src"), {
160
+ ...options,
161
+ tmpl: "",
162
+ name: options.name,
163
+ accountId: options.accountId ? getAccountId(options.accountId) : "",
164
+ vitestScript: options.unitTestRunner === "vitest" ? vitestScript : "",
165
+ vitestImports: options.unitTestRunner === "vitest" ? vitestImports : ""
166
+ });
167
+ }
168
+ }
169
+ _chunkJ5SB6L2Ljs.__name.call(void 0, addCloudflareFiles, "addCloudflareFiles");
170
+ function addTargets(tree, options) {
171
+ try {
172
+ const projectConfiguration = _devkit.readProjectConfiguration.call(void 0, tree, options.name);
173
+ projectConfiguration.targets = {
174
+ ..._nullishCoalesce(projectConfiguration.targets, () => ( {})),
175
+ serve: {
176
+ executor: "@storm-software/cloudflare-tools:serve",
177
+ options: {
178
+ port: options.port
179
+ }
180
+ },
181
+ "nx-release-publish": {
182
+ executor: "@storm-software/cloudflare-tools:cloudflare-publish"
183
+ }
184
+ };
185
+ if (projectConfiguration.targets.build) {
186
+ delete projectConfiguration.targets.build;
187
+ }
188
+ _devkit.updateProjectConfiguration.call(void 0, tree, options.name, projectConfiguration);
189
+ } catch (e) {
190
+ console.error(e);
191
+ }
192
+ }
193
+ _chunkJ5SB6L2Ljs.__name.call(void 0, addTargets, "addTargets");
194
+ function removeTestFiles(tree, options) {
195
+ tree.delete(_path.join.call(void 0, options.appProjectRoot, "src", "index.test.ts"));
196
+ }
197
+ _chunkJ5SB6L2Ljs.__name.call(void 0, removeTestFiles, "removeTestFiles");
198
+ async function normalizeOptions(host, options, config) {
199
+ const { projectName: appProjectName, projectRoot: appProjectRoot } = await _projectnameandrootutils.determineProjectNameAndRootOptions.call(void 0, host, {
200
+ name: options.name,
201
+ projectType: "application",
202
+ directory: options.directory,
203
+ rootProject: options.rootProject
204
+ });
205
+ options.rootProject = appProjectRoot === ".";
206
+ return {
207
+ addPlugin: process.env.NX_ADD_PLUGINS !== "false",
208
+ accountId: process.env.STORM_BOT_CLOUDFLARE_ACCOUNT,
209
+ ...options,
210
+ name: _devkit.names.call(void 0, appProjectName).fileName,
211
+ frontendProject: options.frontendProject ? _devkit.names.call(void 0, options.frontendProject).fileName : void 0,
212
+ appProjectRoot,
213
+ unitTestRunner: _nullishCoalesce(options.unitTestRunner, () => ( "vitest")),
214
+ rootProject: _nullishCoalesce(options.rootProject, () => ( false)),
215
+ template: _nullishCoalesce(options.template, () => ( "fetch-handler")),
216
+ port: _nullishCoalesce(options.port, () => ( 3e3))
217
+ };
218
+ }
219
+ _chunkJ5SB6L2Ljs.__name.call(void 0, normalizeOptions, "normalizeOptions");
220
+ var generator_default2 = applicationGenerator;
221
+ var applicationSchematic = _devkit.convertNxGenerator.call(void 0, applicationGenerator);
222
+
223
+
224
+
225
+
226
+
227
+ exports.applicationGenerator = applicationGenerator; exports.generator_default = generator_default2; exports.applicationSchematic = applicationSchematic;
@@ -0,0 +1,18 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});var __defProp = Object.defineProperty;
2
+ var __getOwnPropNames = Object.getOwnPropertyNames;
3
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
4
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
+ }) : x)(function(x) {
7
+ if (typeof require !== "undefined") return require.apply(this, arguments);
8
+ throw Error('Dynamic require of "' + x + '" is not supported');
9
+ });
10
+ var __commonJS = (cb, mod) => function __require2() {
11
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
12
+ };
13
+
14
+
15
+
16
+
17
+
18
+ exports.__name = __name; exports.__require = __require; exports.__commonJS = __commonJS;
@@ -0,0 +1,42 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
+
3
+
4
+ var _chunkRCE3CC76js = require('./chunk-RCE3CC76.js');
5
+
6
+
7
+ var _chunkJ5SB6L2Ljs = require('./chunk-J5SB6L2L.js');
8
+
9
+ // src/utils/r2-bucket-helpers.ts
10
+ var _crypto = require('crypto');
11
+ var r2UploadFile = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, async (client, bucketName, projectPath, fileName, version, fileContent, contentType = "text/plain", isDryRun = false) => {
12
+ const checksum = _crypto.createHash.call(void 0, "sha256").update(fileContent).digest("base64");
13
+ const fileKey = `${projectPath}/${fileName.startsWith("/") ? fileName.substring(1) : fileName}`;
14
+ _chunkRCE3CC76js.writeDebug.call(void 0, `Uploading file: ${fileKey}`);
15
+ if (!isDryRun) {
16
+ await client.putObject({
17
+ Bucket: bucketName,
18
+ Key: fileKey,
19
+ Body: fileContent.replaceAll(' from "@cyclone-ui/', ' from "../'),
20
+ ContentType: contentType,
21
+ Metadata: {
22
+ version,
23
+ checksum
24
+ }
25
+ });
26
+ } else {
27
+ _chunkRCE3CC76js.writeWarning.call(void 0, "[Dry run]: skipping upload to the Cyclone Registry.");
28
+ }
29
+ }, "r2UploadFile");
30
+ var getInternalDependencies = /* @__PURE__ */ _chunkJ5SB6L2Ljs.__name.call(void 0, (projectName, graph) => {
31
+ const allDeps = _nullishCoalesce(graph.dependencies[projectName], () => ( []));
32
+ return Array.from(allDeps.reduce((acc, node) => {
33
+ const found = graph.nodes[node.target];
34
+ if (found) acc.push(found);
35
+ return acc;
36
+ }, []));
37
+ }, "getInternalDependencies");
38
+
39
+
40
+
41
+
42
+ exports.r2UploadFile = r2UploadFile; exports.getInternalDependencies = getInternalDependencies;