@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
@@ -0,0 +1,89 @@
1
+ import {
2
+ createCliOptions
3
+ } from "./chunk-XU6MTFCV.mjs";
4
+ import {
5
+ __name,
6
+ __require
7
+ } from "./chunk-A7FFSBE6.mjs";
8
+
9
+ // src/executors/cloudflare-publish/executor.ts
10
+ import { joinPathFragments } from "@nx/devkit";
11
+ import { fork } from "node:child_process";
12
+ async function runExecutor(options, context) {
13
+ const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
14
+ if (!context.projectName) {
15
+ throw new Error("The executor requires a projectName.");
16
+ }
17
+ console.info(`\u{1F680} Running Storm Cloudflare Publish executor on the ${context.projectName} worker`);
18
+ if (!context.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
19
+ throw new Error("The executor requires projectsConfigurations.");
20
+ }
21
+ const packageRoot = joinPathFragments(context.root, context.projectsConfigurations.projects[context.projectName]?.root);
22
+ try {
23
+ const args = createCliOptions({
24
+ ...options
25
+ });
26
+ if (isDryRun) {
27
+ args.push("--dry-run");
28
+ }
29
+ console.log("");
30
+ console.log(`Running "wrangler deploy ${args.join(" ")}"...`);
31
+ console.log("");
32
+ let proc;
33
+ try {
34
+ fork(__require.resolve("wrangler/bin/wrangler"), [
35
+ "deploy",
36
+ ...args
37
+ ], {
38
+ env: {
39
+ CLOUDFLARE_ACCOUNT_ID: process.env.STORM_BOT_CLOUDFLARE_ACCOUNT,
40
+ CLOUDFLARE_API_TOKEN: process.env.STORM_BOT_CLOUDFLARE_TOKEN,
41
+ WRANGLER_LOG: "debug",
42
+ ...process.env,
43
+ FORCE_COLOR: "true"
44
+ },
45
+ cwd: packageRoot,
46
+ stdio: [
47
+ "pipe",
48
+ "pipe",
49
+ "pipe",
50
+ "ipc"
51
+ ]
52
+ });
53
+ } catch (e) {
54
+ console.error(e);
55
+ throw new Error("Unable to run Wrangler. Please ensure Wrangler is installed.");
56
+ }
57
+ proc?.stdout?.on("data", (message) => {
58
+ process.stdout.write(message);
59
+ });
60
+ proc?.stderr?.on("data", (message) => {
61
+ process.stderr.write(message);
62
+ });
63
+ return new Promise((resolve) => {
64
+ proc?.on("close", (code) => {
65
+ console.log("");
66
+ if (isDryRun) {
67
+ console.log("Would publish to Cloudflare Workers Registry, but [dry-run] was set");
68
+ } else {
69
+ console.log("Published to Cloudflare Workers Registry");
70
+ }
71
+ return resolve({
72
+ success: code === 0
73
+ });
74
+ });
75
+ });
76
+ } catch (error) {
77
+ console.error("Failed to publish to Cloudflare Workers Registry");
78
+ console.error(error);
79
+ console.log("");
80
+ return {
81
+ success: false
82
+ };
83
+ }
84
+ }
85
+ __name(runExecutor, "runExecutor");
86
+
87
+ export {
88
+ runExecutor
89
+ };
@@ -0,0 +1,89 @@
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; }
2
+
3
+ var _chunkVTHBMY4Bjs = require('./chunk-VTHBMY4B.js');
4
+
5
+
6
+
7
+ var _chunkJ5SB6L2Ljs = require('./chunk-J5SB6L2L.js');
8
+
9
+ // src/executors/cloudflare-publish/executor.ts
10
+ var _devkit = require('@nx/devkit');
11
+ var _child_process = require('child_process');
12
+ async function runExecutor(options, context) {
13
+ const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
14
+ if (!context.projectName) {
15
+ throw new Error("The executor requires a projectName.");
16
+ }
17
+ console.info(`\u{1F680} Running Storm Cloudflare Publish executor on the ${context.projectName} worker`);
18
+ if (!context.projectName || !_optionalChain([context, 'access', _ => _.projectsConfigurations, 'optionalAccess', _2 => _2.projects]) || !context.projectsConfigurations.projects[context.projectName] || !_optionalChain([context, 'access', _3 => _3.projectsConfigurations, 'access', _4 => _4.projects, 'access', _5 => _5[context.projectName], 'optionalAccess', _6 => _6.root])) {
19
+ throw new Error("The executor requires projectsConfigurations.");
20
+ }
21
+ const packageRoot = _devkit.joinPathFragments.call(void 0, context.root, _optionalChain([context, 'access', _7 => _7.projectsConfigurations, 'access', _8 => _8.projects, 'access', _9 => _9[context.projectName], 'optionalAccess', _10 => _10.root]));
22
+ try {
23
+ const args = _chunkVTHBMY4Bjs.createCliOptions.call(void 0, {
24
+ ...options
25
+ });
26
+ if (isDryRun) {
27
+ args.push("--dry-run");
28
+ }
29
+ console.log("");
30
+ console.log(`Running "wrangler deploy ${args.join(" ")}"...`);
31
+ console.log("");
32
+ let proc;
33
+ try {
34
+ _child_process.fork.call(void 0, _chunkJ5SB6L2Ljs.__require.resolve("wrangler/bin/wrangler"), [
35
+ "deploy",
36
+ ...args
37
+ ], {
38
+ env: {
39
+ CLOUDFLARE_ACCOUNT_ID: process.env.STORM_BOT_CLOUDFLARE_ACCOUNT,
40
+ CLOUDFLARE_API_TOKEN: process.env.STORM_BOT_CLOUDFLARE_TOKEN,
41
+ WRANGLER_LOG: "debug",
42
+ ...process.env,
43
+ FORCE_COLOR: "true"
44
+ },
45
+ cwd: packageRoot,
46
+ stdio: [
47
+ "pipe",
48
+ "pipe",
49
+ "pipe",
50
+ "ipc"
51
+ ]
52
+ });
53
+ } catch (e) {
54
+ console.error(e);
55
+ throw new Error("Unable to run Wrangler. Please ensure Wrangler is installed.");
56
+ }
57
+ _optionalChain([proc, 'optionalAccess', _11 => _11.stdout, 'optionalAccess', _12 => _12.on, 'call', _13 => _13("data", (message) => {
58
+ process.stdout.write(message);
59
+ })]);
60
+ _optionalChain([proc, 'optionalAccess', _14 => _14.stderr, 'optionalAccess', _15 => _15.on, 'call', _16 => _16("data", (message) => {
61
+ process.stderr.write(message);
62
+ })]);
63
+ return new Promise((resolve) => {
64
+ _optionalChain([proc, 'optionalAccess', _17 => _17.on, 'call', _18 => _18("close", (code) => {
65
+ console.log("");
66
+ if (isDryRun) {
67
+ console.log("Would publish to Cloudflare Workers Registry, but [dry-run] was set");
68
+ } else {
69
+ console.log("Published to Cloudflare Workers Registry");
70
+ }
71
+ return resolve({
72
+ success: code === 0
73
+ });
74
+ })]);
75
+ });
76
+ } catch (error) {
77
+ console.error("Failed to publish to Cloudflare Workers Registry");
78
+ console.error(error);
79
+ console.log("");
80
+ return {
81
+ success: false
82
+ };
83
+ }
84
+ }
85
+ _chunkJ5SB6L2Ljs.__name.call(void 0, runExecutor, "runExecutor");
86
+
87
+
88
+
89
+ exports.runExecutor = runExecutor;