@just-be/deploy 0.6.0 → 0.8.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.
Files changed (2) hide show
  1. package/index.ts +11 -8
  2. package/package.json +1 -1
package/index.ts CHANGED
@@ -62,10 +62,13 @@ const DEBUG = process.env.DEBUG === "1" || process.env.DEBUG === "true";
62
62
 
63
63
  /**
64
64
  * Run wrangler command using bunx to ensure it resolves from package dependencies
65
+ * Takes variable arguments and passes them as separate shell arguments
66
+ *
67
+ * @example
68
+ * wrangler('r2', 'object', 'put', 'bucket/key', '--file', 'path')
65
69
  */
66
- function wrangler(command: TemplateStringsArray, ...values: unknown[]) {
67
- const cmd = String.raw(command, ...values);
68
- return $`bunx wrangler ${cmd}`;
70
+ function wrangler(...args: string[]) {
71
+ return $`bunx wrangler ${args}`;
69
72
  }
70
73
 
71
74
  /**
@@ -176,7 +179,7 @@ async function findFiles(dir: string): Promise<string[]> {
176
179
  */
177
180
  async function uploadToR2(localPath: string, r2Key: string): Promise<boolean> {
178
181
  try {
179
- await wrangler`r2 object put ${BUCKET_NAME}/${r2Key} --file ${localPath}`;
182
+ await wrangler("r2", "object", "put", `${BUCKET_NAME}/${r2Key}`, "--file", localPath);
180
183
  return true;
181
184
  } catch (error) {
182
185
  if (DEBUG) {
@@ -197,7 +200,7 @@ async function uploadToR2(localPath: string, r2Key: string): Promise<boolean> {
197
200
  */
198
201
  async function validateWranglerAuth(): Promise<boolean> {
199
202
  try {
200
- await wrangler`whoami`.quiet();
203
+ await wrangler("whoami").quiet();
201
204
  return true;
202
205
  } catch (error) {
203
206
  if (DEBUG) {
@@ -216,7 +219,7 @@ async function validateWranglerAuth(): Promise<boolean> {
216
219
  */
217
220
  async function validateKVAccess(): Promise<boolean> {
218
221
  try {
219
- await wrangler`kv key list --namespace-id ${KV_NAMESPACE_ID}`.quiet();
222
+ await wrangler("kv", "key", "list", "--namespace-id", KV_NAMESPACE_ID).quiet();
220
223
  return true;
221
224
  } catch (error) {
222
225
  if (DEBUG) {
@@ -267,7 +270,7 @@ function sanitizeBranchName(branch: string): string {
267
270
  */
268
271
  async function createKVEntry(subdomain: string, routeConfig: RouteConfig): Promise<void> {
269
272
  const configJson = JSON.stringify(routeConfig);
270
- await wrangler`kv key put --namespace-id ${KV_NAMESPACE_ID} ${subdomain} ${configJson}`;
273
+ await wrangler("kv", "key", "put", "--namespace-id", KV_NAMESPACE_ID, subdomain, configJson);
271
274
  }
272
275
 
273
276
  /**
@@ -458,7 +461,7 @@ async function deploy() {
458
461
  console.log("This will open a browser window for you to authorize access.\n");
459
462
 
460
463
  try {
461
- await wrangler`login`;
464
+ await wrangler("login");
462
465
  console.log("\n✓ Successfully authenticated!");
463
466
 
464
467
  // Verify authentication worked
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@just-be/deploy",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Deploy static sites to Cloudflare R2 with subdomain routing",
5
5
  "type": "module",
6
6
  "bin": {