@storm-software/cloudflare-tools 0.71.30 → 0.71.32
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 +21 -0
- package/dist/{chunk-FPJU3YOH.mjs → chunk-3WBFV3XF.mjs} +7 -5
- package/dist/{chunk-YQGPNO3W.mjs → chunk-4WRUZBE7.mjs} +26 -20
- package/dist/{chunk-OZ44M6HX.js → chunk-AOAVYQNP.js} +7 -5
- package/dist/{chunk-YPRUPZL3.js → chunk-QDAQB4EP.js} +2 -2
- package/dist/{chunk-DUHFLDZ4.js → chunk-UQBLSDWU.js} +28 -22
- package/dist/chunk-VZQDXTIP.js +68 -0
- package/dist/chunk-Z2D7AKMD.mjs +68 -0
- package/dist/{chunk-DEX6LTPV.mjs → chunk-ZWYDXLNA.mjs} +1 -1
- package/dist/executors.js +2 -2
- package/dist/executors.mjs +2 -2
- package/dist/generators.js +3 -3
- package/dist/generators.mjs +2 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +9 -5
- package/dist/index.mjs +8 -4
- package/dist/src/executors/r2-upload-publish/executor.js +3 -3
- package/dist/src/executors/r2-upload-publish/executor.mjs +2 -2
- 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 +3 -3
- package/dist/src/generators/worker/generator.mjs +2 -2
- package/dist/src/utils/index.d.mts +1 -1
- package/dist/src/utils/index.d.ts +1 -1
- package/dist/src/utils/index.js +6 -2
- package/dist/src/utils/index.mjs +5 -1
- package/dist/src/utils/r2-bucket-helpers.d.mts +17 -3
- package/dist/src/utils/r2-bucket-helpers.d.ts +17 -3
- package/dist/src/utils/r2-bucket-helpers.js +6 -2
- package/dist/src/utils/r2-bucket-helpers.mjs +5 -1
- package/package.json +8 -6
- package/dist/chunk-RGRCKWGN.mjs +0 -225
- package/dist/chunk-UI2F3MMU.mjs +0 -52
- package/dist/chunk-ZBNASCRJ.js +0 -225
- package/dist/chunk-ZWHJ35F5.js +0 -52
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog for Storm Ops - Cloudflare Tools
|
|
4
4
|
|
|
5
|
+
## [0.71.31](https://github.com/storm-software/storm-ops/releases/tag/cloudflare-tools%400.71.31) (12/18/2025)
|
|
6
|
+
|
|
7
|
+
### Bug Fixes
|
|
8
|
+
|
|
9
|
+
- **cloudflare-tools:** Use `Upload` object to ensure data is successfully sent
|
|
10
|
+
to R2 bucket
|
|
11
|
+
([6ba6f17bb](https://github.com/storm-software/storm-ops/commit/6ba6f17bb))
|
|
12
|
+
|
|
13
|
+
### Updated Dependencies
|
|
14
|
+
|
|
15
|
+
- Updated **workspace-tools** to **v1.294.17**
|
|
16
|
+
- Updated **config-tools** to **v1.188.71**
|
|
17
|
+
- Updated **config** to **v1.134.71**
|
|
18
|
+
|
|
19
|
+
## [0.71.30](https://github.com/storm-software/storm-ops/releases/tag/cloudflare-tools%400.71.30) (12/18/2025)
|
|
20
|
+
|
|
21
|
+
### Bug Fixes
|
|
22
|
+
|
|
23
|
+
- **cloudflare-tools:** Ensure data is uploaded as a data URL
|
|
24
|
+
([b992fc806](https://github.com/storm-software/storm-ops/commit/b992fc806))
|
|
25
|
+
|
|
5
26
|
## [0.71.29](https://github.com/storm-software/storm-ops/releases/tag/cloudflare-tools%400.71.29) (12/18/2025)
|
|
6
27
|
|
|
7
28
|
### Bug Fixes
|
|
@@ -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.31",
|
|
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.294.
|
|
139
|
+
"@storm-software/config": "1.134.71",
|
|
140
|
+
"@storm-software/config-tools": "1.188.71",
|
|
141
|
+
"@storm-software/workspace-tools": "1.294.17",
|
|
142
142
|
nx: "catalog:",
|
|
143
143
|
tsup: "catalog:",
|
|
144
144
|
wrangler: ">=3.58.0"
|
|
@@ -165,10 +165,12 @@ var require_package = __commonJS({
|
|
|
165
165
|
},
|
|
166
166
|
dependencies: {
|
|
167
167
|
"@aws-sdk/client-s3": "^3.948.0",
|
|
168
|
+
"@aws-sdk/lib-storage": "^3.954.0",
|
|
168
169
|
"@smithy/node-http-handler": "^4.4.5",
|
|
169
170
|
defu: "catalog:",
|
|
170
171
|
glob: "catalog:",
|
|
171
|
-
"mime-types": "^3.0.2"
|
|
172
|
+
"mime-types": "^3.0.2",
|
|
173
|
+
"pretty-bytes": "^7.1.0"
|
|
172
174
|
},
|
|
173
175
|
devDependencies: {
|
|
174
176
|
"@nx/devkit": "catalog:",
|
|
@@ -2,9 +2,10 @@ import {
|
|
|
2
2
|
createHttpHandler
|
|
3
3
|
} from "./chunk-SWYYMID7.mjs";
|
|
4
4
|
import {
|
|
5
|
+
getEncoding,
|
|
5
6
|
getInternalDependencies,
|
|
6
7
|
uploadFile
|
|
7
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-Z2D7AKMD.mjs";
|
|
8
9
|
import {
|
|
9
10
|
createCliOptions,
|
|
10
11
|
getPackageInfo
|
|
@@ -23,7 +24,11 @@ import {
|
|
|
23
24
|
} from "./chunk-TPNHSNNZ.mjs";
|
|
24
25
|
|
|
25
26
|
// src/executors/r2-upload-publish/executor.ts
|
|
26
|
-
import {
|
|
27
|
+
import {
|
|
28
|
+
DeleteObjectsCommand,
|
|
29
|
+
ListObjectsCommand,
|
|
30
|
+
S3Client
|
|
31
|
+
} from "@aws-sdk/client-s3";
|
|
27
32
|
import {
|
|
28
33
|
createProjectGraphAsync,
|
|
29
34
|
readCachedProjectGraph
|
|
@@ -90,7 +95,7 @@ async function runExecutor(options, context) {
|
|
|
90
95
|
writeDebug(
|
|
91
96
|
`Publishing ${context.projectName} to the ${bucketId} R2 Bucket (at ${registry})`
|
|
92
97
|
);
|
|
93
|
-
const client = new
|
|
98
|
+
const client = new S3Client({
|
|
94
99
|
region: "auto",
|
|
95
100
|
endpoint: registry,
|
|
96
101
|
credentials: {
|
|
@@ -125,23 +130,27 @@ async function runExecutor(options, context) {
|
|
|
125
130
|
if (options.clean === true) {
|
|
126
131
|
writeDebug(`Clearing out existing items in ${bucketPath}`);
|
|
127
132
|
if (!isDryRun) {
|
|
128
|
-
const response = await client.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
const response = await client.send(
|
|
134
|
+
new ListObjectsCommand({
|
|
135
|
+
Bucket: bucketId,
|
|
136
|
+
Prefix: !bucketPath || bucketPath === "/" ? void 0 : bucketPath
|
|
137
|
+
})
|
|
138
|
+
);
|
|
132
139
|
if (response?.Contents && response.Contents.length > 0) {
|
|
133
140
|
writeTrace(
|
|
134
141
|
`Deleting the following existing items from the R2 bucket path ${bucketPath}: ${response.Contents.map((item) => item.Key).join(", ")}`
|
|
135
142
|
);
|
|
136
|
-
await client.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
await client.send(
|
|
144
|
+
new DeleteObjectsCommand({
|
|
145
|
+
Bucket: bucketId,
|
|
146
|
+
Delete: {
|
|
147
|
+
Objects: response.Contents.map((item) => ({
|
|
148
|
+
Key: item.Key
|
|
149
|
+
})),
|
|
150
|
+
Quiet: false
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
);
|
|
145
154
|
} else {
|
|
146
155
|
writeDebug(
|
|
147
156
|
`No existing items to delete in the R2 bucket path ${bucketPath}`
|
|
@@ -193,10 +202,7 @@ async function runExecutor(options, context) {
|
|
|
193
202
|
bucketPath,
|
|
194
203
|
name,
|
|
195
204
|
version,
|
|
196
|
-
|
|
197
|
-
await readFile(file, "binary"),
|
|
198
|
-
"binary"
|
|
199
|
-
).toString("base64")}`,
|
|
205
|
+
await readFile(file, getEncoding(type)),
|
|
200
206
|
type,
|
|
201
207
|
isDryRun
|
|
202
208
|
);
|
|
@@ -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.71.
|
|
10
|
+
version: "0.71.31",
|
|
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 = _chunkMCKGQKYUjs.__commonJS.call(void 0, {
|
|
|
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.294.
|
|
139
|
+
"@storm-software/config": "1.134.71",
|
|
140
|
+
"@storm-software/config-tools": "1.188.71",
|
|
141
|
+
"@storm-software/workspace-tools": "1.294.17",
|
|
142
142
|
nx: "catalog:",
|
|
143
143
|
tsup: "catalog:",
|
|
144
144
|
wrangler: ">=3.58.0"
|
|
@@ -165,10 +165,12 @@ var require_package = _chunkMCKGQKYUjs.__commonJS.call(void 0, {
|
|
|
165
165
|
},
|
|
166
166
|
dependencies: {
|
|
167
167
|
"@aws-sdk/client-s3": "^3.948.0",
|
|
168
|
+
"@aws-sdk/lib-storage": "^3.954.0",
|
|
168
169
|
"@smithy/node-http-handler": "^4.4.5",
|
|
169
170
|
defu: "catalog:",
|
|
170
171
|
glob: "catalog:",
|
|
171
|
-
"mime-types": "^3.0.2"
|
|
172
|
+
"mime-types": "^3.0.2",
|
|
173
|
+
"pretty-bytes": "^7.1.0"
|
|
172
174
|
},
|
|
173
175
|
devDependencies: {
|
|
174
176
|
"@nx/devkit": "catalog:",
|
|
@@ -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
|
|
3
|
+
var _chunkAOAVYQNPjs = require('./chunk-AOAVYQNP.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -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
|
|
69
|
+
await _chunkAOAVYQNPjs.generator_default.call(void 0, tree, {
|
|
70
70
|
...options,
|
|
71
71
|
skipFormat: true
|
|
72
72
|
})
|
|
@@ -4,7 +4,8 @@ var _chunkKUGEZPUOjs = require('./chunk-KUGEZPUO.js');
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
|
|
8
|
+
var _chunkVZQDXTIPjs = require('./chunk-VZQDXTIP.js');
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
|
|
@@ -23,6 +24,10 @@ var _chunk5GILNZWSjs = require('./chunk-5GILNZWS.js');
|
|
|
23
24
|
var _chunkZ2WQB55Rjs = require('./chunk-Z2WQB55R.js');
|
|
24
25
|
|
|
25
26
|
// src/executors/r2-upload-publish/executor.ts
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
26
31
|
var _clients3 = require('@aws-sdk/client-s3');
|
|
27
32
|
|
|
28
33
|
|
|
@@ -90,7 +95,7 @@ async function runExecutor(options, context) {
|
|
|
90
95
|
_chunkZ2WQB55Rjs.writeDebug.call(void 0,
|
|
91
96
|
`Publishing ${context.projectName} to the ${bucketId} R2 Bucket (at ${registry})`
|
|
92
97
|
);
|
|
93
|
-
const client = new (0, _clients3.
|
|
98
|
+
const client = new (0, _clients3.S3Client)({
|
|
94
99
|
region: "auto",
|
|
95
100
|
endpoint: registry,
|
|
96
101
|
credentials: {
|
|
@@ -109,7 +114,7 @@ async function runExecutor(options, context) {
|
|
|
109
114
|
const files = await _glob.glob.call(void 0, _chunkZ2WQB55Rjs.joinPaths.call(void 0, basePath, "**/*"), {
|
|
110
115
|
ignore: "**/{*.stories.tsx,*.stories.ts,*.spec.tsx,*.spec.ts}"
|
|
111
116
|
});
|
|
112
|
-
const internalDependencies = await
|
|
117
|
+
const internalDependencies = await _chunkVZQDXTIPjs.getInternalDependencies.call(void 0,
|
|
113
118
|
context.projectName,
|
|
114
119
|
projectGraph
|
|
115
120
|
);
|
|
@@ -125,23 +130,27 @@ async function runExecutor(options, context) {
|
|
|
125
130
|
if (options.clean === true) {
|
|
126
131
|
_chunkZ2WQB55Rjs.writeDebug.call(void 0, `Clearing out existing items in ${bucketPath}`);
|
|
127
132
|
if (!isDryRun) {
|
|
128
|
-
const response = await client.
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
133
|
+
const response = await client.send(
|
|
134
|
+
new (0, _clients3.ListObjectsCommand)({
|
|
135
|
+
Bucket: bucketId,
|
|
136
|
+
Prefix: !bucketPath || bucketPath === "/" ? void 0 : bucketPath
|
|
137
|
+
})
|
|
138
|
+
);
|
|
132
139
|
if (_optionalChain([response, 'optionalAccess', _17 => _17.Contents]) && response.Contents.length > 0) {
|
|
133
140
|
_chunkZ2WQB55Rjs.writeTrace.call(void 0,
|
|
134
141
|
`Deleting the following existing items from the R2 bucket path ${bucketPath}: ${response.Contents.map((item) => item.Key).join(", ")}`
|
|
135
142
|
);
|
|
136
|
-
await client.
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
143
|
+
await client.send(
|
|
144
|
+
new (0, _clients3.DeleteObjectsCommand)({
|
|
145
|
+
Bucket: bucketId,
|
|
146
|
+
Delete: {
|
|
147
|
+
Objects: response.Contents.map((item) => ({
|
|
148
|
+
Key: item.Key
|
|
149
|
+
})),
|
|
150
|
+
Quiet: false
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
);
|
|
145
154
|
} else {
|
|
146
155
|
_chunkZ2WQB55Rjs.writeDebug.call(void 0,
|
|
147
156
|
`No existing items to delete in the R2 bucket path ${bucketPath}`
|
|
@@ -169,7 +178,7 @@ async function runExecutor(options, context) {
|
|
|
169
178
|
if (_optionalChain([projectDetails, 'optionalAccess', _22 => _22.type]) === "package.json") {
|
|
170
179
|
meta.devDependencies = _optionalChain([projectDetails, 'optionalAccess', _23 => _23.content, 'optionalAccess', _24 => _24.devDependencies]);
|
|
171
180
|
}
|
|
172
|
-
await
|
|
181
|
+
await _chunkVZQDXTIPjs.uploadFile.call(void 0,
|
|
173
182
|
client,
|
|
174
183
|
bucketId,
|
|
175
184
|
bucketPath,
|
|
@@ -187,16 +196,13 @@ async function runExecutor(options, context) {
|
|
|
187
196
|
}), 'optionalAccess', _25 => _25.isFile, 'call', _26 => _26()])) {
|
|
188
197
|
const name = _chunkZ2WQB55Rjs.correctPaths.call(void 0, file).replace(_chunkZ2WQB55Rjs.correctPaths.call(void 0, basePath), "");
|
|
189
198
|
const type = _mimetypes2.default.lookup(name) || "application/octet-stream";
|
|
190
|
-
await
|
|
199
|
+
await _chunkVZQDXTIPjs.uploadFile.call(void 0,
|
|
191
200
|
client,
|
|
192
201
|
bucketId,
|
|
193
202
|
bucketPath,
|
|
194
203
|
name,
|
|
195
204
|
version,
|
|
196
|
-
|
|
197
|
-
await _promises.readFile.call(void 0, file, "binary"),
|
|
198
|
-
"binary"
|
|
199
|
-
).toString("base64")}`,
|
|
205
|
+
await _promises.readFile.call(void 0, file, _chunkVZQDXTIPjs.getEncoding.call(void 0, type)),
|
|
200
206
|
type,
|
|
201
207
|
isDryRun
|
|
202
208
|
);
|
|
@@ -0,0 +1,68 @@
|
|
|
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
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkZ2WQB55Rjs = require('./chunk-Z2WQB55R.js');
|
|
7
|
+
|
|
8
|
+
// src/utils/r2-bucket-helpers.ts
|
|
9
|
+
var _libstorage = require('@aws-sdk/lib-storage');
|
|
10
|
+
var _crypto = require('crypto');
|
|
11
|
+
var _prettybytes = require('pretty-bytes'); var _prettybytes2 = _interopRequireDefault(_prettybytes);
|
|
12
|
+
async function uploadFile(client, bucketName, bucketPath, fileName, version, fileContent, contentType = "application/octet-stream", isDryRun = false) {
|
|
13
|
+
const key = _optionalChain([(!_optionalChain([bucketPath, 'optionalAccess', _ => _.trim, 'call', _2 => _2()]) || _optionalChain([bucketPath, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()]) === "/" ? fileName : _chunkZ2WQB55Rjs.joinPaths.call(void 0, bucketPath.trim(), fileName)), 'optionalAccess', _5 => _5.replace, 'call', _6 => _6(/^\/+/g, "")]) || "";
|
|
14
|
+
_chunkZ2WQB55Rjs.writeDebug.call(void 0,
|
|
15
|
+
`Uploading ${key} (content-type: ${contentType}, size: ${_prettybytes2.default.call(void 0,
|
|
16
|
+
Buffer.byteLength(fileContent, getEncoding(contentType))
|
|
17
|
+
)}) to the ${bucketName} R2 bucket`
|
|
18
|
+
);
|
|
19
|
+
try {
|
|
20
|
+
if (!isDryRun) {
|
|
21
|
+
const upload = new (0, _libstorage.Upload)({
|
|
22
|
+
client,
|
|
23
|
+
params: {
|
|
24
|
+
Bucket: bucketName,
|
|
25
|
+
Key: key,
|
|
26
|
+
Body: Buffer.from(fileContent, getEncoding(contentType)),
|
|
27
|
+
ContentType: contentType,
|
|
28
|
+
Metadata: {
|
|
29
|
+
version,
|
|
30
|
+
checksum: _crypto.createHash.call(void 0, "sha256").update(fileContent).digest("base64")
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
await upload.done();
|
|
35
|
+
} else {
|
|
36
|
+
_chunkZ2WQB55Rjs.writeWarning.call(void 0, "[Dry run]: Skipping upload to the R2 bucket.");
|
|
37
|
+
}
|
|
38
|
+
} catch (error) {
|
|
39
|
+
_chunkZ2WQB55Rjs.writeError.call(void 0, `Failed to upload ${key} to the ${bucketName} R2 bucket.`);
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function getInternalDependencies(projectName, graph) {
|
|
44
|
+
const allDeps = _nullishCoalesce(graph.dependencies[projectName], () => ( []));
|
|
45
|
+
return Array.from(
|
|
46
|
+
allDeps.reduce(
|
|
47
|
+
(acc, node) => {
|
|
48
|
+
const found = graph.nodes[node.target];
|
|
49
|
+
if (found) acc.push(found);
|
|
50
|
+
return acc;
|
|
51
|
+
},
|
|
52
|
+
[]
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
function isTextFile(mimeType) {
|
|
57
|
+
return mimeType.startsWith("text/") || mimeType === "application/json" || mimeType === "application/javascript" || mimeType === "application/xml" || mimeType === "application/x-yaml" || mimeType === "application/xhtml+xml" || mimeType === "application/x-httpd-php" || mimeType === "image/svg+xml";
|
|
58
|
+
}
|
|
59
|
+
function getEncoding(mimeType) {
|
|
60
|
+
return isTextFile(mimeType) ? "utf8" : "binary";
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
exports.uploadFile = uploadFile; exports.getInternalDependencies = getInternalDependencies; exports.isTextFile = isTextFile; exports.getEncoding = getEncoding;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import {
|
|
2
|
+
joinPaths,
|
|
3
|
+
writeDebug,
|
|
4
|
+
writeError,
|
|
5
|
+
writeWarning
|
|
6
|
+
} from "./chunk-TPNHSNNZ.mjs";
|
|
7
|
+
|
|
8
|
+
// src/utils/r2-bucket-helpers.ts
|
|
9
|
+
import { Upload } from "@aws-sdk/lib-storage";
|
|
10
|
+
import { createHash } from "node:crypto";
|
|
11
|
+
import prettyBytes from "pretty-bytes";
|
|
12
|
+
async function uploadFile(client, bucketName, bucketPath, fileName, version, fileContent, contentType = "application/octet-stream", isDryRun = false) {
|
|
13
|
+
const key = (!bucketPath?.trim() || bucketPath?.trim() === "/" ? fileName : joinPaths(bucketPath.trim(), fileName))?.replace(/^\/+/g, "") || "";
|
|
14
|
+
writeDebug(
|
|
15
|
+
`Uploading ${key} (content-type: ${contentType}, size: ${prettyBytes(
|
|
16
|
+
Buffer.byteLength(fileContent, getEncoding(contentType))
|
|
17
|
+
)}) to the ${bucketName} R2 bucket`
|
|
18
|
+
);
|
|
19
|
+
try {
|
|
20
|
+
if (!isDryRun) {
|
|
21
|
+
const upload = new Upload({
|
|
22
|
+
client,
|
|
23
|
+
params: {
|
|
24
|
+
Bucket: bucketName,
|
|
25
|
+
Key: key,
|
|
26
|
+
Body: Buffer.from(fileContent, getEncoding(contentType)),
|
|
27
|
+
ContentType: contentType,
|
|
28
|
+
Metadata: {
|
|
29
|
+
version,
|
|
30
|
+
checksum: createHash("sha256").update(fileContent).digest("base64")
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
await upload.done();
|
|
35
|
+
} else {
|
|
36
|
+
writeWarning("[Dry run]: Skipping upload to the R2 bucket.");
|
|
37
|
+
}
|
|
38
|
+
} catch (error) {
|
|
39
|
+
writeError(`Failed to upload ${key} to the ${bucketName} R2 bucket.`);
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
function getInternalDependencies(projectName, graph) {
|
|
44
|
+
const allDeps = graph.dependencies[projectName] ?? [];
|
|
45
|
+
return Array.from(
|
|
46
|
+
allDeps.reduce(
|
|
47
|
+
(acc, node) => {
|
|
48
|
+
const found = graph.nodes[node.target];
|
|
49
|
+
if (found) acc.push(found);
|
|
50
|
+
return acc;
|
|
51
|
+
},
|
|
52
|
+
[]
|
|
53
|
+
)
|
|
54
|
+
);
|
|
55
|
+
}
|
|
56
|
+
function isTextFile(mimeType) {
|
|
57
|
+
return mimeType.startsWith("text/") || mimeType === "application/json" || mimeType === "application/javascript" || mimeType === "application/xml" || mimeType === "application/x-yaml" || mimeType === "application/xhtml+xml" || mimeType === "application/x-httpd-php" || mimeType === "image/svg+xml";
|
|
58
|
+
}
|
|
59
|
+
function getEncoding(mimeType) {
|
|
60
|
+
return isTextFile(mimeType) ? "utf8" : "binary";
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export {
|
|
64
|
+
uploadFile,
|
|
65
|
+
getInternalDependencies,
|
|
66
|
+
isTextFile,
|
|
67
|
+
getEncoding
|
|
68
|
+
};
|
package/dist/executors.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";require('./chunk-XO66D74Z.js');
|
|
2
|
-
require('./chunk-
|
|
2
|
+
require('./chunk-UQBLSDWU.js');
|
|
3
3
|
require('./chunk-KUGEZPUO.js');
|
|
4
|
-
require('./chunk-
|
|
4
|
+
require('./chunk-VZQDXTIP.js');
|
|
5
5
|
require('./chunk-QBD2OGUY.js');
|
|
6
6
|
require('./chunk-IVVRVG36.js');
|
|
7
7
|
require('./chunk-N7FW365Q.js');
|
package/dist/executors.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import "./chunk-YSCEY447.mjs";
|
|
2
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-4WRUZBE7.mjs";
|
|
3
3
|
import "./chunk-SWYYMID7.mjs";
|
|
4
|
-
import "./chunk-
|
|
4
|
+
import "./chunk-Z2D7AKMD.mjs";
|
|
5
5
|
import "./chunk-WFPKBGV3.mjs";
|
|
6
6
|
import "./chunk-NIOOY3TB.mjs";
|
|
7
7
|
import "./chunk-3MAI3FU2.mjs";
|
package/dist/generators.js
CHANGED
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkQDAQB4EPjs = require('./chunk-QDAQB4EP.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkAOAVYQNPjs = require('./chunk-AOAVYQNP.js');
|
|
10
10
|
require('./chunk-5GILNZWS.js');
|
|
11
11
|
require('./chunk-Z2WQB55R.js');
|
|
12
12
|
require('./chunk-MCKGQKYU.js');
|
|
@@ -15,4 +15,4 @@ require('./chunk-MCKGQKYU.js');
|
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
exports.applicationGenerator =
|
|
18
|
+
exports.applicationGenerator = _chunkQDAQB4EPjs.applicationGenerator; exports.applicationSchematic = _chunkQDAQB4EPjs.applicationSchematic; exports.initGenerator = _chunkAOAVYQNPjs.initGenerator; exports.initSchematic = _chunkAOAVYQNPjs.initSchematic;
|
package/dist/generators.mjs
CHANGED
|
@@ -2,11 +2,11 @@ import "./chunk-3J7KBHMJ.mjs";
|
|
|
2
2
|
import {
|
|
3
3
|
applicationGenerator,
|
|
4
4
|
applicationSchematic
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-ZWYDXLNA.mjs";
|
|
6
6
|
import {
|
|
7
7
|
initGenerator,
|
|
8
8
|
initSchematic
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-3WBFV3XF.mjs";
|
|
10
10
|
import "./chunk-G4ZCI2MN.mjs";
|
|
11
11
|
import "./chunk-TPNHSNNZ.mjs";
|
|
12
12
|
import "./chunk-PALWHFOL.mjs";
|
package/dist/index.d.mts
CHANGED
|
@@ -3,7 +3,7 @@ export { R as R2UploadPublishExecutorSchema } from './schema.d-Dcq3Apw7.mjs';
|
|
|
3
3
|
export { I as InitGeneratorSchema, i as initGenerator, a as initSchematic } from './generator-DJ1RuHyR.mjs';
|
|
4
4
|
export { W as WorkerGeneratorSchema, a as applicationGenerator, b as applicationSchematic } from './generator-DW-9W9Fk.mjs';
|
|
5
5
|
import { CreateNodesV2 } from '@nx/devkit';
|
|
6
|
-
export { getInternalDependencies, uploadFile } from './src/utils/r2-bucket-helpers.mjs';
|
|
6
|
+
export { getEncoding, getInternalDependencies, isTextFile, uploadFile } from './src/utils/r2-bucket-helpers.mjs';
|
|
7
7
|
import '@storm-software/workspace-tools';
|
|
8
8
|
import '@aws-sdk/client-s3';
|
|
9
9
|
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ export { R as R2UploadPublishExecutorSchema } from './schema.d-Dcq3Apw7.js';
|
|
|
3
3
|
export { I as InitGeneratorSchema, i as initGenerator, a as initSchematic } from './generator-DJ1RuHyR.js';
|
|
4
4
|
export { W as WorkerGeneratorSchema, a as applicationGenerator, b as applicationSchematic } from './generator-DW-9W9Fk.js';
|
|
5
5
|
import { CreateNodesV2 } from '@nx/devkit';
|
|
6
|
-
export { getInternalDependencies, uploadFile } from './src/utils/r2-bucket-helpers.js';
|
|
6
|
+
export { getEncoding, getInternalDependencies, isTextFile, uploadFile } from './src/utils/r2-bucket-helpers.js';
|
|
7
7
|
import '@storm-software/workspace-tools';
|
|
8
8
|
import '@aws-sdk/client-s3';
|
|
9
9
|
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }require('./chunk-XO66D74Z.js');
|
|
2
|
-
require('./chunk-
|
|
2
|
+
require('./chunk-UQBLSDWU.js');
|
|
3
3
|
require('./chunk-DHBG5ASJ.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkQDAQB4EPjs = require('./chunk-QDAQB4EP.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkAOAVYQNPjs = require('./chunk-AOAVYQNP.js');
|
|
12
12
|
require('./chunk-KUGEZPUO.js');
|
|
13
13
|
require('./chunk-CVGPWUNP.js');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
var _chunkVZQDXTIPjs = require('./chunk-VZQDXTIP.js');
|
|
18
20
|
require('./chunk-QBD2OGUY.js');
|
|
19
21
|
require('./chunk-IVVRVG36.js');
|
|
20
22
|
|
|
@@ -156,4 +158,6 @@ function createPackageJson(projectJsonPath, workspaceRoot) {
|
|
|
156
158
|
|
|
157
159
|
|
|
158
160
|
|
|
159
|
-
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
exports.applicationGenerator = _chunkQDAQB4EPjs.applicationGenerator; exports.applicationSchematic = _chunkQDAQB4EPjs.applicationSchematic; exports.createNodesV2 = createNodesV2; exports.getEncoding = _chunkVZQDXTIPjs.getEncoding; exports.getInternalDependencies = _chunkVZQDXTIPjs.getInternalDependencies; exports.initGenerator = _chunkAOAVYQNPjs.initGenerator; exports.initSchematic = _chunkAOAVYQNPjs.initSchematic; exports.isTextFile = _chunkVZQDXTIPjs.isTextFile; exports.name = name; exports.uploadFile = _chunkVZQDXTIPjs.uploadFile;
|
package/dist/index.mjs
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
import "./chunk-YSCEY447.mjs";
|
|
2
|
-
import "./chunk-
|
|
2
|
+
import "./chunk-4WRUZBE7.mjs";
|
|
3
3
|
import "./chunk-3J7KBHMJ.mjs";
|
|
4
4
|
import {
|
|
5
5
|
applicationGenerator,
|
|
6
6
|
applicationSchematic
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-ZWYDXLNA.mjs";
|
|
8
8
|
import {
|
|
9
9
|
initGenerator,
|
|
10
10
|
initSchematic
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-3WBFV3XF.mjs";
|
|
12
12
|
import "./chunk-SWYYMID7.mjs";
|
|
13
13
|
import "./chunk-7Z5PILRU.mjs";
|
|
14
14
|
import {
|
|
15
|
+
getEncoding,
|
|
15
16
|
getInternalDependencies,
|
|
17
|
+
isTextFile,
|
|
16
18
|
uploadFile
|
|
17
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-Z2D7AKMD.mjs";
|
|
18
20
|
import "./chunk-WFPKBGV3.mjs";
|
|
19
21
|
import "./chunk-NIOOY3TB.mjs";
|
|
20
22
|
import {
|
|
@@ -151,9 +153,11 @@ export {
|
|
|
151
153
|
applicationGenerator,
|
|
152
154
|
applicationSchematic,
|
|
153
155
|
createNodesV2,
|
|
156
|
+
getEncoding,
|
|
154
157
|
getInternalDependencies,
|
|
155
158
|
initGenerator,
|
|
156
159
|
initSchematic,
|
|
160
|
+
isTextFile,
|
|
157
161
|
name,
|
|
158
162
|
uploadFile
|
|
159
163
|
};
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkUQBLSDWUjs = require('../../../chunk-UQBLSDWU.js');
|
|
4
4
|
require('../../../chunk-KUGEZPUO.js');
|
|
5
|
-
require('../../../chunk-
|
|
5
|
+
require('../../../chunk-VZQDXTIP.js');
|
|
6
6
|
require('../../../chunk-N7FW365Q.js');
|
|
7
7
|
require('../../../chunk-5GILNZWS.js');
|
|
8
8
|
require('../../../chunk-Z2WQB55R.js');
|
|
9
9
|
require('../../../chunk-MCKGQKYU.js');
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
exports.default =
|
|
12
|
+
exports.default = _chunkUQBLSDWUjs.runExecutor;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runExecutor
|
|
3
|
-
} from "../../../chunk-
|
|
3
|
+
} from "../../../chunk-4WRUZBE7.mjs";
|
|
4
4
|
import "../../../chunk-SWYYMID7.mjs";
|
|
5
|
-
import "../../../chunk-
|
|
5
|
+
import "../../../chunk-Z2D7AKMD.mjs";
|
|
6
6
|
import "../../../chunk-3MAI3FU2.mjs";
|
|
7
7
|
import "../../../chunk-G4ZCI2MN.mjs";
|
|
8
8
|
import "../../../chunk-TPNHSNNZ.mjs";
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkAOAVYQNPjs = require('../../../chunk-AOAVYQNP.js');
|
|
6
6
|
require('../../../chunk-MCKGQKYU.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
exports.default =
|
|
11
|
+
exports.default = _chunkAOAVYQNPjs.generator_default; exports.initGenerator = _chunkAOAVYQNPjs.initGenerator; exports.initSchematic = _chunkAOAVYQNPjs.initSchematic;
|