@storm-software/cloudflare-tools 0.48.0 → 0.49.1

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 +16 -0
  2. package/dist/chunk-3J7KBHMJ.mjs +0 -0
  3. package/dist/chunk-7Z5PILRU.mjs +0 -0
  4. package/dist/chunk-A7FFSBE6.mjs +26 -0
  5. package/dist/chunk-CR22PACK.mjs +239 -0
  6. package/dist/chunk-CVGPWUNP.js +1 -0
  7. package/dist/chunk-DHBG5ASJ.js +1 -0
  8. package/dist/chunk-ITLKTOIK.mjs +4042 -0
  9. package/dist/chunk-J5SB6L2L.js +18 -0
  10. package/dist/chunk-JCB2DTP6.js +42 -0
  11. package/dist/chunk-NKCR3FSU.js +153 -0
  12. package/dist/chunk-NPJPHEFP.js +239 -0
  13. package/dist/chunk-NSLK6ZDO.mjs +603 -0
  14. package/dist/chunk-OARYMVO7.mjs +501 -0
  15. package/dist/chunk-QEWY5YJA.mjs +89 -0
  16. package/dist/chunk-R7AIVBS7.js +89 -0
  17. package/dist/chunk-RCE3CC76.js +603 -0
  18. package/dist/chunk-VPT6GF3S.mjs +153 -0
  19. package/dist/chunk-VTHBMY4B.js +133 -0
  20. package/dist/chunk-VYOULWAK.mjs +42 -0
  21. package/dist/chunk-W5J5EWQN.js +227 -0
  22. package/dist/chunk-WGOT27OY.js +4041 -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-ZY7TM2TA.mjs +228 -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
