@storm-software/cloudflare-tools 0.63.16 → 0.63.17

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 (31) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +1 -1
  3. package/dist/{chunk-UDO5RHFZ.mjs → chunk-2D6E5WHF.mjs} +2 -3
  4. package/dist/{chunk-DY4VZ7GU.mjs → chunk-4HGNUVBV.mjs} +1 -1
  5. package/dist/{chunk-LDBLH2SH.mjs → chunk-5GHZLCED.mjs} +2 -2
  6. package/dist/{chunk-HYKWJFHA.js → chunk-6XLZW53F.js} +1 -2
  7. package/dist/{chunk-KFW57WFF.js → chunk-7YRSU6LT.js} +1 -1
  8. package/dist/{chunk-2ET7ZYTU.mjs → chunk-CLLH7VQR.mjs} +1 -1
  9. package/dist/chunk-HAY2AZCJ.mjs +209 -0
  10. package/dist/{chunk-P4WMZO6U.mjs → chunk-KFTI2KG7.mjs} +2 -2
  11. package/dist/chunk-VWJQB4WQ.js +209 -0
  12. package/dist/{chunk-4VIHS54J.js → chunk-Y2SETYLL.js} +2 -2
  13. package/dist/executors.js +1 -1
  14. package/dist/executors.mjs +3 -3
  15. package/dist/generators.js +3 -3
  16. package/dist/generators.mjs +3 -3
  17. package/dist/index.js +4 -4
  18. package/dist/index.mjs +5 -5
  19. package/dist/src/executors/cloudflare-publish/executor.js +1 -1
  20. package/dist/src/executors/cloudflare-publish/executor.mjs +3 -3
  21. package/dist/src/executors/r2-upload-publish/executor.mjs +1 -1
  22. package/dist/src/executors/serve/executor.js +2 -2
  23. package/dist/src/executors/serve/executor.mjs +2 -2
  24. package/dist/src/generators/init/generator.js +2 -2
  25. package/dist/src/generators/init/generator.mjs +2 -2
  26. package/dist/src/generators/worker/generator.js +3 -3
  27. package/dist/src/generators/worker/generator.mjs +3 -3
  28. package/dist/src/utils/index.mjs +1 -1
  29. package/dist/src/utils/r2-bucket-helpers.mjs +1 -1
  30. package/dist/tsup.config.mjs +1 -1
  31. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  # Changelog for Storm Ops - Cloudflare Tools
4
4
 
5
+ ## [0.63.16](https://github.com/storm-software/storm-ops/releases/tag/cloudflare-tools%400.63.16) (2025-06-05)
6
+
7
+ ### Miscellaneous
8
+
9
+ - **monorepo:** Regenerate README markdown files
10
+ - **monorepo:** Regenerate README markdown files
11
+
5
12
  ## [0.63.15](https://github.com/storm-software/storm-ops/releases/tag/cloudflare-tools%400.63.15) (2025-06-05)
6
13
 
7
14
  ### Miscellaneous
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.63.15-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.63.16-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 -->
@@ -23,7 +23,7 @@ import {
23
23
  import {
24
24
  __dirname,
25
25
  __require
26
- } from "./chunk-2ET7ZYTU.mjs";
26
+ } from "./chunk-CLLH7VQR.mjs";
27
27
 
28
28
  // ../config-tools/src/utilities/apply-workspace-tokens.ts
