@storm-software/cloudflare-tools 0.57.0 → 0.58.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 (62) hide show
  1. package/.eslintrc.json +35 -0
  2. package/CHANGELOG.md +28 -0
  3. package/README.md +2 -1
  4. package/dist/{chunk-CFYDEE4U.js → chunk-HBCENDPO.js} +1 -1
  5. package/dist/{chunk-ABAI6EPS.mjs → chunk-JHFXWP7T.mjs} +20 -12
  6. package/dist/{chunk-SOT4IP6Z.js → chunk-QIZFFGG5.js} +2 -2
  7. package/dist/{chunk-PHQC2IT5.mjs → chunk-VM6YSW5Q.mjs} +1 -1
  8. package/dist/{chunk-Q6JTHLLE.mjs → chunk-WKUTBZWB.mjs} +1 -1
  9. package/dist/{chunk-4WULYLQ3.js → chunk-Y5XLPVGH.js} +8 -0
  10. package/dist/executors.js +1 -1
  11. package/dist/executors.mjs +1 -1
  12. package/dist/generators.js +3 -3
  13. package/dist/generators.mjs +2 -2
  14. package/dist/index.js +4 -4
  15. package/dist/index.mjs +3 -3
  16. package/dist/src/executors/cloudflare-publish/executor.js +1 -1
  17. package/dist/src/executors/cloudflare-publish/executor.mjs +1 -1
  18. package/dist/src/executors/serve/executor.js +2 -2
  19. package/dist/src/executors/serve/executor.mjs +1 -1
  20. package/dist/src/generators/init/generator.js +2 -2
  21. package/dist/src/generators/init/generator.mjs +1 -1
  22. package/dist/src/generators/worker/generator.js +3 -3
  23. package/dist/src/generators/worker/generator.mjs +2 -2
  24. package/executors.ts +4 -0
  25. package/generators.ts +4 -0
  26. package/index.ts +4 -0
  27. package/package.json +1 -1
  28. package/project.json +56 -0
  29. package/src/executors/cloudflare-publish/executor.ts +100 -0
  30. package/src/executors/r2-upload-publish/executor.ts +264 -0
  31. package/src/executors/serve/executor.ts +84 -0
  32. package/src/generators/init/generator.spec.ts +20 -0
  33. package/src/generators/init/generator.ts +60 -0
  34. package/src/generators/init/libs/versions.ts +7 -0
  35. package/src/generators/worker/generator.spec.ts +20 -0
  36. package/src/generators/worker/generator.ts +289 -0
  37. package/src/generators/worker/libs/get-account-id.ts +3 -0
  38. package/src/generators/worker/libs/vitest-imports.ts +1 -0
  39. package/src/generators/worker/libs/vitest-script.ts +1 -0
  40. package/src/plugins/index.ts +137 -0
  41. package/src/utils/index.ts +1 -0
  42. package/src/utils/r2-bucket-helpers.ts +56 -0
  43. package/tsconfig.json +31 -0
  44. package/tsup.config.ts +27 -0
  45. /package/{dist/src → src}/executors/cloudflare-publish/schema.d.ts +0 -0
  46. /package/{dist/src → src}/executors/cloudflare-publish/schema.json +0 -0
  47. /package/{dist/src → src}/executors/r2-upload-publish/schema.d.ts +0 -0
  48. /package/{dist/src → src}/executors/r2-upload-publish/schema.json +0 -0
  49. /package/{dist/src → src}/executors/serve/schema.d.ts +0 -0
  50. /package/{dist/src → src}/executors/serve/schema.json +0 -0
  51. /package/{dist/src → src}/generators/init/schema.d.ts +0 -0
  52. /package/{dist/src → src}/generators/init/schema.json +0 -0
  53. /package/{dist/src → src}/generators/worker/files/common/package.json__tmpl__ +0 -0
  54. /package/{dist/src → src}/generators/worker/files/common/wrangler.toml__tmpl__ +0 -0
  55. /package/{dist/src → src}/generators/worker/files/fetch-handler/index.test.ts__tmpl__ +0 -0
  56. /package/{dist/src → src}/generators/worker/files/fetch-handler/index.ts__tmpl__ +0 -0
  57. /package/{dist/src → src}/generators/worker/files/hono/index.test.ts__tmpl__ +0 -0
  58. /package/{dist/src → src}/generators/worker/files/hono/index.ts__tmpl__ +0 -0
  59. /package/{dist/src → src}/generators/worker/files/scheduled-handler/index.test.ts__tmpl__ +0 -0
  60. /package/{dist/src → src}/generators/worker/files/scheduled-handler/index.ts__tmpl__ +0 -0
  61. /package/{dist/src → src}/generators/worker/schema.d.ts +0 -0
  62. /package/{dist/src → src}/generators/worker/schema.json +0 -0