@@ -0,0 +1,228 @@
1
+ import {
2
+ generator_default
3
+ } from "./chunk-CR22PACK.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,2 @@
1
+ export { C as CloudflarePublishExecutorSchema } from './schema.d-DgA16PUG.mjs';
2
+ export { R as R2UploadPublishExecutorSchema } from './schema.d-oSirXiCO.mjs';
@@ -0,0 +1,2 @@
1
+ export { C as CloudflarePublishExecutorSchema } from './schema.d-DgA16PUG.js';
2
+ export { R as R2UploadPublishExecutorSchema } from './schema.d-oSirXiCO.js';
@@ -0,0 +1,9 @@
1
+ "use strict";require('./chunk-XO66D74Z.js');
2
+ require('./chunk-NKCR3FSU.js');
3
+ require('./chunk-JCB2DTP6.js');
4
+ require('./chunk-R7AIVBS7.js');
5
+ require('./chunk-WGOT27OY.js');
6
+ require('./chunk-VTHBMY4B.js');
7
+ require('./chunk-YE4FHRXJ.js');
8
+ require('./chunk-RCE3CC76.js');
9
+ require('./chunk-J5SB6L2L.js');
@@ -0,0 +1,9 @@
1
+ import "./chunk-YSCEY447.mjs";
2
+ import "./chunk-VPT6GF3S.mjs";
3
+ import "./chunk-VYOULWAK.mjs";
4
+ import "./chunk-QEWY5YJA.mjs";
5
+ import "./chunk-ITLKTOIK.mjs";
6
+ import "./chunk-XU6MTFCV.mjs";
7
+ import "./chunk-OARYMVO7.mjs";
8
+ import "./chunk-NSLK6ZDO.mjs";
9
+ import "./chunk-A7FFSBE6.mjs";
@@ -0,0 +1,14 @@
1
+ import { Tree } from '@nx/devkit';
2
+
3
+ interface InitGeneratorSchema {
4
+ unitTestRunner?: "vitest" | "jest" | "none";
5
+ skipFormat?: boolean;
6
+ js?: boolean;
7
+ template?: "fetch-handler" | "scheduled-handler" | "hono" | "none";
8
+ }
9
+
10
+ declare function initGenerator(tree: Tree, schema: InitGeneratorSchema): Promise<() => Promise<void>>;
11
+
12
+ declare const initSchematic: (generatorOptions: InitGeneratorSchema) => (tree: any, context: any) => Promise<any>;
13
+
14
+ export { type InitGeneratorSchema as I, initSchematic as a, initGenerator as i };
@@ -0,0 +1,14 @@
1
+ import { Tree } from '@nx/devkit';
2
+
3
+ interface InitGeneratorSchema {
4
+ unitTestRunner?: "vitest" | "jest" | "none";
5
+ skipFormat?: boolean;
6
+ js?: boolean;
7
+ template?: "fetch-handler" | "scheduled-handler" | "hono" | "none";
8
+ }
9
+
10
+ declare function initGenerator(tree: Tree, schema: InitGeneratorSchema): Promise<() => Promise<void>>;
11
+
12
+ declare const initSchematic: (generatorOptions: InitGeneratorSchema) => (tree: any, context: any) => Promise<any>;
13
+
14
+ export { type InitGeneratorSchema as I, initSchematic as a, initGenerator as i };
@@ -0,0 +1,22 @@
1
+ import { Tree, GeneratorCallback } from '@nx/devkit';
2
+ import { TypeScriptLibraryGeneratorSchema } from '@storm-software/workspace-tools';
3
+
4
+ type WorkerGeneratorSchema = TypeScriptLibraryGeneratorSchema & {
5
+ template?: "fetch-handler" | "scheduled-handler" | "hono" | "none";
6
+ js?: boolean;
7
+ unitTestRunner?: "vitest" | "none";
8
+ directory?: string;
9
+ rootProject?: boolean;
10
+ tags?: string;
11
+ frontendProject?: string;
12
+ skipFormat?: boolean;
13
+ port?: number;
14
+ accountId?: string;
15
+ addPlugin?: boolean;
16
+ };
17
+
18
+ declare function applicationGenerator(tree: Tree, schema: WorkerGeneratorSchema): Promise<GeneratorCallback>;
19
+
20
+ declare const applicationSchematic: (generatorOptions: any) => (tree: any, context: any) => Promise<any>;
21
+
22
+ export { type WorkerGeneratorSchema as W, applicationGenerator as a, applicationSchematic as b };
@@ -0,0 +1,22 @@
1
+ import { Tree, GeneratorCallback } from '@nx/devkit';
2
+ import { TypeScriptLibraryGeneratorSchema } from '@storm-software/workspace-tools';
3
+
4
+ type WorkerGeneratorSchema = TypeScriptLibraryGeneratorSchema & {
5
+ template?: "fetch-handler" | "scheduled-handler" | "hono" | "none";
6
+ js?: boolean;
7
+ unitTestRunner?: "vitest" | "none";
8
+ directory?: string;
9
+ rootProject?: boolean;
10
+ tags?: string;
11
+ frontendProject?: string;
12
+ skipFormat?: boolean;
13
+ port?: number;
14
+ accountId?: string;
15
+ addPlugin?: boolean;
16
+ };
17
+
18
+ declare function applicationGenerator(tree: Tree, schema: WorkerGeneratorSchema): Promise<GeneratorCallback>;
19
+
20
+ declare const applicationSchematic: (generatorOptions: any) => (tree: any, context: any) => Promise<any>;
21
+
22
+ export { type WorkerGeneratorSchema as W, applicationGenerator as a, applicationSchematic as b };
@@ -0,0 +1,4 @@
1
+ export { I as InitGeneratorSchema, i as initGenerator, a as initSchematic } from './generator-DJ1RuHyR.mjs';
2
+ export { W as WorkerGeneratorSchema, a as applicationGenerator, b as applicationSchematic } from './generator-DW-9W9Fk.mjs';
3
+ import '@nx/devkit';
4
+ import '@storm-software/workspace-tools';
@@ -0,0 +1,4 @@
1
+ export { I as InitGeneratorSchema, i as initGenerator, a as initSchematic } from './generator-DJ1RuHyR.js';
2
+ export { W as WorkerGeneratorSchema, a as applicationGenerator, b as applicationSchematic } from './generator-DW-9W9Fk.js';
3
+ import '@nx/devkit';
4
+ import '@storm-software/workspace-tools';
@@ -0,0 +1,18 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('./chunk-DHBG5ASJ.js');
2
+
3
+
4
+
5
+ var _chunkW5J5EWQNjs = require('./chunk-W5J5EWQN.js');
6
+
7
+
8
+
9
+ var _chunkNPJPHEFPjs = require('./chunk-NPJPHEFP.js');
10
+ require('./chunk-YE4FHRXJ.js');
11
+ require('./chunk-RCE3CC76.js');
12
+ require('./chunk-J5SB6L2L.js');
13
+
14
+
15
+
16
+
17
+
18
+ exports.applicationGenerator = _chunkW5J5EWQNjs.applicationGenerator; exports.applicationSchematic = _chunkW5J5EWQNjs.applicationSchematic; exports.initGenerator = _chunkNPJPHEFPjs.initGenerator; exports.initSchematic = _chunkNPJPHEFPjs.initSchematic;
@@ -0,0 +1,18 @@
1
+ import "./chunk-3J7KBHMJ.mjs";
2
+ import {
3
+ applicationGenerator,
4
+ applicationSchematic
5
+ } from "./chunk-ZY7TM2TA.mjs";
6
+ import {
7
+ initGenerator,
8
+ initSchematic
9
+ } from "./chunk-CR22PACK.mjs";
10
+ import "./chunk-OARYMVO7.mjs";
11
+ import "./chunk-NSLK6ZDO.mjs";
12
+ import "./chunk-A7FFSBE6.mjs";
13
+ export {
14
+ applicationGenerator,
15
+ applicationSchematic,
16
+ initGenerator,
17
+ initSchematic
18
+ };
@@ -0,0 +1,45 @@
1
+ export { C as CloudflarePublishExecutorSchema } from './schema.d-DgA16PUG.mjs';
2
+ export { R as R2UploadPublishExecutorSchema } from './schema.d-oSirXiCO.mjs';
3
+ export { I as InitGeneratorSchema, i as initGenerator, a as initSchematic } from './generator-DJ1RuHyR.mjs';
4
+ export { W as WorkerGeneratorSchema, a as applicationGenerator, b as applicationSchematic } from './generator-DW-9W9Fk.mjs';
5
+ import * as nx_src_config_workspace_json_project_json from 'nx/src/config/workspace-json-project-json';
6
+ import * as _nx_devkit from '@nx/devkit';
7
+ export { getInternalDependencies, r2UploadFile } from './src/utils/r2-bucket-helpers.mjs';
8
+ import '@storm-software/workspace-tools';
9
+ import '@aws-sdk/client-s3';
10
+
11
+ declare const name = "storm-software/cloudflare";
12
+ declare const createNodes: (string | ((file: any, _: any, ctx: any) => {
13
+ projects?: undefined;
14
+ } | {
15
+ projects: {
16
+ [x: string]: {
17
+ targets: {
18
+ [targetName: string]: _nx_devkit.TargetConfiguration<any>;
19
+ };
20
+ release: {
21
+ version: {
22
+ generator: string;
23
+ generatorOptions?: Record<string, unknown>;
24
+ };
25
+ };
26
+ name?: string;
27
+ root: string;
28
+ sourceRoot?: string;
29
+ projectType?: _nx_devkit.ProjectType;
30
+ generators?: {
31
+ [collectionName: string]: {
32
+ [generatorName: string]: any;
33
+ };
34
+ };
35
+ implicitDependencies?: string[];
36
+ namedInputs?: {
37
+ [inputName: string]: (string | nx_src_config_workspace_json_project_json.InputDefinition)[];
38
+ };
39
+ tags?: string[];
40
+ metadata?: nx_src_config_workspace_json_project_json.ProjectMetadata;
41
+ };
42
+ };
43
+ }))[];
44
+
45
+ export { createNodes, name };
@@ -0,0 +1,45 @@
1
+ export { C as CloudflarePublishExecutorSchema } from './schema.d-DgA16PUG.js';
2
+ export { R as R2UploadPublishExecutorSchema } from './schema.d-oSirXiCO.js';
3
+ export { I as InitGeneratorSchema, i as initGenerator, a as initSchematic } from './generator-DJ1RuHyR.js';
4
+ export { W as WorkerGeneratorSchema, a as applicationGenerator, b as applicationSchematic } from './generator-DW-9W9Fk.js';
5
+ import * as nx_src_config_workspace_json_project_json from 'nx/src/config/workspace-json-project-json';
6
+ import * as _nx_devkit from '@nx/devkit';
7
+ export { getInternalDependencies, r2UploadFile } from './src/utils/r2-bucket-helpers.js';
8
+ import '@storm-software/workspace-tools';
9
+ import '@aws-sdk/client-s3';
10
+
11
+ declare const name = "storm-software/cloudflare";
12
+ declare const createNodes: (string | ((file: any, _: any, ctx: any) => {
13
+ projects?: undefined;
14
+ } | {
15
+ projects: {
16
+ [x: string]: {
17
+ targets: {
18
+ [targetName: string]: _nx_devkit.TargetConfiguration<any>;
19
+ };
20
+ release: {
21
+ version: {
22
+ generator: string;
23
+ generatorOptions?: Record<string, unknown>;
24
+ };
25
+ };
26
+ name?: string;
27
+ root: string;
28
+ sourceRoot?: string;
29
+ projectType?: _nx_devkit.ProjectType;
30
+ generators?: {
31
+ [collectionName: string]: {
32
+ [generatorName: string]: any;
33
+ };
34
+ };
35
+ implicitDependencies?: string[];
36
+ namedInputs?: {
37
+ [inputName: string]: (string | nx_src_config_workspace_json_project_json.InputDefinition)[];
38
+ };
39
+ tags?: string[];
40
+ metadata?: nx_src_config_workspace_json_project_json.ProjectMetadata;
41
+ };
42
+ };
43
+ }))[];
44
+
45
+ export { createNodes, name };
package/dist/index.js ADDED
@@ -0,0 +1,151 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); 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; }require('./chunk-XO66D74Z.js');
2
+ require('./chunk-DHBG5ASJ.js');
3
+
4
+
5
+
6
+ var _chunkW5J5EWQNjs = require('./chunk-W5J5EWQN.js');
7
+
8
+
9
+
10
+ var _chunkNPJPHEFPjs = require('./chunk-NPJPHEFP.js');
11
+ require('./chunk-CVGPWUNP.js');
12
+ require('./chunk-NKCR3FSU.js');
13
+
14
+
15
+
16
+ var _chunkJCB2DTP6js = require('./chunk-JCB2DTP6.js');
17
+ require('./chunk-R7AIVBS7.js');
18
+ require('./chunk-WGOT27OY.js');
19
+
20
+
21
+
22
+ var _chunkVTHBMY4Bjs = require('./chunk-VTHBMY4B.js');
23
+ require('./chunk-YE4FHRXJ.js');
24
+ require('./chunk-RCE3CC76.js');
25
+
26
+
27
+ var _chunkJ5SB6L2Ljs = require('./chunk-J5SB6L2L.js');
28
+
29
+ // src/plugins/index.ts
30
+ var _fs = require('fs');
31
+ var _path = require('path');
32
+ var _nxjsonjs = require('nx/src/config/nx-json.js');
33
+ var _fileutils = require('nx/src/utils/fileutils');
34
+ var _packagejson = require('nx/src/utils/package-json');
35
+ var name = "storm-software/cloudflare";
36
+ var createNodes = [
37
+ "{**/wrangler.toml}",
38
+ (file, _, ctx) => {
39
+ const packageJson = createPackageJson(file, ctx.workspaceRoot);
40
+ if (!packageJson) {
41
+ return {};
42
+ }
43
+ const project = createProjectFromPackageJsonNextToProjectJson(file, packageJson);
44
+ const nxJson = _nxjsonjs.readNxJson.call(void 0, ctx.workspaceRoot);
45
+ const targets = _packagejson.readTargetsFromPackageJson.call(void 0, packageJson, nxJson);
46
+ targets["serve"] = {
47
+ cache: false,
48
+ inputs: [
49
+ "typescript",
50
+ "^production"
51
+ ],
52
+ dependsOn: [
53
+ "build"
54
+ ],
55
+ executor: "@storm-software/cloudflare-tools:serve",
56
+ options: {
57
+ port: 4500
58
+ }
59
+ };
60
+ targets["clean-package"] = {
61
+ cache: true,
62
+ dependsOn: [
63
+ "build"
64
+ ],
65
+ inputs: [
66
+ "typescript",
67
+ "^production"
68
+ ],
69
+ outputs: [
70
+ "{workspaceRoot}/dist/{projectRoot}"
71
+ ],
72
+ executor: "@storm-software/workspace-tools:clean-package",
73
+ options: {
74
+ cleanReadMe: true,
75
+ cleanComments: true
76
+ }
77
+ };
78
+ targets["nx-release-publish"] = {
79
+ cache: false,
80
+ inputs: [
81
+ "typescript",
82
+ "^production"
83
+ ],
84
+ dependsOn: [
85
+ "clean-package",
86
+ "^nx-release-publish"
87
+ ],
88
+ executor: "@storm-software/cloudflare-tools:cloudflare-publish",
89
+ options: {}
90
+ };
91
+ _chunkVTHBMY4Bjs.addProjectTag.call(void 0, project, _chunkVTHBMY4Bjs.ProjectTagConstants.ProjectType.TAG_ID, project.projectType === "application" ? _chunkVTHBMY4Bjs.ProjectTagConstants.ProjectType.APPLICATION : _chunkVTHBMY4Bjs.ProjectTagConstants.ProjectType.LIBRARY, {
92
+ overwrite: true
93
+ });
94
+ _chunkVTHBMY4Bjs.addProjectTag.call(void 0, project, _chunkVTHBMY4Bjs.ProjectTagConstants.DistStyle.TAG_ID, _chunkVTHBMY4Bjs.ProjectTagConstants.DistStyle.CLEAN, {
95
+ overwrite: true
96
+ });
97
+ _chunkVTHBMY4Bjs.addProjectTag.call(void 0, project, _chunkVTHBMY4Bjs.ProjectTagConstants.Provider.TAG_ID, "cloudflare", {
98
+ overwrite: true
99
+ });
100
+ return _optionalChain([project, 'optionalAccess', _2 => _2.name]) ? {
101
+ projects: {
102
+ [project.name]: {
103
+ ...project,
104
+ targets,
105
+ release: {
106
+ ..._optionalChain([project, 'optionalAccess', _3 => _3.release]),
107
+ version: {
108
+ ..._optionalChain([project, 'optionalAccess', _4 => _4.release, 'optionalAccess', _5 => _5.version]),
109
+ generator: "@storm-software/workspace-tools:release-version"
110
+ }
111
+ }
112
+ }
113
+ }
114
+ } : {};
115
+ }
116
+ ];
117
+ function createProjectFromPackageJsonNextToProjectJson(projectJsonPath, packageJson) {
118
+ const { nx, name: name2 } = packageJson;
119
+ const root = _path.dirname.call(void 0, projectJsonPath);
120
+ return {
121
+ ...nx,
122
+ name: name2,
123
+ root,
124
+ targets: {}
125
+ };
126
+ }
127
+ _chunkJ5SB6L2Ljs.__name.call(void 0, createProjectFromPackageJsonNextToProjectJson, "createProjectFromPackageJsonNextToProjectJson");
128
+ function createPackageJson(projectJsonPath, workspaceRoot) {
129
+ try {
130
+ const root = _path.dirname.call(void 0, projectJsonPath);
131
+ const packageJsonPath = _path.join.call(void 0, workspaceRoot, root, "package.json");
132
+ if (!_fs.existsSync.call(void 0, packageJsonPath)) {
133
+ return null;
134
+ }
135
+ return _fileutils.readJsonFile.call(void 0, packageJsonPath);
136
+ } catch (e) {
137
+ console.log(e);
138
+ return null;
139
+ }
140
+ }
141
+ _chunkJ5SB6L2Ljs.__name.call(void 0, createPackageJson, "createPackageJson");
142
+
143
+
144
+
145
+
146
+
147
+
148
+
149
+
150
+
151
+ exports.applicationGenerator = _chunkW5J5EWQNjs.applicationGenerator; exports.applicationSchematic = _chunkW5J5EWQNjs.applicationSchematic; exports.createNodes = createNodes; exports.getInternalDependencies = _chunkJCB2DTP6js.getInternalDependencies; exports.initGenerator = _chunkNPJPHEFPjs.initGenerator; exports.initSchematic = _chunkNPJPHEFPjs.initSchematic; exports.name = name; exports.r2UploadFile = _chunkJCB2DTP6js.r2UploadFile;