29
29
  var applyWorkspaceBaseTokens = async (option, tokenParams) => {
@@ -770,7 +770,6 @@ var DEFAULT_BUILD_OPTIONS = {
770
770
  platform: "node",
771
771
  target: "node22",
772
772
  format: "esm",
773
- tsconfig: "tsconfig.json",
774
773
  mode: "production",
775
774
  generatePackageJson: true,
776
775
  includeSrc: false,
@@ -854,8 +853,8 @@ async function resolveContext(userOptions) {
854
853
  const env = getEnv("esbuild", options);
855
854
  const define = defu2(options.define ?? {}, env ?? {});
856
855
  const resolvedOptions = {
857
- tsconfig: joinPaths(workspaceRoot3.dir, projectRoot, "tsconfig.json"),
858
856
  ...options,
857
+ tsconfig: userOptions.tsconfig === null ? void 0 : userOptions.tsconfig ? userOptions.tsconfig : joinPaths(workspaceRoot3.dir, projectRoot, "tsconfig.json"),
859
858
  metafile: userOptions.mode === "development",
860
859
  clean: false,
861
860
  env,
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-RH2IXKSC.mjs";
4
4
  import {
5
5
  __require
6
- } from "./chunk-2ET7ZYTU.mjs";
6
+ } from "./chunk-CLLH7VQR.mjs";
7
7
 
8
8
  // src/executors/cloudflare-publish/executor.ts
9
9
  import { joinPathFragments } from "@nx/devkit";
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  __commonJS
3
- } from "./chunk-2ET7ZYTU.mjs";
3
+ } from "./chunk-CLLH7VQR.mjs";
4
4
 
5
5
  // package.json
6
6
  var require_package = __commonJS({
7
7
  "package.json"(exports, module) {
8
8
  module.exports = {
9
9
  name: "@storm-software/cloudflare-tools",
10
- version: "0.63.15",
10
+ version: "0.63.16",
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",
@@ -769,7 +769,6 @@ var DEFAULT_BUILD_OPTIONS = {
769
769
  platform: "node",
770
770
  target: "node22",
771
771
  format: "esm",
772
- tsconfig: "tsconfig.json",
773
772
  mode: "production",
774
773
  generatePackageJson: true,
775
774
  includeSrc: false,
@@ -853,8 +852,8 @@ async function resolveContext(userOptions) {
853
852
  const env = getEnv("esbuild", options);
854
853
  const define = _defu2.default.call(void 0, _nullishCoalesce(options.define, () => ( {})), _nullishCoalesce(env, () => ( {})));
855
854
  const resolvedOptions = {
856
- tsconfig: _chunkSQUJ3SXLjs.joinPaths.call(void 0, workspaceRoot3.dir, projectRoot, "tsconfig.json"),
857
855
  ...options,
856
+ tsconfig: userOptions.tsconfig === null ? void 0 : userOptions.tsconfig ? userOptions.tsconfig : _chunkSQUJ3SXLjs.joinPaths.call(void 0, workspaceRoot3.dir, projectRoot, "tsconfig.json"),
858
857
  metafile: userOptions.mode === "development",
859
858
  clean: false,
860
859
  env,
@@ -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.63.15",
10
+ version: "0.63.16",
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",
@@ -9,7 +9,7 @@ var __commonJS = (cb, mod) => function __require2() {
9
9
  return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
10
  };
11
11
 
12
- // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__b80880e34496f9494f0340f26604b55f/node_modules/tsup/assets/esm_shims.js
12
+ // ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__2fd73f2f21b62c84096edc8d7f53e16e/node_modules/tsup/assets/esm_shims.js
13
13
  import { fileURLToPath } from "url";
14
14
  import path from "path";
15
15
  var getFilename = () => fileURLToPath(import.meta.url);
@@ -0,0 +1,209 @@
1
+ import {
2
+ createCliOptions,
3
+ getPackageInfo
4
+ } from "./chunk-RH2IXKSC.mjs";
5
+ import {
6
+ getConfig
7
+ } from "./chunk-7H2K6PT4.mjs";
8
+ import {
9
+ getInternalDependencies,
10
+ r2UploadFile
11
+ } from "./chunk-JHXH6ZN3.mjs";
12
+ import {
13
+ findWorkspaceRoot,
14
+ writeDebug,
15
+ writeInfo,
16
+ writeSuccess,
17
+ writeWarning
18
+ } from "./chunk-GOL5LHR6.mjs";
19
+
20
+ // src/executors/r2-upload-publish/executor.ts
21
+ import { S3 } from "@aws-sdk/client-s3";
22
+ import {
23
+ createProjectGraphAsync,
24
+ joinPathFragments,
25
+ readCachedProjectGraph
26
+ } from "@nx/devkit";
27
+ import { glob } from "glob";
28
+ import { execSync } from "node:child_process";
29
+ import { readFile } from "node:fs/promises";
30
+ async function runExecutor(options, context) {
31
+ const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
32
+ if (!context.projectName) {
33
+ throw new Error("The executor requires a projectName.");
34
+ }
35
+ console.info(
36
+ `\u{1F680} Running Storm Cloudflare Publish executor on the ${context.projectName} worker`
37
+ );
38
+ if (!context.projectName || !context.projectsConfigurations?.projects || !context.projectsConfigurations.projects[context.projectName] || !context.projectsConfigurations.projects[context.projectName]?.root) {
39
+ throw new Error("The executor requires projectsConfigurations.");
40
+ }
41
+ try {
42
+ const workspaceRoot = findWorkspaceRoot();
43
+ const config = await getConfig(workspaceRoot);
44
+ const sourceRoot = context.projectsConfigurations.projects[context.projectName]?.sourceRoot ?? workspaceRoot;
45
+ const projectName = context.projectsConfigurations.projects[context.projectName]?.name ?? context.projectName;
46
+ const projectDetails = getPackageInfo(
47
+ context.projectsConfigurations.projects[context.projectName]
48
+ );
49
+ if (!projectDetails?.content) {
50
+ throw new Error(
51
+ `Could not find the project details for ${context.projectName}`
52
+ );
53
+ }
54
+ const args = createCliOptions({ ...options });
55
+ if (isDryRun) {
56
+ args.push("--dry-run");
57
+ }
58
+ const cloudflareAccountId = process.env.STORM_BOT_CLOUDFLARE_ACCOUNT;
59
+ if (!options?.registry && !cloudflareAccountId) {
60
+ throw new Error(
61
+ "The Storm Registry URL is not set in the Storm config. Please set either the `extensions.cyclone.registry` or `config.extensions.cyclone.accountId` property in the Storm config."
62
+ );
63
+ }
64
+ if (!process.env.AWS_ACCESS_KEY_ID || !process.env.AWS_SECRET_ACCESS_KEY) {
65
+ throw new Error(
66
+ "The AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables are not set. Please set these environment variables to upload to the Cyclone Registry."
67
+ );
68
+ }
69
+ const endpoint = options?.registry ? options.registry : `https://${cloudflareAccountId}.r2.cloudflarestorage.com`;
70
+ let projectGraph;
71
+ try {
72
+ projectGraph = readCachedProjectGraph();
73
+ } catch {
74
+ await createProjectGraphAsync();
75
+ projectGraph = readCachedProjectGraph();
76
+ }
77
+ if (!projectGraph) {
78
+ throw new Error(
79
+ "The executor failed because the project graph is not available. Please run the build command again."
80
+ );
81
+ }
82
+ writeInfo(
83
+ `Publishing ${context.projectName} to the Storm Registry at ${endpoint}`
84
+ );
85
+ const s3Client = new S3({
86
+ region: "auto",
87
+ endpoint,
88
+ credentials: {
89
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID,
90
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
91
+ }
92
+ });
93
+ const version = projectDetails.content?.version;
94
+ writeInfo(`Generated component version: ${version}`);
95
+ const files = await glob(joinPathFragments(sourceRoot, "**/*"), {
96
+ ignore: "**/{*.stories.tsx,*.stories.ts,*.spec.tsx,*.spec.ts}"
97
+ });
98
+ const projectPath = `registry/${context.projectName}`;
99
+ const internalDependencies = await getInternalDependencies(
100
+ context.projectName,
101
+ projectGraph
102
+ );
103
+ const dependencies = internalDependencies.filter(
104
+ (projectNode) => !projectNode.data.tags || projectNode.data.tags.every((tag) => tag.toLowerCase() !== "component")
105
+ ).reduce((ret, dep) => {
106
+ if (!ret[dep.name]) {
107
+ ret[dep.name] = "latest";
108
+ }
109
+ return ret;
110
+ }, projectDetails.content.dependencies ?? {});
111
+ const release = options.tag ?? execSync("npm config get tag").toString().trim();
112
+ writeInfo(`Clearing out existing items in ${projectPath}`);
113
+ if (!isDryRun) {
114
+ const response = await s3Client.listObjects({
115
+ Bucket: options.bucketId,
116
+ Prefix: projectPath
117
+ });
118
+ if (response?.Contents && response.Contents.length > 0) {
119
+ writeDebug(
120
+ `Deleting the following existing items from the component registry: ${response.Contents.map((item) => item.Key).join(", ")}`
121
+ );
122
+ await Promise.all(
123
+ response.Contents.map(
124
+ (item) => s3Client.deleteObjects({
125
+ Bucket: options.bucketId,
126
+ Delete: {
127
+ Objects: [
128
+ {
129
+ Key: item.Key
130
+ }
131
+ ],
132
+ Quiet: false
133
+ }
134
+ })
135
+ )
136
+ );
137
+ } else {
138
+ writeDebug(
139
+ `No existing items to delete in the component registry path ${projectPath}`
140
+ );
141
+ }
142
+ } else {
143
+ writeWarning("[Dry run]: skipping upload to the Cyclone Registry.");
144
+ }
145
+ const meta = {
146
+ name: context.projectName,
147
+ version,
148
+ release,
149
+ description: projectDetails.content.description,
150
+ tags: projectDetails.content.keywords,
151
+ dependencies,
152
+ devDependencies: null,
153
+ internalDependencies: internalDependencies.filter(
154
+ (projectNode) => projectNode.data.tags && projectNode.data.tags.some((tag) => tag.toLowerCase() === "component")
155
+ ).map((dep) => dep.name)
156
+ };
157
+ if (projectDetails.type === "package.json") {
158
+ meta.devDependencies = projectDetails.content.devDependencies;
159
+ }
160
+ const metaJson = JSON.stringify(meta);
161
+ writeInfo(`Generating meta.json file:
162
+ ${metaJson}`);
163
+ await r2UploadFile(
164
+ s3Client,
165
+ options.bucketId,
166
+ projectPath,
167
+ "meta.json",
168
+ version,
169
+ metaJson,
170
+ "application/json",
171
+ isDryRun
172
+ );
173
+ await Promise.all(
174
+ files.map((file) => {
175
+ const fileName = file.replaceAll("\\", "/").replace(sourceRoot.replaceAll("\\", "/"), "");
176
+ return readFile(file, { encoding: "utf8" }).then(
177
+ (fileContent) => r2UploadFile(
178
+ s3Client,
179
+ options.bucketId,
180
+ projectPath,
181
+ fileName,
182
+ version,
183
+ fileContent,
184
+ "text/plain",
185
+ isDryRun
186
+ )
187
+ );
188
+ })
189
+ );
190
+ writeSuccess(
191
+ `Successfully uploaded the ${projectName} component to the Cyclone Registry`,
192
+ config
193
+ );
194
+ return {
195
+ success: true
196
+ };
197
+ } catch (error) {
198
+ console.error("Failed to publish to Cloudflare Workers Registry");
199
+ console.error(error);
200
+ console.log("");
201
+ return {
202
+ success: false
203
+ };
204
+ }
205
+ }
206
+
207
+ export {
208
+ runExecutor
209
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  generator_default
3
- } from "./chunk-LDBLH2SH.mjs";
3
+ } from "./chunk-5GHZLCED.mjs";
4
4
  import {
5
5
  getConfig
6
6
  } from "./chunk-7H2K6PT4.mjs";
@@ -15,7 +15,7 @@ import {
15
15
  } from "./chunk-GOL5LHR6.mjs";
16
16
  import {
17
17
  __dirname
18
- } from "./chunk-2ET7ZYTU.mjs";
18
+ } from "./chunk-CLLH7VQR.mjs";
19
19
 
20
20
  // src/generators/worker/generator.ts
21
21
  import {
@@ -0,0 +1,209 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+
4
+ var _chunkKTFMIXUNjs = require('./chunk-KTFMIXUN.js');
5
+
6
+
7
+ var _chunkOL65RB72js = require('./chunk-OL65RB72.js');
8
+
9
+
10
+
11
+ var _chunk2HJQOPBDjs = require('./chunk-2HJQOPBD.js');
12
+
13
+
14
+
15
+
16
+
17
+
18
+ var _chunkSQUJ3SXLjs = require('./chunk-SQUJ3SXL.js');
19
+
20
+ // src/executors/r2-upload-publish/executor.ts
21
+ var _clients3 = require('@aws-sdk/client-s3');
22
+
23
+
24
+
25
+
26
+ var _devkit = require('@nx/devkit');
27
+ var _glob = require('glob');
28
+ var _child_process = require('child_process');
29
+ var _promises = require('fs/promises');
30
+ async function runExecutor(options, context) {
31
+ const isDryRun = process.env.NX_DRY_RUN === "true" || options.dryRun || false;
32
+ if (!context.projectName) {
33
+ throw new Error("The executor requires a projectName.");
34
+ }
35
+ console.info(
36
+ `\u{1F680} Running Storm Cloudflare Publish executor on the ${context.projectName} worker`
37
+ );
38
+ 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])) {
39
+ throw new Error("The executor requires projectsConfigurations.");
40
+ }
41
+ try {
42
+ const workspaceRoot = _chunkSQUJ3SXLjs.findWorkspaceRoot.call(void 0, );
43
+ const config = await _chunkOL65RB72js.getConfig.call(void 0, workspaceRoot);
44
+ const sourceRoot = _nullishCoalesce(_optionalChain([context, 'access', _7 => _7.projectsConfigurations, 'access', _8 => _8.projects, 'access', _9 => _9[context.projectName], 'optionalAccess', _10 => _10.sourceRoot]), () => ( workspaceRoot));
45
+ const projectName = _nullishCoalesce(_optionalChain([context, 'access', _11 => _11.projectsConfigurations, 'access', _12 => _12.projects, 'access', _13 => _13[context.projectName], 'optionalAccess', _14 => _14.name]), () => ( context.projectName));
46
+ const projectDetails = _chunkKTFMIXUNjs.getPackageInfo.call(void 0,
47
+ context.projectsConfigurations.projects[context.projectName]
48
+ );
49
+ if (!_optionalChain([projectDetails, 'optionalAccess', _15 => _15.content])) {
50
+ throw new Error(
51
+ `Could not find the project details for ${context.projectName}`
52
+ );
53
+ }
54
+ const args = _chunkKTFMIXUNjs.createCliOptions.call(void 0, { ...options });
55
+ if (isDryRun) {
56
+ args.push("--dry-run");
57
+ }
58
+ const cloudflareAccountId = process.env.STORM_BOT_CLOUDFLARE_ACCOUNT;
59
+ if (!_optionalChain([options, 'optionalAccess', _16 => _16.registry]) && !cloudflareAccountId) {
60
+ throw new Error(
61
+ "The Storm Registry URL is not set in the Storm config. Please set either the `extensions.cyclone.registry` or `config.extensions.cyclone.accountId` property in the Storm config."
62
+ );
63
+ }
64
+ if (!process.env.AWS_ACCESS_KEY_ID || !process.env.AWS_SECRET_ACCESS_KEY) {
65
+ throw new Error(
66
+ "The AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables are not set. Please set these environment variables to upload to the Cyclone Registry."
67
+ );
68
+ }
69
+ const endpoint = _optionalChain([options, 'optionalAccess', _17 => _17.registry]) ? options.registry : `https://${cloudflareAccountId}.r2.cloudflarestorage.com`;
70
+ let projectGraph;
71
+ try {
72
+ projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
73
+ } catch (e) {
74
+ await _devkit.createProjectGraphAsync.call(void 0, );
75
+ projectGraph = _devkit.readCachedProjectGraph.call(void 0, );
76
+ }
77
+ if (!projectGraph) {
78
+ throw new Error(
79
+ "The executor failed because the project graph is not available. Please run the build command again."
80
+ );
81
+ }
82
+ _chunkSQUJ3SXLjs.writeInfo.call(void 0,
83
+ `Publishing ${context.projectName} to the Storm Registry at ${endpoint}`
84
+ );
85
+ const s3Client = new (0, _clients3.S3)({
86
+ region: "auto",
87
+ endpoint,
88
+ credentials: {
89
+ accessKeyId: process.env.AWS_ACCESS_KEY_ID,
90
+ secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY
91
+ }
92
+ });
93
+ const version = _optionalChain([projectDetails, 'access', _18 => _18.content, 'optionalAccess', _19 => _19.version]);
94
+ _chunkSQUJ3SXLjs.writeInfo.call(void 0, `Generated component version: ${version}`);
95
+ const files = await _glob.glob.call(void 0, _devkit.joinPathFragments.call(void 0, sourceRoot, "**/*"), {
96
+ ignore: "**/{*.stories.tsx,*.stories.ts,*.spec.tsx,*.spec.ts}"
97
+ });
98
+ const projectPath = `registry/${context.projectName}`;
99
+ const internalDependencies = await _chunk2HJQOPBDjs.getInternalDependencies.call(void 0,
100
+ context.projectName,
101
+ projectGraph
102
+ );
103
+ const dependencies = internalDependencies.filter(
104
+ (projectNode) => !projectNode.data.tags || projectNode.data.tags.every((tag) => tag.toLowerCase() !== "component")
105
+ ).reduce((ret, dep) => {
106
+ if (!ret[dep.name]) {
107
+ ret[dep.name] = "latest";
108
+ }
109
+ return ret;
110
+ }, _nullishCoalesce(projectDetails.content.dependencies, () => ( {})));
111
+ const release = _nullishCoalesce(options.tag, () => ( _child_process.execSync.call(void 0, "npm config get tag").toString().trim()));
112
+ _chunkSQUJ3SXLjs.writeInfo.call(void 0, `Clearing out existing items in ${projectPath}`);
113
+ if (!isDryRun) {
114
+ const response = await s3Client.listObjects({
115
+ Bucket: options.bucketId,
116
+ Prefix: projectPath
117
+ });
118
+ if (_optionalChain([response, 'optionalAccess', _20 => _20.Contents]) && response.Contents.length > 0) {
119
+ _chunkSQUJ3SXLjs.writeDebug.call(void 0,
120
+ `Deleting the following existing items from the component registry: ${response.Contents.map((item) => item.Key).join(", ")}`
121
+ );
122
+ await Promise.all(
123
+ response.Contents.map(
124
+ (item) => s3Client.deleteObjects({
125
+ Bucket: options.bucketId,
126
+ Delete: {
127
+ Objects: [
128
+ {
129
+ Key: item.Key
130
+ }
131
+ ],
132
+ Quiet: false
133
+ }
134
+ })
135
+ )
136
+ );
137
+ } else {
138
+ _chunkSQUJ3SXLjs.writeDebug.call(void 0,
139
+ `No existing items to delete in the component registry path ${projectPath}`
140
+ );
141
+ }
142
+ } else {
143
+ _chunkSQUJ3SXLjs.writeWarning.call(void 0, "[Dry run]: skipping upload to the Cyclone Registry.");
144
+ }
145
+ const meta = {
146
+ name: context.projectName,
147
+ version,
148
+ release,
149
+ description: projectDetails.content.description,
150
+ tags: projectDetails.content.keywords,
151
+ dependencies,
152
+ devDependencies: null,
153
+ internalDependencies: internalDependencies.filter(
154
+ (projectNode) => projectNode.data.tags && projectNode.data.tags.some((tag) => tag.toLowerCase() === "component")
155
+ ).map((dep) => dep.name)
156
+ };
157
+ if (projectDetails.type === "package.json") {
158
+ meta.devDependencies = projectDetails.content.devDependencies;
159
+ }
160
+ const metaJson = JSON.stringify(meta);
161
+ _chunkSQUJ3SXLjs.writeInfo.call(void 0, `Generating meta.json file:
162
+ ${metaJson}`);
163
+ await _chunk2HJQOPBDjs.r2UploadFile.call(void 0,
164
+ s3Client,
165
+ options.bucketId,
166
+ projectPath,
167
+ "meta.json",
168
+ version,
169
+ metaJson,
170
+ "application/json",
171
+ isDryRun
172
+ );
173
+ await Promise.all(
174
+ files.map((file) => {
175
+ const fileName = file.replaceAll("\\", "/").replace(sourceRoot.replaceAll("\\", "/"), "");
176
+ return _promises.readFile.call(void 0, file, { encoding: "utf8" }).then(
177
+ (fileContent) => _chunk2HJQOPBDjs.r2UploadFile.call(void 0,
178
+ s3Client,
179
+ options.bucketId,
180
+ projectPath,
181
+ fileName,
182
+ version,
183
+ fileContent,
184
+ "text/plain",
185
+ isDryRun
186
+ )
187
+ );
188
+ })
189
+ );
190
+ _chunkSQUJ3SXLjs.writeSuccess.call(void 0,
191
+ `Successfully uploaded the ${projectName} component to the Cyclone Registry`,
192
+ config
193
+ );
194
+ return {
195
+ success: true
196
+ };
197
+ } catch (error) {
198
+ console.error("Failed to publish to Cloudflare Workers Registry");
199
+ console.error(error);
200
+ console.log("");
201
+ return {
202
+ success: false
203
+ };
204
+ }
205
+ }
206
+
207
+
208
+
209
+ exports.runExecutor = runExecutor;
@@ -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 _chunkKFW57WFFjs = require('./chunk-KFW57WFF.js');
3
+ var _chunk7YRSU6LTjs = require('./chunk-7YRSU6LT.js');
4
4
 
5
5
 
6
6
  var _chunkOL65RB72js = require('./chunk-OL65RB72.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 _chunkKFW57WFFjs.generator_default.call(void 0, tree, {
69
+ await _chunk7YRSU6LTjs.generator_default.call(void 0, tree, {
70
70
  ...options,
71
71
  skipFormat: true
72
72
  })
package/dist/executors.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";require('./chunk-XO66D74Z.js');
2
2
  require('./chunk-T2OGA6MB.js');
3
- require('./chunk-HYKWJFHA.js');
3
+ require('./chunk-6XLZW53F.js');
4
4
  require('./chunk-Q6WFFOSW.js');
5
5
  require('./chunk-2HJQOPBD.js');
6
6
  require('./chunk-KTFMIXUN.js');
@@ -1,9 +1,9 @@
1
1
  import "./chunk-YSCEY447.mjs";
2
- import "./chunk-DY4VZ7GU.mjs";
3
- import "./chunk-UDO5RHFZ.mjs";
2
+ import "./chunk-4HGNUVBV.mjs";
3
+ import "./chunk-2D6E5WHF.mjs";
4
4
  import "./chunk-5M3ADTI2.mjs";
5
5
  import "./chunk-JHXH6ZN3.mjs";
6
6
  import "./chunk-RH2IXKSC.mjs";
7
7
  import "./chunk-7H2K6PT4.mjs";
8
8
  import "./chunk-GOL5LHR6.mjs";
9
- import "./chunk-2ET7ZYTU.mjs";
9
+ import "./chunk-CLLH7VQR.mjs";
@@ -2,11 +2,11 @@
2
2
 
3
3
 
4
4
 
5
- var _chunk4VIHS54Jjs = require('./chunk-4VIHS54J.js');
5
+ var _chunkY2SETYLLjs = require('./chunk-Y2SETYLL.js');
6
6
 
7
7
 
8
8
 
9
- var _chunkKFW57WFFjs = require('./chunk-KFW57WFF.js');
9
+ var _chunk7YRSU6LTjs = require('./chunk-7YRSU6LT.js');
10
10
  require('./chunk-OL65RB72.js');
11
11
  require('./chunk-SQUJ3SXL.js');
12
12
  require('./chunk-MCKGQKYU.js');
@@ -15,4 +15,4 @@ require('./chunk-MCKGQKYU.js');
15
15
 
16
16
 
17
17
 
18
- exports.applicationGenerator = _chunk4VIHS54Jjs.applicationGenerator; exports.applicationSchematic = _chunk4VIHS54Jjs.applicationSchematic; exports.initGenerator = _chunkKFW57WFFjs.initGenerator; exports.initSchematic = _chunkKFW57WFFjs.initSchematic;
18
+ exports.applicationGenerator = _chunkY2SETYLLjs.applicationGenerator; exports.applicationSchematic = _chunkY2SETYLLjs.applicationSchematic; exports.initGenerator = _chunk7YRSU6LTjs.initGenerator; exports.initSchematic = _chunk7YRSU6LTjs.initSchematic;
@@ -2,14 +2,14 @@ import "./chunk-3J7KBHMJ.mjs";
2
2
  import {
3
3
  applicationGenerator,
4
4
  applicationSchematic
5
- } from "./chunk-P4WMZO6U.mjs";
5
+ } from "./chunk-KFTI2KG7.mjs";
6
6
  import {
7
7
  initGenerator,
8
8
  initSchematic
9
- } from "./chunk-LDBLH2SH.mjs";
9
+ } from "./chunk-5GHZLCED.mjs";
10
10
  import "./chunk-7H2K6PT4.mjs";
11
11
  import "./chunk-GOL5LHR6.mjs";
12
- import "./chunk-2ET7ZYTU.mjs";
12
+ import "./chunk-CLLH7VQR.mjs";
13
13
  export {
14
14
  applicationGenerator,
15
15
  applicationSchematic,
package/dist/index.js CHANGED
@@ -3,14 +3,14 @@ require('./chunk-DHBG5ASJ.js');
3
3
 
4
4
 
5
5
 
6
- var _chunk4VIHS54Jjs = require('./chunk-4VIHS54J.js');
6
+ var _chunkY2SETYLLjs = require('./chunk-Y2SETYLL.js');
7
7
 
8
8
 
9
9
 
10
- var _chunkKFW57WFFjs = require('./chunk-KFW57WFF.js');
10
+ var _chunk7YRSU6LTjs = require('./chunk-7YRSU6LT.js');
11
11
  require('./chunk-CVGPWUNP.js');
12
12
  require('./chunk-T2OGA6MB.js');
13
- require('./chunk-HYKWJFHA.js');
13
+ require('./chunk-6XLZW53F.js');
14
14
  require('./chunk-Q6WFFOSW.js');
15
15
 
16
16
 
@@ -162,4 +162,4 @@ function createPackageJson(projectJsonPath, workspaceRoot) {
162
162
 
163
163
 
164
164
 
165
- exports.applicationGenerator = _chunk4VIHS54Jjs.applicationGenerator; exports.applicationSchematic = _chunk4VIHS54Jjs.applicationSchematic; exports.createNodesV2 = createNodesV2; exports.getInternalDependencies = _chunk2HJQOPBDjs.getInternalDependencies; exports.initGenerator = _chunkKFW57WFFjs.initGenerator; exports.initSchematic = _chunkKFW57WFFjs.initSchematic; exports.name = name; exports.r2UploadFile = _chunk2HJQOPBDjs.r2UploadFile;
165
+ exports.applicationGenerator = _chunkY2SETYLLjs.applicationGenerator; exports.applicationSchematic = _chunkY2SETYLLjs.applicationSchematic; exports.createNodesV2 = createNodesV2; exports.getInternalDependencies = _chunk2HJQOPBDjs.getInternalDependencies; exports.initGenerator = _chunk7YRSU6LTjs.initGenerator; exports.initSchematic = _chunk7YRSU6LTjs.initSchematic; exports.name = name; exports.r2UploadFile = _chunk2HJQOPBDjs.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-P4WMZO6U.mjs";
6
+ } from "./chunk-KFTI2KG7.mjs";
7
7
  import {
8
8
  initGenerator,
9
9
  initSchematic
10
- } from "./chunk-LDBLH2SH.mjs";
10
+ } from "./chunk-5GHZLCED.mjs";
11
11
  import "./chunk-7Z5PILRU.mjs";
12
- import "./chunk-DY4VZ7GU.mjs";
13
- import "./chunk-UDO5RHFZ.mjs";
12
+ import "./chunk-4HGNUVBV.mjs";
13
+ import "./chunk-2D6E5WHF.mjs";
14
14
  import "./chunk-5M3ADTI2.mjs";
15
15
  import {
16
16
  getInternalDependencies,
@@ -22,7 +22,7 @@ import {
22
22
  } from "./chunk-RH2IXKSC.mjs";
23
23
  import "./chunk-7H2K6PT4.mjs";
24
24
  import "./chunk-GOL5LHR6.mjs";
25
- import "./chunk-2ET7ZYTU.mjs";
25
+ import "./chunk-CLLH7VQR.mjs";
26
26
 
27
27
  // src/plugins/index.ts
28
28
  import {
@@ -1,7 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
  var _chunkT2OGA6MBjs = require('../../../chunk-T2OGA6MB.js');
4
- require('../../../chunk-HYKWJFHA.js');
4
+ require('../../../chunk-6XLZW53F.js');
5
5
  require('../../../chunk-KTFMIXUN.js');
6
6
  require('../../../chunk-OL65RB72.js');
7
7
  require('../../../chunk-SQUJ3SXL.js');
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  runExecutor
3
- } from "../../../chunk-DY4VZ7GU.mjs";
4
- import "../../../chunk-UDO5RHFZ.mjs";
3
+ } from "../../../chunk-4HGNUVBV.mjs";
4
+ import "../../../chunk-2D6E5WHF.mjs";
5
5
  import "../../../chunk-RH2IXKSC.mjs";
6
6
  import "../../../chunk-7H2K6PT4.mjs";
7
7
  import "../../../chunk-GOL5LHR6.mjs";
8
- import "../../../chunk-2ET7ZYTU.mjs";
8
+ import "../../../chunk-CLLH7VQR.mjs";
9
9
  export {
10
10
  runExecutor as default
11
11
  };
@@ -5,7 +5,7 @@ import "../../../chunk-JHXH6ZN3.mjs";
5
5
  import "../../../chunk-RH2IXKSC.mjs";
6
6
  import "../../../chunk-7H2K6PT4.mjs";
7
7
  import "../../../chunk-GOL5LHR6.mjs";
8
- import "../../../chunk-2ET7ZYTU.mjs";
8
+ import "../../../chunk-CLLH7VQR.mjs";
9
9
  export {
10
10
  runExecutor as default
11
11
  };
@@ -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 _chunkHYKWJFHAjs = require('../../../chunk-HYKWJFHA.js');
3
+ var _chunk6XLZW53Fjs = require('../../../chunk-6XLZW53F.js');
4
4
 
5
5
 
6
6
  var _chunkKTFMIXUNjs = require('../../../chunk-KTFMIXUN.js');
@@ -55,7 +55,7 @@ async function* serveExecutor(options, context, config) {
55
55
  success: true
56
56
  };
57
57
  }
58
- var executor_default = _chunkHYKWJFHAjs.withRunExecutor.call(void 0,
58
+ var executor_default = _chunk6XLZW53Fjs.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-UDO5RHFZ.mjs";
3
+ } from "../../../chunk-2D6E5WHF.mjs";
4
4
  import {
5
5
  createCliOptions
6
6
  } from "../../../chunk-RH2IXKSC.mjs";
@@ -8,7 +8,7 @@ import "../../../chunk-7H2K6PT4.mjs";
8
8
  import "../../../chunk-GOL5LHR6.mjs";
9
9
  import {
10
10
  __require
11
- } from "../../../chunk-2ET7ZYTU.mjs";
11
+ } from "../../../chunk-CLLH7VQR.mjs";
12
12
 
13
13
  // src/executors/serve/executor.ts
14
14
  import { createAsyncIterable } from "@nx/devkit/src/utils/async-iterable";
@@ -2,10 +2,10 @@
2
2
 
3
3
 
4
4
 
5
- var _chunkKFW57WFFjs = require('../../../chunk-KFW57WFF.js');
5
+ var _chunk7YRSU6LTjs = require('../../../chunk-7YRSU6LT.js');
6
6
  require('../../../chunk-MCKGQKYU.js');
7
7
 
8
8
 
9
9
 
10
10
 
11
- exports.default = _chunkKFW57WFFjs.generator_default; exports.initGenerator = _chunkKFW57WFFjs.initGenerator; exports.initSchematic = _chunkKFW57WFFjs.initSchematic;
11
+ exports.default = _chunk7YRSU6LTjs.generator_default; exports.initGenerator = _chunk7YRSU6LTjs.initGenerator; exports.initSchematic = _chunk7YRSU6LTjs.initSchematic;
@@ -2,8 +2,8 @@ import {
2
2
  generator_default,
3
3
  initGenerator,
4
4
  initSchematic
5
- } from "../../../chunk-LDBLH2SH.mjs";
6
- import "../../../chunk-2ET7ZYTU.mjs";
5
+ } from "../../../chunk-5GHZLCED.mjs";
6
+ import "../../../chunk-CLLH7VQR.mjs";
7
7
  export {
8
8
  generator_default as default,
9
9
  initGenerator,
@@ -2,8 +2,8 @@
2
2
 
3
3
 
4
4
 
5
- var _chunk4VIHS54Jjs = require('../../../chunk-4VIHS54J.js');
6
- require('../../../chunk-KFW57WFF.js');
5
+ var _chunkY2SETYLLjs = require('../../../chunk-Y2SETYLL.js');
6
+ require('../../../chunk-7YRSU6LT.js');
7
7
  require('../../../chunk-OL65RB72.js');
8
8
  require('../../../chunk-SQUJ3SXL.js');
9
9
  require('../../../chunk-MCKGQKYU.js');
@@ -11,4 +11,4 @@ require('../../../chunk-MCKGQKYU.js');
11
11
 
12
12
 
13
13
 
14
- exports.applicationGenerator = _chunk4VIHS54Jjs.applicationGenerator; exports.applicationSchematic = _chunk4VIHS54Jjs.applicationSchematic; exports.default = _chunk4VIHS54Jjs.generator_default;
14
+ exports.applicationGenerator = _chunkY2SETYLLjs.applicationGenerator; exports.applicationSchematic = _chunkY2SETYLLjs.applicationSchematic; exports.default = _chunkY2SETYLLjs.generator_default;
@@ -2,11 +2,11 @@ import {
2
2
  applicationGenerator,
3
3
  applicationSchematic,
4
4
  generator_default
5
- } from "../../../chunk-P4WMZO6U.mjs";
6
- import "../../../chunk-LDBLH2SH.mjs";
5
+ } from "../../../chunk-KFTI2KG7.mjs";
6
+ import "../../../chunk-5GHZLCED.mjs";
7
7
  import "../../../chunk-7H2K6PT4.mjs";
