@just-be/deploy 0.8.0 → 0.9.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/index.ts +28 -3
- package/package.json +1 -1
package/index.ts
CHANGED
|
@@ -179,7 +179,15 @@ async function findFiles(dir: string): Promise<string[]> {
|
|
|
179
179
|
*/
|
|
180
180
|
async function uploadToR2(localPath: string, r2Key: string): Promise<boolean> {
|
|
181
181
|
try {
|
|
182
|
-
await wrangler(
|
|
182
|
+
await wrangler(
|
|
183
|
+
"r2",
|
|
184
|
+
"object",
|
|
185
|
+
"put",
|
|
186
|
+
`${BUCKET_NAME}/${r2Key}`,
|
|
187
|
+
"--file",
|
|
188
|
+
localPath,
|
|
189
|
+
"--remote"
|
|
190
|
+
);
|
|
183
191
|
return true;
|
|
184
192
|
} catch (error) {
|
|
185
193
|
if (DEBUG) {
|
|
@@ -219,7 +227,7 @@ async function validateWranglerAuth(): Promise<boolean> {
|
|
|
219
227
|
*/
|
|
220
228
|
async function validateKVAccess(): Promise<boolean> {
|
|
221
229
|
try {
|
|
222
|
-
await wrangler("kv", "key", "list", "--namespace-id", KV_NAMESPACE_ID).quiet();
|
|
230
|
+
await wrangler("kv", "key", "list", "--namespace-id", KV_NAMESPACE_ID, "--remote").quiet();
|
|
223
231
|
return true;
|
|
224
232
|
} catch (error) {
|
|
225
233
|
if (DEBUG) {
|
|
@@ -270,7 +278,16 @@ function sanitizeBranchName(branch: string): string {
|
|
|
270
278
|
*/
|
|
271
279
|
async function createKVEntry(subdomain: string, routeConfig: RouteConfig): Promise<void> {
|
|
272
280
|
const configJson = JSON.stringify(routeConfig);
|
|
273
|
-
await wrangler(
|
|
281
|
+
await wrangler(
|
|
282
|
+
"kv",
|
|
283
|
+
"key",
|
|
284
|
+
"put",
|
|
285
|
+
"--namespace-id",
|
|
286
|
+
KV_NAMESPACE_ID,
|
|
287
|
+
subdomain,
|
|
288
|
+
configJson,
|
|
289
|
+
"--remote"
|
|
290
|
+
);
|
|
274
291
|
}
|
|
275
292
|
|
|
276
293
|
/**
|
|
@@ -284,6 +301,12 @@ async function deployStaticRule(rule: StaticRule, s: ReturnType<typeof spinner>)
|
|
|
284
301
|
} else if (rule.fallback) {
|
|
285
302
|
console.log(` Fallback: ${rule.fallback}`);
|
|
286
303
|
}
|
|
304
|
+
if (rule.redirects?.length) {
|
|
305
|
+
console.log(` Redirects: ${rule.redirects.length} path rule(s)`);
|
|
306
|
+
}
|
|
307
|
+
if (rule.rewrites?.length) {
|
|
308
|
+
console.log(` Rewrites: ${rule.rewrites.length} path rule(s)`);
|
|
309
|
+
}
|
|
287
310
|
|
|
288
311
|
// Verify directory exists
|
|
289
312
|
try {
|
|
@@ -336,6 +359,8 @@ async function deployStaticRule(rule: StaticRule, s: ReturnType<typeof spinner>)
|
|
|
336
359
|
type: "static",
|
|
337
360
|
...(rule.spa && { spa: rule.spa }),
|
|
338
361
|
...(rule.fallback && { fallback: rule.fallback }),
|
|
362
|
+
...(rule.redirects?.length && { redirects: rule.redirects }),
|
|
363
|
+
...(rule.rewrites?.length && { rewrites: rule.rewrites }),
|
|
339
364
|
};
|
|
340
365
|
|
|
341
366
|
s.start(`Creating KV routing entry`);
|