@storm-software/cloudflare-tools 0.71.2 → 0.71.3
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.
- package/CHANGELOG.md +13 -0
- package/dist/{chunk-7ESZB4KW.mjs → chunk-4EEXR4IG.mjs} +10 -11
- package/dist/chunk-5CMG7SUH.mjs +43 -0
- package/dist/{chunk-TUJUSMGX.mjs → chunk-AOKOPGTD.mjs} +4 -4
- package/dist/{chunk-VHMJXOF4.js → chunk-BAINZIOH.js} +24 -25
- package/dist/{chunk-W5IPHIXB.js → chunk-EKIV24FH.js} +165 -165
- package/dist/{chunk-NEODNLL5.js → chunk-GPR55JRG.js} +4 -4
- package/dist/{chunk-HQWL5NAU.js → chunk-I7SRDPE3.js} +12 -12
- package/dist/{chunk-C6B32MBV.mjs → chunk-NYGOCQMG.mjs} +6 -6
- package/dist/{chunk-PTTJW7MW.mjs → chunk-SGTAZO2Q.mjs} +3 -171
- package/dist/{chunk-6MATO2MJ.mjs → chunk-TPNHSNNZ.mjs} +171 -1
- package/dist/{chunk-FFOLWRMA.js → chunk-UAKLE2QO.js} +11 -12
- package/dist/{chunk-5YJKWRBZ.mjs → chunk-UXRPB254.mjs} +3 -3
- package/dist/{chunk-EQXEFXCV.js → chunk-VKMAYBQX.js} +48 -216
- package/dist/{chunk-4BWM53AA.js → chunk-Z2WQB55R.js} +171 -1
- package/dist/executors.d.mts +1 -1
- package/dist/executors.d.ts +1 -1
- package/dist/executors.js +5 -5
- package/dist/executors.mjs +5 -5
- package/dist/generators.js +5 -5
- package/dist/generators.mjs +4 -4
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +8 -8
- package/dist/index.mjs +7 -7
- package/dist/{schema.d-elsO8UQp.d.mts → schema.d-Dcq3Apw7.d.mts} +2 -2
- package/dist/{schema.d-elsO8UQp.d.ts → schema.d-Dcq3Apw7.d.ts} +2 -2
- package/dist/src/executors/cloudflare-publish/executor.js +3 -3
- package/dist/src/executors/cloudflare-publish/executor.mjs +3 -3
- package/dist/src/executors/r2-upload-publish/executor.d.mts +1 -1
- package/dist/src/executors/r2-upload-publish/executor.d.ts +1 -1
- package/dist/src/executors/r2-upload-publish/executor.js +5 -5
- package/dist/src/executors/r2-upload-publish/executor.mjs +4 -4
- package/dist/src/executors/r2-upload-publish/schema.d.ts +2 -2
- package/dist/src/executors/r2-upload-publish/schema.json +2 -2
- package/dist/src/executors/serve/executor.js +4 -4
- package/dist/src/executors/serve/executor.mjs +3 -3
- package/dist/src/generators/init/generator.js +2 -2
- package/dist/src/generators/init/generator.mjs +1 -1
- package/dist/src/generators/worker/generator.js +5 -5
- package/dist/src/generators/worker/generator.mjs +4 -4
- package/dist/src/utils/index.js +3 -3
- package/dist/src/utils/index.mjs +2 -2
- package/dist/src/utils/r2-bucket-helpers.d.mts +21 -2
- package/dist/src/utils/r2-bucket-helpers.d.ts +21 -2
- package/dist/src/utils/r2-bucket-helpers.js +3 -3
- package/dist/src/utils/r2-bucket-helpers.mjs +2 -2
- package/docs/api/executors/r2-upload-publish/schema.md +2 -2
- package/package.json +5 -5
- package/dist/chunk-5N2NVDKX.mjs +0 -44
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,19 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Storm Ops - Cloudflare Tools
|
|
4
4
|
|
|
5
|
+
## [0.71.2](https://github.com/storm-software/storm-ops/releases/tag/cloudflare-tools%400.71.2) (12/05/2025)
|
|
6
|
+
|
|
7
|
+
### Miscellaneous
|
|
8
|
+
|
|
9
|
+
- **monorepo:** Update Nx packages to v22.1.3
|
|
10
|
+
([3d5e53580](https://github.com/storm-software/storm-ops/commit/3d5e53580))
|
|
11
|
+
|
|
12
|
+
### Updated Dependencies
|
|
13
|
+
|
|
14
|
+
- Updated **workspace-tools** to **v1.293.23**
|
|
15
|
+
- Updated **config-tools** to **v1.188.53**
|
|
16
|
+
- Updated **config** to **v1.134.53**
|
|
17
|
+
|
|
5
18
|
## [0.71.1](https://github.com/storm-software/storm-ops/releases/tag/cloudflare-tools%400.71.1) (12/04/2025)
|
|
6
19
|
|
|
7
20
|
### Miscellaneous
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getInternalDependencies,
|
|
3
3
|
r2UploadFile
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-5CMG7SUH.mjs";
|
|
5
5
|
import {
|
|
6
6
|
createCliOptions,
|
|
7
7
|
getPackageInfo
|
|
@@ -9,19 +9,20 @@ import {
|
|
|
9
9
|
import {
|
|
10
10
|
findWorkspaceRoot,
|
|
11
11
|
getConfig
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-SGTAZO2Q.mjs";
|
|
13
13
|
import {
|
|
14
|
+
correctPaths,
|
|
15
|
+
joinPaths,
|
|
14
16
|
writeDebug,
|
|
15
17
|
writeSuccess,
|
|
16
18
|
writeTrace,
|
|
17
19
|
writeWarning
|
|
18
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-TPNHSNNZ.mjs";
|
|
19
21
|
|
|
20
22
|
// src/executors/r2-upload-publish/executor.ts
|
|
21
23
|
import { S3 } from "@aws-sdk/client-s3";
|
|
22
24
|
import {
|
|
23
25
|
createProjectGraphAsync,
|
|
24
|
-
joinPathFragments,
|
|
25
26
|
readCachedProjectGraph
|
|
26
27
|
} from "@nx/devkit";
|
|
27
28
|
import { glob } from "glob";
|
|
@@ -95,12 +96,10 @@ async function runExecutor(options, context) {
|
|
|
95
96
|
if (version) {
|
|
96
97
|
writeDebug(`Starting upload version ${version}`);
|
|
97
98
|
}
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
{
|
|
101
|
-
|
|
102
|
-
}
|
|
103
|
-
);
|
|
99
|
+
const basePath = options.path || sourceRoot;
|
|
100
|
+
const files = await glob(joinPaths(basePath, "**/*"), {
|
|
101
|
+
ignore: "**/{*.stories.tsx,*.stories.ts,*.spec.tsx,*.spec.ts}"
|
|
102
|
+
});
|
|
104
103
|
const internalDependencies = await getInternalDependencies(
|
|
105
104
|
context.projectName,
|
|
106
105
|
projectGraph
|
|
@@ -183,7 +182,7 @@ ${metaJson}`);
|
|
|
183
182
|
}
|
|
184
183
|
await Promise.all(
|
|
185
184
|
files.map(async (file) => {
|
|
186
|
-
const name = file
|
|
185
|
+
const name = correctPaths(file).replace(correctPaths(basePath), "");
|
|
187
186
|
const type = mime.lookup(name) || "application/octet-stream";
|
|
188
187
|
writeTrace(`Uploading file: ${name} (content-type: ${type})`);
|
|
189
188
|
await r2UploadFile(
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import {
|
|
2
|
+
joinPaths,
|
|
3
|
+
writeDebug,
|
|
4
|
+
writeWarning
|
|
5
|
+
} from "./chunk-TPNHSNNZ.mjs";
|
|
6
|
+
|
|
7
|
+
// src/utils/r2-bucket-helpers.ts
|
|
8
|
+
import { createHash } from "node:crypto";
|
|
9
|
+
async function r2UploadFile(client, bucketName, bucketPath, fileName, version, fileContent, contentType = "application/octet-stream", isDryRun = false) {
|
|
10
|
+
writeDebug(`Uploading file: ${joinPaths(bucketPath, fileName)}`);
|
|
11
|
+
if (!isDryRun) {
|
|
12
|
+
await client.putObject({
|
|
13
|
+
Bucket: bucketName,
|
|
14
|
+
Key: joinPaths(bucketPath, fileName),
|
|
15
|
+
Body: fileContent,
|
|
16
|
+
ContentType: contentType,
|
|
17
|
+
Metadata: {
|
|
18
|
+
version,
|
|
19
|
+
checksum: createHash("sha256").update(fileContent).digest("base64")
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
} else {
|
|
23
|
+
writeWarning("[Dry run]: Skipping upload to the R2 bucket.");
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function getInternalDependencies(projectName, graph) {
|
|
27
|
+
const allDeps = graph.dependencies[projectName] ?? [];
|
|
28
|
+
return Array.from(
|
|
29
|
+
allDeps.reduce(
|
|
30
|
+
(acc, node) => {
|
|
31
|
+
const found = graph.nodes[node.target];
|
|
32
|
+
if (found) acc.push(found);
|
|
33
|
+
return acc;
|
|
34
|
+
},
|
|
35
|
+
[]
|
|
36
|
+
)
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export {
|
|
41
|
+
r2UploadFile,
|
|
42
|
+
getInternalDependencies
|
|
43
|
+
};
|
|
@@ -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.71.
|
|
10
|
+
version: "0.71.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",
|
|
@@ -136,9 +136,9 @@ var require_package = __commonJS({
|
|
|
136
136
|
"@nx/js": "catalog:",
|
|
137
137
|
"@nx/node": "catalog:",
|
|
138
138
|
"@nx/web": "catalog:",
|
|
139
|
-
"@storm-software/config": "1.134.
|
|
140
|
-
"@storm-software/config-tools": "1.188.
|
|
141
|
-
"@storm-software/workspace-tools": "1.293.
|
|
139
|
+
"@storm-software/config": "1.134.53",
|
|
140
|
+
"@storm-software/config-tools": "1.188.53",
|
|
141
|
+
"@storm-software/workspace-tools": "1.293.23",
|
|
142
142
|
nx: "catalog:",
|
|
143
143
|
tsup: "catalog:",
|
|
144
144
|
wrangler: ">=3.58.0"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkUAKLE2QOjs = require('./chunk-UAKLE2QO.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
@@ -9,20 +9,21 @@ var _chunkNU34IEWNjs = require('./chunk-NU34IEWN.js');
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkVKMAYBQXjs = require('./chunk-VKMAYBQX.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
var _chunkZ2WQB55Rjs = require('./chunk-Z2WQB55R.js');
|
|
19
21
|
|
|
20
22
|
// src/executors/r2-upload-publish/executor.ts
|
|
21
23
|
var _clients3 = require('@aws-sdk/client-s3');
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
|
|
25
|
-
|
|
26
27
|
var _devkit = require('@nx/devkit');
|
|
27
28
|
var _glob = require('glob');
|
|
28
29
|
var _mimetypes = require('mime-types'); var _mimetypes2 = _interopRequireDefault(_mimetypes);
|
|
@@ -40,8 +41,8 @@ async function runExecutor(options, context) {
|
|
|
40
41
|
throw new Error("The executor requires projectsConfigurations.");
|
|
41
42
|
}
|
|
42
43
|
try {
|
|
43
|
-
const workspaceRoot =
|
|
44
|
-
const config = await
|
|
44
|
+
const workspaceRoot = _chunkVKMAYBQXjs.findWorkspaceRoot.call(void 0, );
|
|
45
|
+
const config = await _chunkVKMAYBQXjs.getConfig.call(void 0, workspaceRoot);
|
|
45
46
|
const sourceRoot = _nullishCoalesce(_optionalChain([context, 'access', _7 => _7.projectsConfigurations, 'access', _8 => _8.projects, 'access', _9 => _9[context.projectName], 'optionalAccess', _10 => _10.sourceRoot]), () => ( workspaceRoot));
|
|
46
47
|
const projectName = _nullishCoalesce(_optionalChain([context, 'access', _11 => _11.projectsConfigurations, 'access', _12 => _12.projects, 'access', _13 => _13[context.projectName], 'optionalAccess', _14 => _14.name]), () => ( context.projectName));
|
|
47
48
|
const projectDetails = _chunkNU34IEWNjs.getPackageInfo.call(void 0,
|
|
@@ -80,7 +81,7 @@ async function runExecutor(options, context) {
|
|
|
80
81
|
"The executor failed because the project graph is not available. Please run the build command again."
|
|
81
82
|
);
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
+
_chunkZ2WQB55Rjs.writeDebug.call(void 0,
|
|
84
85
|
`Publishing ${context.projectName} to the ${bucketId} R2 Bucket (at ${registry})`
|
|
85
86
|
);
|
|
86
87
|
const client = new (0, _clients3.S3)({
|
|
@@ -93,15 +94,13 @@ async function runExecutor(options, context) {
|
|
|
93
94
|
});
|
|
94
95
|
const version = _optionalChain([projectDetails, 'optionalAccess', _17 => _17.content, 'optionalAccess', _18 => _18.version]);
|
|
95
96
|
if (version) {
|
|
96
|
-
|
|
97
|
+
_chunkZ2WQB55Rjs.writeDebug.call(void 0, `Starting upload version ${version}`);
|
|
97
98
|
}
|
|
98
|
-
const
|
|
99
|
-
|
|
100
|
-
{
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
);
|
|
104
|
-
const internalDependencies = await _chunkFFOLWRMAjs.getInternalDependencies.call(void 0,
|
|
99
|
+
const basePath = options.path || sourceRoot;
|
|
100
|
+
const files = await _glob.glob.call(void 0, _chunkZ2WQB55Rjs.joinPaths.call(void 0, basePath, "**/*"), {
|
|
101
|
+
ignore: "**/{*.stories.tsx,*.stories.ts,*.spec.tsx,*.spec.ts}"
|
|
102
|
+
});
|
|
103
|
+
const internalDependencies = await _chunkUAKLE2QOjs.getInternalDependencies.call(void 0,
|
|
105
104
|
context.projectName,
|
|
106
105
|
projectGraph
|
|
107
106
|
);
|
|
@@ -115,14 +114,14 @@ async function runExecutor(options, context) {
|
|
|
115
114
|
}, _nullishCoalesce(_optionalChain([projectDetails, 'optionalAccess', _19 => _19.content, 'access', _20 => _20.dependencies]), () => ( {})));
|
|
116
115
|
const release = _nullishCoalesce(options.tag, () => ( _child_process.execSync.call(void 0, "npm config get tag").toString().trim()));
|
|
117
116
|
if (options.clean === true) {
|
|
118
|
-
|
|
117
|
+
_chunkZ2WQB55Rjs.writeDebug.call(void 0, `Clearing out existing items in ${bucketPath}`);
|
|
119
118
|
if (!isDryRun) {
|
|
120
119
|
const response = await client.listObjects({
|
|
121
120
|
Bucket: bucketId,
|
|
122
121
|
Prefix: bucketPath
|
|
123
122
|
});
|
|
124
123
|
if (_optionalChain([response, 'optionalAccess', _21 => _21.Contents]) && response.Contents.length > 0) {
|
|
125
|
-
|
|
124
|
+
_chunkZ2WQB55Rjs.writeTrace.call(void 0,
|
|
126
125
|
`Deleting the following existing items from the R2 bucket path ${bucketPath}: ${response.Contents.map((item) => item.Key).join(", ")}`
|
|
127
126
|
);
|
|
128
127
|
await Promise.all(
|
|
@@ -141,12 +140,12 @@ async function runExecutor(options, context) {
|
|
|
141
140
|
)
|
|
142
141
|
);
|
|
143
142
|
} else {
|
|
144
|
-
|
|
143
|
+
_chunkZ2WQB55Rjs.writeDebug.call(void 0,
|
|
145
144
|
`No existing items to delete in the R2 bucket path ${bucketPath}`
|
|
146
145
|
);
|
|
147
146
|
}
|
|
148
147
|
} else {
|
|
149
|
-
|
|
148
|
+
_chunkZ2WQB55Rjs.writeWarning.call(void 0, "[Dry run]: Skipping R2 bucket clean.");
|
|
150
149
|
}
|
|
151
150
|
}
|
|
152
151
|
if (options.writeMetaJson === true) {
|
|
@@ -168,9 +167,9 @@ async function runExecutor(options, context) {
|
|
|
168
167
|
meta.devDependencies = _optionalChain([projectDetails, 'optionalAccess', _27 => _27.content, 'optionalAccess', _28 => _28.devDependencies]);
|
|
169
168
|
}
|
|
170
169
|
const metaJson = JSON.stringify(meta);
|
|
171
|
-
|
|
170
|
+
_chunkZ2WQB55Rjs.writeTrace.call(void 0, `Generating meta.json file:
|
|
172
171
|
${metaJson}`);
|
|
173
|
-
await
|
|
172
|
+
await _chunkUAKLE2QOjs.r2UploadFile.call(void 0,
|
|
174
173
|
client,
|
|
175
174
|
bucketId,
|
|
176
175
|
bucketPath,
|
|
@@ -183,10 +182,10 @@ ${metaJson}`);
|
|
|
183
182
|
}
|
|
184
183
|
await Promise.all(
|
|
185
184
|
files.map(async (file) => {
|
|
186
|
-
const name =
|
|
185
|
+
const name = _chunkZ2WQB55Rjs.correctPaths.call(void 0, file).replace(_chunkZ2WQB55Rjs.correctPaths.call(void 0, basePath), "");
|
|
187
186
|
const type = _mimetypes2.default.lookup(name) || "application/octet-stream";
|
|
188
|
-
|
|
189
|
-
await
|
|
187
|
+
_chunkZ2WQB55Rjs.writeTrace.call(void 0, `Uploading file: ${name} (content-type: ${type})`);
|
|
188
|
+
await _chunkUAKLE2QOjs.r2UploadFile.call(void 0,
|
|
190
189
|
client,
|
|
191
190
|
bucketId,
|
|
192
191
|
bucketPath,
|
|
@@ -198,7 +197,7 @@ ${metaJson}`);
|
|
|
198
197
|
);
|
|
199
198
|
})
|
|
200
199
|
);
|
|
201
|
-
|
|
200
|
+
_chunkZ2WQB55Rjs.writeSuccess.call(void 0,
|
|
202
201
|
`Successfully uploaded the ${projectName} project to the Cloudflare R2 bucket.`,
|
|
203
202
|
config
|
|
204
203
|
);
|