@renbostudios/edge-ota 0.2.2 → 0.2.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/dist/index.js +23 -2
- package/package.json +11 -4
package/dist/index.js
CHANGED
|
@@ -289,12 +289,26 @@ program
|
|
|
289
289
|
.option("-r, --runtime <version>", "React Native runtime version (semver)", "1.0.0")
|
|
290
290
|
.option("-p, --platform <platform>", "Target platform: ios | android | all", "all")
|
|
291
291
|
.option("--project <id>", "Project ID (optional, overrides config)")
|
|
292
|
+
.option("-t, --token <token>", "Deploy key token (or set EDGE_OTA_TOKEN env var)")
|
|
292
293
|
.option("--skip-export", "Skip expo export (use existing ./dist directory)")
|
|
293
294
|
.option("--dry-run", "Build and sign the payload but do NOT upload")
|
|
294
295
|
.action(async (options) => {
|
|
295
296
|
const cwd = process.cwd();
|
|
296
297
|
const config = loadConfig(cwd);
|
|
297
298
|
const privateKey = loadPrivateKey(cwd);
|
|
299
|
+
// Resolve token — CLI flag > env var
|
|
300
|
+
const token = options.token || process.env.EDGE_OTA_TOKEN;
|
|
301
|
+
if (!token) {
|
|
302
|
+
console.error(`${colors.bold}${colors.red}❌ Auth token required. Use --token <token> or set EDGE_OTA_TOKEN env var.${colors.reset}`);
|
|
303
|
+
console.error(` Generate a deploy key from your dashboard → Keys page.`);
|
|
304
|
+
process.exit(1);
|
|
305
|
+
}
|
|
306
|
+
// Resolve project ID — CLI flag > config file
|
|
307
|
+
const projectId = options.project || config.projectId;
|
|
308
|
+
// Build the correct upload URL
|
|
309
|
+
const uploadUrl = projectId
|
|
310
|
+
? `${config.serverUrl}/api/projects/${projectId}/updates`
|
|
311
|
+
: `${config.serverUrl}/api/updates`;
|
|
298
312
|
// ── Step 1: Build ────────────────────────────────────────────────────────
|
|
299
313
|
printBanner();
|
|
300
314
|
const distDir = path.resolve(cwd, "dist");
|
|
@@ -319,6 +333,9 @@ program
|
|
|
319
333
|
console.log(`\n${colors.bold}${colors.cyan}🔍 Collecting assets and computing SHA-256 hashes...${colors.reset}`);
|
|
320
334
|
const assets = await collectAssets(distDir);
|
|
321
335
|
console.log(` Found ${colors.bold}${colors.white}${assets.length}${colors.reset} asset(s)`);
|
|
336
|
+
if (projectId) {
|
|
337
|
+
console.log(` Project : ${colors.bold}${colors.cyan}${projectId}${colors.reset}`);
|
|
338
|
+
}
|
|
322
339
|
const platforms = options.platform === "all" ? ["ios", "android"] : [options.platform];
|
|
323
340
|
for (const platform of platforms) {
|
|
324
341
|
console.log(`\n${colors.bold}${colors.magenta}🚀 Processing platform: ${platform.toUpperCase()}${colors.reset}`);
|
|
@@ -358,9 +375,13 @@ program
|
|
|
358
375
|
form.append("payload", payloadStr);
|
|
359
376
|
form.append("signature", signature);
|
|
360
377
|
form.append("platform", platform);
|
|
361
|
-
console.log(`📡 Uploading to ${colors.cyan}${
|
|
362
|
-
const response = await fetch(
|
|
378
|
+
console.log(`📡 Uploading to ${colors.cyan}${uploadUrl}${colors.reset} ...`);
|
|
379
|
+
const response = await fetch(uploadUrl, {
|
|
363
380
|
method: "POST",
|
|
381
|
+
headers: {
|
|
382
|
+
"Authorization": `Bearer ${token}`,
|
|
383
|
+
...(projectId ? { "X-Project-Id": projectId } : {})
|
|
384
|
+
},
|
|
364
385
|
body: form
|
|
365
386
|
});
|
|
366
387
|
// Clean up zip
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@renbostudios/edge-ota",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"preferGlobal": true,
|
|
5
5
|
"description": "Zero-SDK, self-hostable OTA update CLI for Expo — push signed JS bundles to any EdgeOTA server",
|
|
6
6
|
"license": "MIT",
|
|
@@ -8,13 +8,20 @@
|
|
|
8
8
|
"homepage": "https://github.com/renbostudios/edge-ota",
|
|
9
9
|
"repository": {
|
|
10
10
|
"type": "git",
|
|
11
|
-
"url": "https://github.com/renbostudios/edge-ota.git"
|
|
12
|
-
"directory": "apps/cli"
|
|
11
|
+
"url": "https://github.com/renbostudios/edge-ota.git"
|
|
13
12
|
},
|
|
14
13
|
"bugs": {
|
|
15
14
|
"url": "https://github.com/renbostudios/edge-ota/issues"
|
|
16
15
|
},
|
|
17
|
-
"keywords": [
|
|
16
|
+
"keywords": [
|
|
17
|
+
"expo",
|
|
18
|
+
"ota",
|
|
19
|
+
"updates",
|
|
20
|
+
"react-native",
|
|
21
|
+
"cli",
|
|
22
|
+
"edge",
|
|
23
|
+
"cloudflare"
|
|
24
|
+
],
|
|
18
25
|
"type": "module",
|
|
19
26
|
"bin": {
|
|
20
27
|
"edge-ota": "./dist/index.js"
|