package/.eslintrc.json ADDED
@@ -0,0 +1,35 @@
1
+ {
2
+ "extends": ["../../.eslintrc.json"],
3
+ "ignorePatterns": ["!**/*"],
4
+ "overrides": [
5
+ {
6
+ "files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7
+ "parserOptions": {
8
+ "project": ["packages/cloudflare-tools/tsconfig.*?.json"]
9
+ },
10
+ "rules": {}
11
+ },
12
+ {
13
+ "files": ["*.ts", "*.tsx"],
14
+ "rules": {}
15
+ },
16
+ {
17
+ "files": ["*.js", "*.jsx"],
18
+ "rules": {}
19
+ },
20
+ {
21
+ "files": ["*.json"],
22
+ "parser": "jsonc-eslint-parser",
23
+ "rules": {
24
+ "@nx/dependency-checks": "error"
25
+ }
26
+ },
27
+ {
28
+ "files": ["./package.json", "./executors.json", "./generators.json"],
29
+ "parser": "jsonc-eslint-parser",
30
+ "rules": {
31
+ "@nx/nx-plugin-checks": "error"
32
+ }
33
+ }
34
+ ]
35
+ }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  # Changelog for Storm Ops - Cloudflare Tools
4
4
 
5
+ ## [0.58.0](https://github.com/storm-software/storm-ops/releases/tag/cloudflare-tools%400.58.0) (2025-05-06)
6
+
7
+ ### Features
8
+
9
+ - **workspace-tools:** Update the publish executor source code
10
+ ([527dcfe84](https://github.com/storm-software/storm-ops/commit/527dcfe84))
11
+
12
+ ### Miscellaneous
13
+
14
+ - **monorepo:** Regenerate README markdown files
15
+ ([d58a4014e](https://github.com/storm-software/storm-ops/commit/d58a4014e))
16
+
17
+ ## [0.57.2](https://github.com/storm-software/storm-ops/releases/tag/cloudflare-tools%400.57.2) (2025-05-05)
18
+
19
+ ### Miscellaneous
20
+
21
+ - **workspace-tools:** Skip git checks during publish
22
+ ([7fdcbfc9a](https://github.com/storm-software/storm-ops/commit/7fdcbfc9a))
23
+ - **monorepo:** Regenerate README markdown files
24
+ ([fb8ab0609](https://github.com/storm-software/storm-ops/commit/fb8ab0609))
25
+
26
+ ## [0.57.1](https://github.com/storm-software/storm-ops/releases/tag/cloudflare-tools%400.57.1) (2025-05-05)
27
+
28
+ ### Miscellaneous
29
+
30
+ - **monorepo:** Regenerate README markdown files
31
+ ([372776939](https://github.com/storm-software/storm-ops/commit/372776939))
32
+
5
33
  ## [0.57.0](https://github.com/storm-software/storm-ops/releases/tag/cloudflare-tools%400.57.0) (2025-05-05)
6
34
 
7
35
  ### Features
package/README.md CHANGED
@@ -21,7 +21,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
21
21
 
22
22
  <h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
23
23
 
24
- [![Version](https://img.shields.io/badge/version-0.56.5-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
24
+ [![Version](https://img.shields.io/badge/version-0.57.1-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
25
25
 
26
26
  <!-- prettier-ignore-start -->
27
27
  <!-- markdownlint-disable -->
@@ -40,6 +40,7 @@ This package is part of the <b>⚡Storm-Ops</b> monorepo. The Storm-Ops packages
40
40
 
41
41
  <!-- START doctoc -->
42
42
  <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
43
+
43
44
  ## Table of Contents
44
45
 
45
46
  - [Storm Cloudflare Tools](#storm-cloudflare-tools)
@@ -7,7 +7,7 @@ var require_package = _chunkMCKGQKYUjs.__commonJS.call(void 0, {
7
7
  "package.json"(exports, module) {
8
8
  module.exports = {
9
9
  name: "@storm-software/cloudflare-tools",
10
- version: "0.57.0",
10
+ version: "0.57.2",
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",
@@ -1248,8 +1248,16 @@ var executor_default6 = withRunExecutor(
1248
1248
  );
1249
1249
 
1250
1250
  // ../workspace-tools/src/executors/npm-publish/executor.ts
1251
+ import {
1252
+ detectPackageManager,
1253
+ readJsonFile
1254
+ } from "@nx/devkit";
1255
+ import { exec } from "child_process";
1256
+ import * as columnify from "columnify";
1257
+ import { existsSync as existsSync6 } from "fs";
1251
1258
  import { execSync as execSync3 } from "node:child_process";
1252
- import { readFile as readFile5 } from "node:fs/promises";
1259
+ import { env as appendLocalEnv } from "npm-run-path";
1260
+ import { join, relative as relative3 } from "path";
1253
1261
 
1254
1262
  // ../workspace-tools/src/utils/pnpm-deps-update.ts
1255
1263
  import { existsSync as existsSync5 } from "node:fs";
@@ -2536,8 +2544,8 @@ var DEFAULT_COMMIT_QUESTIONS = {
2536
2544
  };
2537
2545
 
2538
2546
  // ../workspace-tools/src/generators/release-version/generator.ts
2539
- import { exec, execSync as execSync4 } from "node:child_process";
2540
- import { relative as relative3 } from "node:path";
2547
+ import { exec as exec2, execSync as execSync4 } from "node:child_process";
2548
+ import { relative as relative4 } from "node:path";
2541
2549
  import { IMPLICIT_DEFAULT_RELEASE_GROUP } from "nx/src/command-line/release/config/config";
2542
2550
  import {
2543
2551
  getFirstGitCommit,
@@ -2925,11 +2933,11 @@ import { retrieveProjectConfigurationsWithoutPluginInference } from "nx/src/proj
2925
2933
  // ../workspace-tools/src/utils/lock-file.ts
2926
2934
  import {
2927
2935
  output as output2,
2928
- readJsonFile,
2936
+ readJsonFile as readJsonFile2,
2929
2937
  workspaceRoot as workspaceRoot2
2930
2938
  } from "@nx/devkit";
2931
- import { existsSync as existsSync6 } from "node:fs";
2932
- import { join as join2 } from "node:path";
2939
+ import { existsSync as existsSync7 } from "node:fs";
2940
+ import { join as join3 } from "node:path";
2933
2941
  import {
2934
2942
  getNpmLockfileDependencies,
2935
2943
  getNpmLockfileNodes
@@ -2945,15 +2953,15 @@ import {
2945
2953
  var YARN_LOCK_FILE = "yarn.lock";
2946
2954
  var NPM_LOCK_FILE = "package-lock.json";
2947
2955
  var PNPM_LOCK_FILE = "pnpm-lock.yaml";
2948
- var YARN_LOCK_PATH = join2(workspaceRoot2, YARN_LOCK_FILE);
2949
- var NPM_LOCK_PATH = join2(workspaceRoot2, NPM_LOCK_FILE);
2950
- var PNPM_LOCK_PATH = join2(workspaceRoot2, PNPM_LOCK_FILE);
2956
+ var YARN_LOCK_PATH = join3(workspaceRoot2, YARN_LOCK_FILE);
2957
+ var NPM_LOCK_PATH = join3(workspaceRoot2, NPM_LOCK_FILE);
2958
+ var PNPM_LOCK_PATH = join3(workspaceRoot2, PNPM_LOCK_FILE);
2951
2959
 
2952
2960
  // ../workspace-tools/src/utils/plugin-helpers.ts
2953
- import { readJsonFile as readJsonFile2 } from "@nx/devkit";
2961
+ import { readJsonFile as readJsonFile3 } from "@nx/devkit";
2954
2962
  import defu4 from "defu";
2955
- import { existsSync as existsSync7 } from "node:fs";
2956
- import { dirname, join as join3 } from "node:path";
2963
+ import { existsSync as existsSync8 } from "node:fs";
2964
+ import { dirname, join as join4 } from "node:path";
2957
2965
 
2958
2966
  // ../workspace-tools/src/utils/typia-transform.ts
2959
2967
  import transform2 from "typia/lib/transform";
@@ -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 _chunkCFYDEE4Ujs = require('./chunk-CFYDEE4U.js');
3
+ var _chunkHBCENDPOjs = require('./chunk-HBCENDPO.js');
4
4
 
5
5
 
6
6
  var _chunkHBASMEU5js = require('./chunk-HBASMEU5.js');
@@ -66,7 +66,7 @@ ${Object.keys(process.env).map((key) => ` - ${key}=${JSON.stringify(process.env[
66
66
  const options = await normalizeOptions(tree, schema, config);
67
67
  const tasks = [];
68
68
  tasks.push(
69
- await _chunkCFYDEE4Ujs.generator_default.call(void 0, tree, {
69
+ await _chunkHBCENDPOjs.generator_default.call(void 0, tree, {
70
70
  ...options,
71
71
  skipFormat: true
72
72
  })
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  generator_default
3
- } from "./chunk-Q6JTHLLE.mjs";
3
+ } from "./chunk-WKUTBZWB.mjs";
4
4
  import {
5
5
  getConfig
6
6
  } from "./chunk-GPAI4NHQ.mjs";
@@ -7,7 +7,7 @@ var require_package = __commonJS({
7
7
  "package.json"(exports, module) {
8
8
  module.exports = {
9
9
  name: "@storm-software/cloudflare-tools",
10
- version: "0.57.0",
10
+ version: "0.57.2",
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",
@@ -1250,6 +1250,14 @@ var executor_default6 = withRunExecutor(
1250
1250
 
1251
1251
 
1252
1252
 
1253
+
1254
+
1255
+ var _columnify = require('columnify'); var columnify = _interopRequireWildcard(_columnify);
1256
+
1257
+
1258
+ var _npmrunpath = require('npm-run-path');
1259
+
1260
+
1253
1261
  // ../workspace-tools/src/utils/pnpm-deps-update.ts
1254
1262
 
1255
1263
 
package/dist/executors.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";require('./chunk-XO66D74Z.js');
2
2
  require('./chunk-I4P7DVDN.js');
3
- require('./chunk-4WULYLQ3.js');
3
+ require('./chunk-Y5XLPVGH.js');
4
4
  require('./chunk-HIUZ6UL7.js');
5
5
  require('./chunk-RIUVF72K.js');
6
6
  require('./chunk-6XDOBG77.js');
@@ -1,6 +1,6 @@
1
1
  import "./chunk-YSCEY447.mjs";
2
2
  import "./chunk-QPABB45G.mjs";
3
- import "./chunk-ABAI6EPS.mjs";
3
+ import "./chunk-JHFXWP7T.mjs";
4
4
  import "./chunk-ISGKIYF5.mjs";
5
5
  import "./chunk-FABNT5TZ.mjs";
6
6
  import "./chunk-L4WFYC7K.mjs";
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkSOT4IP6Zjs = require('./chunk-SOT4IP6Z.js');
5
+ var _chunkQIZFFGG5js = require('./chunk-QIZFFGG5.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkCFYDEE4Ujs = require('./chunk-CFYDEE4U.js');
9
+ var _chunkHBCENDPOjs = require('./chunk-HBCENDPO.js');
10
10
  require('./chunk-HBASMEU5.js');
11
11
  require('./chunk-PZ5CI56F.js');
12
12
  require('./chunk-MCKGQKYU.js');
@@ -15,4 +15,4 @@ require('./chunk-MCKGQKYU.js');
15
15
 
16
16
 
17
17
 
18
- exports.applicationGenerator = _chunkSOT4IP6Zjs.applicationGenerator; exports.applicationSchematic = _chunkSOT4IP6Zjs.applicationSchematic; exports.initGenerator = _chunkCFYDEE4Ujs.initGenerator; exports.initSchematic = _chunkCFYDEE4Ujs.initSchematic;
18
+ exports.applicationGenerator = _chunkQIZFFGG5js.applicationGenerator; exports.applicationSchematic = _chunkQIZFFGG5js.applicationSchematic; exports.initGenerator = _chunkHBCENDPOjs.initGenerator; exports.initSchematic = _chunkHBCENDPOjs.initSchematic;
@@ -2,11 +2,11 @@ import "./chunk-3J7KBHMJ.mjs";
2
2
  import {
3
3
  applicationGenerator,
4
4
  applicationSchematic
5
- } from "./chunk-PHQC2IT5.mjs";
5
+ } from "./chunk-VM6YSW5Q.mjs";
6
6
  import {
7
7
  initGenerator,
8
8
  initSchematic
9
- } from "./chunk-Q6JTHLLE.mjs";
9
+ } from "./chunk-WKUTBZWB.mjs";
10
10
  import "./chunk-GPAI4NHQ.mjs";
11
11
  import "./chunk-MV24QW26.mjs";
12
12
  import "./chunk-QQ22YQSB.mjs";
package/dist/index.js CHANGED
@@ -3,14 +3,14 @@ require('./chunk-DHBG5ASJ.js');
3
3
 
4
4
 
5
5
 
6
- var _chunkSOT4IP6Zjs = require('./chunk-SOT4IP6Z.js');
6
+ var _chunkQIZFFGG5js = require('./chunk-QIZFFGG5.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkCFYDEE4Ujs = require('./chunk-CFYDEE4U.js');
10
+ var _chunkHBCENDPOjs = require('./chunk-HBCENDPO.js');
11
11
  require('./chunk-CVGPWUNP.js');
12
12
  require('./chunk-I4P7DVDN.js');
13
- require('./chunk-4WULYLQ3.js');
13
+ require('./chunk-Y5XLPVGH.js');
14
14
  require('./chunk-HIUZ6UL7.js');
15
15
 
16
16
 
@@ -140,4 +140,4 @@ function createPackageJson(projectJsonPath, workspaceRoot) {
140
140
 
141
141
 
142
142
 
143
- exports.applicationGenerator = _chunkSOT4IP6Zjs.applicationGenerator; exports.applicationSchematic = _chunkSOT4IP6Zjs.applicationSchematic; exports.createNodes = createNodes; exports.getInternalDependencies = _chunkRIUVF72Kjs.getInternalDependencies; exports.initGenerator = _chunkCFYDEE4Ujs.initGenerator; exports.initSchematic = _chunkCFYDEE4Ujs.initSchematic; exports.name = name; exports.r2UploadFile = _chunkRIUVF72Kjs.r2UploadFile;
143
+ exports.applicationGenerator = _chunkQIZFFGG5js.applicationGenerator; exports.applicationSchematic = _chunkQIZFFGG5js.applicationSchematic; exports.createNodes = createNodes; exports.getInternalDependencies = _chunkRIUVF72Kjs.getInternalDependencies; exports.initGenerator = _chunkHBCENDPOjs.initGenerator; exports.initSchematic = _chunkHBCENDPOjs.initSchematic; exports.name = name; exports.r2UploadFile = _chunkRIUVF72Kjs.r2UploadFile;
package/dist/index.mjs CHANGED
@@ -3,14 +3,14 @@ import "./chunk-3J7KBHMJ.mjs";
3
3
  import {
4
4
  applicationGenerator,
5
5
  applicationSchematic
6
- } from "./chunk-PHQC2IT5.mjs";
6
+ } from "./chunk-VM6YSW5Q.mjs";
7
7
  import {
8
8
  initGenerator,
9
9
  initSchematic
10
- } from "./chunk-Q6JTHLLE.mjs";
10
+ } from "./chunk-WKUTBZWB.mjs";
11
11
  import "./chunk-7Z5PILRU.mjs";
12
12
  import "./chunk-QPABB45G.mjs";
13
- import "./chunk-ABAI6EPS.mjs";
13
+ import "./chunk-JHFXWP7T.mjs";
14
14
  import "./chunk-ISGKIYF5.mjs";
15
15
  import {
16
16
  getInternalDependencies,
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
  var _chunkI4P7DVDNjs = require('../../../chunk-I4P7DVDN.js');
4
- require('../../../chunk-4WULYLQ3.js');
4
+ require('../../../chunk-Y5XLPVGH.js');
5
5
  require('../../../chunk-6XDOBG77.js');
6
6
  require('../../../chunk-HBASMEU5.js');
7
7
  require('../../../chunk-PZ5CI56F.js');
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  runExecutor
3
3
  } from "../../../chunk-QPABB45G.mjs";
4
- import "../../../chunk-ABAI6EPS.mjs";
4
+ import "../../../chunk-JHFXWP7T.mjs";
5
5
  import "../../../chunk-L4WFYC7K.mjs";
6
6
  import "../../../chunk-GPAI4NHQ.mjs";
7
7
  import "../../../chunk-MV24QW26.mjs";
@@ -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 _chunk4WULYLQ3js = require('../../../chunk-4WULYLQ3.js');
3
+ var _chunkY5XLPVGHjs = require('../../../chunk-Y5XLPVGH.js');
4
4
 
5
5
 
6
6
  var _chunk6XDOBG77js = require('../../../chunk-6XDOBG77.js');
@@ -55,7 +55,7 @@ async function* serveExecutor(options, context, config) {
55
55
  success: true
56
56
  };
57
57
  }
58
- var executor_default = _chunk4WULYLQ3js.withRunExecutor.call(void 0,
58
+ var executor_default = _chunkY5XLPVGHjs.withRunExecutor.call(void 0,
59
59
  "Cloudflare Serve executor",
60
60
  serveExecutor,
61
61
  {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  withRunExecutor
3
- } from "../../../chunk-ABAI6EPS.mjs";
3
+ } from "../../../chunk-JHFXWP7T.mjs";
4
4
  import {
5
5
  createCliOptions
6
6
  } from "../../../chunk-L4WFYC7K.mjs";
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkCFYDEE4Ujs = require('../../../chunk-CFYDEE4U.js');
5
+ var _chunkHBCENDPOjs = require('../../../chunk-HBCENDPO.js');
6
6
  require('../../../chunk-MCKGQKYU.js');
7
7
 
8
8
 
9
9
 
10
10
 
11
- exports.default = _chunkCFYDEE4Ujs.generator_default; exports.initGenerator = _chunkCFYDEE4Ujs.initGenerator; exports.initSchematic = _chunkCFYDEE4Ujs.initSchematic;
11
+ exports.default = _chunkHBCENDPOjs.generator_default; exports.initGenerator = _chunkHBCENDPOjs.initGenerator; exports.initSchematic = _chunkHBCENDPOjs.initSchematic;
@@ -2,7 +2,7 @@ import {
2
2
  generator_default,
3
3
  initGenerator,
4
4
  initSchematic
5
- } from "../../../chunk-Q6JTHLLE.mjs";
5
+ } from "../../../chunk-WKUTBZWB.mjs";
6
6
  import "../../../chunk-QQ22YQSB.mjs";
7
7
  export {
8
8
  generator_default as default,
@@ -2,8 +2,8 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkSOT4IP6Zjs = require('../../../chunk-SOT4IP6Z.js');
6
- require('../../../chunk-CFYDEE4U.js');
5
+ var _chunkQIZFFGG5js = require('../../../chunk-QIZFFGG5.js');
6
+ require('../../../chunk-HBCENDPO.js');
7
7
  require('../../../chunk-HBASMEU5.js');
8
8
  require('../../../chunk-PZ5CI56F.js');
9
9
  require('../../../chunk-MCKGQKYU.js');
@@ -11,4 +11,4 @@ require('../../../chunk-MCKGQKYU.js');
11
11
 
12
12
 
13
13
 
14
- exports.applicationGenerator = _chunkSOT4IP6Zjs.applicationGenerator; exports.applicationSchematic = _chunkSOT4IP6Zjs.applicationSchematic; exports.default = _chunkSOT4IP6Zjs.generator_default;
14
+ exports.applicationGenerator = _chunkQIZFFGG5js.applicationGenerator; exports.applicationSchematic = _chunkQIZFFGG5js.applicationSchematic; exports.default = _chunkQIZFFGG5js.generator_default;
@@ -2,8 +2,8 @@ import {
2
2
  applicationGenerator,
3
3
  applicationSchematic,
4
4
  generator_default
5
- } from "../../../chunk-PHQC2IT5.mjs";
6
- import "../../../chunk-Q6JTHLLE.mjs";
5
+ } from "../../../chunk-VM6YSW5Q.mjs";
6
+ import "../../../chunk-WKUTBZWB.mjs";
7
7
  import "../../../chunk-GPAI4NHQ.mjs";
8
8
  import "../../../chunk-MV24QW26.mjs";
9
9
  import "../../../chunk-QQ22YQSB.mjs";
package/executors.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./src/executors/cloudflare-publish/executor";
2
+ export { type CloudflarePublishExecutorSchema } from "./src/executors/cloudflare-publish/schema.d";
3
+ export * from "./src/executors/r2-upload-publish/executor";
4
+ export { type R2UploadPublishExecutorSchema } from "./src/executors/r2-upload-publish/schema.d";
package/generators.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./src/generators/init/generator";
2
+ export { type InitGeneratorSchema } from "./src/generators/init/schema.d";
3
+ export * from "./src/generators/worker/generator";
4
+ export { type WorkerGeneratorSchema } from "./src/generators/worker/schema.d";
package/index.ts ADDED
@@ -0,0 +1,4 @@
1
+ export * from "./executors";
2
+ export * from "./generators";
3
+ export * from "./src/plugins";
4
+ export * from "./src/utils";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/cloudflare-tools",
3
- "version": "0.57.0",
3
+ "version": "0.58.0",
4
4
  "description": "A Nx plugin package that contains various executors, generators, and utilities that assist in managing Cloudflare services.",
5
5
  "repository": {
6
6
  "type": "github",
package/project.json ADDED
@@ -0,0 +1,56 @@
1
+ {
2
+ "name": "cloudflare-tools",
3
+ "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
+ "sourceRoot": "packages/cloudflare-tools/src",
5
+ "projectType": "library",
6
+ "targets": {
7
+ "build-untyped": {
8
+ "executor": "nx:run-commands",
9
+ "dependsOn": ["clean", "^build"],
10
+ "inputs": [
11
+ "{projectRoot}/src/**/untyped.ts",
12
+ "{projectRoot}/src/**/*.untyped.ts"
13
+ ],
14
+ "outputs": [
15
+ "{projectRoot}/src/**/schema.d.ts",
16
+ "{projectRoot}/src/**/*.schema.d.ts",
17
+ "{projectRoot}/src/**/schema.md",
18
+ "{projectRoot}/src/**/*.schema.md",
19
+ "{projectRoot}/src/**/schema.json",
20
+ "{projectRoot}/src/**/*.schema.json"
21
+ ],
22
+ "options": {
23
+ "commands": [
24
+ "node dist/packages/untyped/bin/untyped.cjs generate --entry=\"packages/cloudflare-tools/**/{untyped.ts,*.untyped.ts}\" "
25
+ ]
26
+ }
27
+ },
28
+ "build-base": {
29
+ "executor": "nx:run-commands",
30
+ "dependsOn": ["build-untyped", "clean", "^build"],
31
+ "options": {
32
+ "command": "tsup-node --config=tsup.config.ts",
33
+ "cwd": "{projectRoot}"
34
+ }
35
+ },
36
+ "build": {
37
+ "executor": "nx:run-commands",
38
+ "dependsOn": ["build-base", "build-untyped"],
39
+ "options": {
40
+ "commands": [
41
+ "pnpm copyfiles LICENSE dist/packages/cloudflare-tools",
42
+ "pnpm copyfiles --up=2 ./packages/cloudflare-tools/*.md ./packages/cloudflare-tools/executors.json ./packages/cloudflare-tools/generators.json ./packages/cloudflare-tools/package.json dist/packages/cloudflare-tools",
43
+ "pnpm copyfiles --up=3 \"./packages/cloudflare-tools/dist/**/*\" dist/packages/cloudflare-tools/dist",
44
+ "pnpm copyfiles --up=3 \"./packages/cloudflare-tools/src/**/*schema.d.ts\" dist/packages/cloudflare-tools/dist/src",
45
+ "pnpm copyfiles --up=3 \"./packages/cloudflare-tools/src/**/*schema.json\" dist/packages/cloudflare-tools/dist/src",
46
+ "pnpm copyfiles --up=3 \"./packages/cloudflare-tools/src/**/*.md\" dist/packages/cloudflare-tools/docs/api",
47
+ "pnpm copyfiles --up=4 \"./packages/cloudflare-tools/src/generators/*/files/**/*\" dist/packages/cloudflare-tools/dist/src/generators"
48
+ ]
49
+ }
50
+ },
51
+ "nx-release-publish": {
52
+ "executor": "@storm-software/workspace-tools:npm-publish"
53
+ }
54
+ },
55
+ "implicitDependencies": ["workspace-tools", "config-tools", "config"]
56
+ }
@@ -0,0 +1,100 @@
1
+ import { joinPathFragments, type ExecutorContext } from "@nx/devkit";
2
+ import { createCliOptions } from "@storm-software/workspace-tools";
3
+ import { fork } from "node:child_process";
4
+ import type { CloudflarePublishExecutorSchema } from "./schema";
5
+
6
+ export default async function runExecutor(
7
+ options: CloudflarePublishExecutorSchema,
8
+ context: ExecutorContext,
9
+ ) {
10
+ /**
11
+ * We need to check both the env var and the option because the executor may have been triggered
12
+ * indirectly via dependsOn, in which case the env var will be set, but the option will not.
13
+ */
14
+ const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
15
+
16
+ if (!context.projectName) {
17
+ throw new Error("The executor requires a projectName.");
18
+ }
19
+
20
+ console.info(
21
+ `🚀 Running Storm Cloudflare Publish executor on the ${context.projectName} worker`,
22
+ );
23
+
24
+ if (
25
+ !context.projectName ||
26
+ !context.projectsConfigurations?.projects ||
27
+ !context.projectsConfigurations.projects[context.projectName] ||
28
+ !context.projectsConfigurations.projects[context.projectName]?.root
29
+ ) {
30
+ throw new Error("The executor requires projectsConfigurations.");
31
+ }
32
+
33
+ const packageRoot = joinPathFragments(
34
+ context.root,
35
+ context.projectsConfigurations.projects[context.projectName]
36
+ ?.root as string,
37
+ );
38
+
39
+ try {
40
+ const args = createCliOptions({ ...options });
41
+ if (isDryRun) {
42
+ args.push("--dry-run");
43
+ }
44
+
45
+ console.log("");
46
+ console.log(`Running "wrangler deploy ${args.join(" ")}"...`);
47
+ console.log("");
48
+
49
+ let proc;
50
+ try {
51
+ fork(require.resolve("wrangler/bin/wrangler"), ["deploy", ...args], {
52
+ env: {
53
+ CLOUDFLARE_ACCOUNT_ID: process.env.STORM_BOT_CLOUDFLARE_ACCOUNT,
54
+ CLOUDFLARE_API_TOKEN: process.env.STORM_BOT_CLOUDFLARE_TOKEN,
55
+ WRANGLER_LOG: "debug",
56
+ ...process.env,
57
+ FORCE_COLOR: "true",
58
+ },
59
+ cwd: packageRoot,
60
+ stdio: ["pipe", "pipe", "pipe", "ipc"],
61
+ });
62
+ } catch (e) {
63
+ console.error(e);
64
+ throw new Error(
65
+ "Unable to run Wrangler. Please ensure Wrangler is installed.",
66
+ );
67
+ }
68
+
69
+ proc?.stdout?.on("data", (message) => {
70
+ process.stdout.write(message);
71
+ });
72
+ proc?.stderr?.on("data", (message) => {
73
+ process.stderr.write(message);
74
+ });
75
+
76
+ return new Promise<{ success: boolean }>((resolve) => {
77
+ proc?.on("close", (code) => {
78
+ console.log("");
79
+
80
+ if (isDryRun) {
81
+ console.log(
82
+ "Would publish to Cloudflare Workers Registry, but [dry-run] was set",
83
+ );
84
+ } else {
85
+ console.log("Published to Cloudflare Workers Registry");
86
+ }
87
+
88
+ return resolve({ success: code === 0 });
89
+ });
90
+ });
91
+ } catch (error: any) {
92
+ console.error("Failed to publish to Cloudflare Workers Registry");
93
+ console.error(error);
94
+ console.log("");
95
+
96
+ return {
97
+ success: false,
98
+ };
99
+ }
100
+ }