8
8
  import "../../../chunk-GOL5LHR6.mjs";
9
- import "../../../chunk-2ET7ZYTU.mjs";
9
+ import "../../../chunk-CLLH7VQR.mjs";
10
10
  export {
11
11
  applicationGenerator,
12
12
  applicationSchematic,
@@ -4,7 +4,7 @@ import {
4
4
  r2UploadFile
5
5
  } from "../../chunk-JHXH6ZN3.mjs";
6
6
  import "../../chunk-GOL5LHR6.mjs";
7
- import "../../chunk-2ET7ZYTU.mjs";
7
+ import "../../chunk-CLLH7VQR.mjs";
8
8
  export {
9
9
  getInternalDependencies,
10
10
  r2UploadFile
@@ -3,7 +3,7 @@ import {
3
3
  r2UploadFile
4
4
  } from "../../chunk-JHXH6ZN3.mjs";
5
5
  import "../../chunk-GOL5LHR6.mjs";
6
- import "../../chunk-2ET7ZYTU.mjs";
6
+ import "../../chunk-CLLH7VQR.mjs";
7
7
  export {
8
8
  getInternalDependencies,
9
9
  r2UploadFile
@@ -1,4 +1,4 @@
1
- import "./chunk-2ET7ZYTU.mjs";
1
+ import "./chunk-CLLH7VQR.mjs";
2
2
 
3
3
  // tsup.config.ts
4
4
  import { defineConfig } from "tsup";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/cloudflare-tools",
3
- "version": "0.63.16",
3
+ "version": "0.63.17",
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",