@storm-software/cloudflare-tools 0.70.49 → 0.71.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.
- package/CHANGELOG.md +21 -0
- package/README.md +9 -2
- package/dist/chunk-7ESZB4KW.mjs +220 -0
- package/dist/{chunk-6KHWP2MO.js → chunk-BPUFICBM.js} +2 -2
- package/dist/{chunk-3JEOBMM5.mjs → chunk-C6B32MBV.mjs} +12 -8
- package/dist/{chunk-D4JUMEIC.js → chunk-DRYNN63F.js} +7 -6
- package/dist/{chunk-2B7ISOXH.mjs → chunk-J2DOKDIF.mjs} +8 -7
- package/dist/{chunk-UEJFDB6Y.mjs → chunk-QN6OKPMU.mjs} +1 -1
- package/dist/chunk-VHMJXOF4.js +220 -0
- package/dist/{chunk-YAUK66IM.js → chunk-W5IPHIXB.js} +11 -7
- package/dist/{chunk-BIFOD6C3.mjs → chunk-XDQBFBX4.mjs} +1 -1
- package/dist/{chunk-Y5VPR2KX.mjs → chunk-ZFJIFXOW.mjs} +4 -4
- package/dist/executors.d.mts +1 -1
- package/dist/executors.d.ts +1 -1
- package/dist/executors.js +2 -2
- package/dist/executors.mjs +4 -4
- package/dist/generators.js +3 -3
- package/dist/generators.mjs +3 -3
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +5 -5
- package/dist/index.mjs +6 -6
- package/dist/schema.d-elsO8UQp.d.mts +88 -0
- package/dist/schema.d-elsO8UQp.d.ts +88 -0
- package/dist/src/executors/cloudflare-publish/executor.js +1 -1
- 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 +2 -2
- package/dist/src/executors/r2-upload-publish/executor.mjs +2 -2
- package/dist/src/executors/r2-upload-publish/schema.d.ts +86 -7
- package/dist/src/executors/r2-upload-publish/schema.json +63 -22
- package/dist/src/executors/serve/executor.js +2 -2
- package/dist/src/executors/serve/executor.mjs +2 -2
- package/dist/src/generators/init/generator.js +2 -2
- package/dist/src/generators/init/generator.mjs +2 -2
- package/dist/src/generators/worker/generator.js +3 -3
- package/dist/src/generators/worker/generator.mjs +3 -3
- package/dist/src/utils/index.mjs +1 -1
- package/dist/src/utils/r2-bucket-helpers.mjs +1 -1
- package/dist/tsup.config.mjs +1 -1
- package/docs/api/executors/r2-upload-publish/schema.md +93 -0
- package/package.json +13 -12
- package/dist/chunk-IH7ZJRS7.js +0 -262
- package/dist/chunk-JEMQ2Y24.mjs +0 -265
- package/dist/chunk-KSZZYFCQ.js +0 -209
- package/dist/chunk-OTDPGPH4.js +0 -209
- package/dist/chunk-S3HIZ32I.mjs +0 -209
- package/dist/chunk-WBUCIAVK.mjs +0 -209
- package/dist/schema.d-oSirXiCO.d.mts +0 -11
- package/dist/schema.d-oSirXiCO.d.ts +0 -11
package/dist/chunk-S3HIZ32I.mjs
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
createCliOptions,
|
|
3
|
-
getPackageInfo
|
|
4
|
-
} from "./chunk-PH3DHY4Q.mjs";
|
|
5
|
-
import {
|
|
6
|
-
getInternalDependencies,
|
|
7
|
-
r2UploadFile
|
|
8
|
-
} from "./chunk-5N2NVDKX.mjs";
|
|
9
|
-
import {
|
|
10
|
-
findWorkspaceRoot,
|
|
11
|
-
getConfig
|
|
12
|
-
} from "./chunk-PTTJW7MW.mjs";
|
|
13
|
-
import {
|
|
14
|
-
writeDebug,
|
|
15
|
-
writeInfo,
|
|
16
|
-
writeSuccess,
|
|
17
|
-
writeWarning
|
|
18
|
-
} from "./chunk-6MATO2MJ.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
|
-
};
|
package/dist/chunk-WBUCIAVK.mjs
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getInternalDependencies,
|
|
3
|
-
r2UploadFile
|
|
4
|
-
} from "./chunk-5N2NVDKX.mjs";
|
|
5
|
-
import {
|
|
6
|
-
createCliOptions,
|
|
7
|
-
getPackageInfo
|
|
8
|
-
} from "./chunk-PH3DHY4Q.mjs";
|
|
9
|
-
import {
|
|
10
|
-
findWorkspaceRoot,
|
|
11
|
-
getConfig
|
|
12
|
-
} from "./chunk-PTTJW7MW.mjs";
|
|
13
|
-
import {
|
|
14
|
-
writeDebug,
|
|
15
|
-
writeInfo,
|
|
16
|
-
writeSuccess,
|
|
17
|
-
writeWarning
|
|
18
|
-
} from "./chunk-6MATO2MJ.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
|
-
};
|