forge-remote 0.1.6 → 0.1.7
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/package.json +1 -1
- package/src/init.js +23 -2
package/package.json
CHANGED
package/src/init.js
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import { execSync, execFileSync } from "child_process";
|
|
6
6
|
import { createInterface } from "readline";
|
|
7
7
|
import { hostname, platform, homedir } from "os";
|
|
8
|
-
import { existsSync, mkdirSync, writeFileSync, readFileSync } from "fs";
|
|
8
|
+
import { existsSync, mkdirSync, writeFileSync, readFileSync, rmSync } from "fs";
|
|
9
9
|
import { join, dirname } from "path";
|
|
10
10
|
import { fileURLToPath } from "url";
|
|
11
11
|
import { initializeApp, cert } from "firebase-admin/app";
|
|
@@ -440,6 +440,27 @@ export async function runInit({ projectId: overrideProjectId } = {}) {
|
|
|
440
440
|
sdkConfig = await getWebAppConfig(projectId, appId);
|
|
441
441
|
break; // Success — exit retry loop.
|
|
442
442
|
} catch (e) {
|
|
443
|
+
const errMsg = e.message || "";
|
|
444
|
+
|
|
445
|
+
// Detect deleted projects — no point retrying, bail immediately.
|
|
446
|
+
if (errMsg.includes("has been deleted") || errMsg.includes("DELETED")) {
|
|
447
|
+
// Clear stale cached config so next run starts fresh.
|
|
448
|
+
try {
|
|
449
|
+
rmSync(forgeDir, { recursive: true, force: true });
|
|
450
|
+
} catch {
|
|
451
|
+
// Best-effort cleanup.
|
|
452
|
+
}
|
|
453
|
+
throw new Error(
|
|
454
|
+
`Project "${projectId}" has been deleted and is pending permanent removal (30 days).\n\n` +
|
|
455
|
+
chalk.bold(
|
|
456
|
+
" The cached config has been cleared. Re-run with a new project ID:\n\n",
|
|
457
|
+
) +
|
|
458
|
+
chalk.cyan(
|
|
459
|
+
` forge-remote init --project-id forge-remote-${sanitizedHostname()}-2\n`,
|
|
460
|
+
),
|
|
461
|
+
);
|
|
462
|
+
}
|
|
463
|
+
|
|
443
464
|
if (attempt < maxSdkRetries) {
|
|
444
465
|
console.log(
|
|
445
466
|
chalk.yellow(
|
|
@@ -451,7 +472,7 @@ export async function runInit({ projectId: overrideProjectId } = {}) {
|
|
|
451
472
|
} else {
|
|
452
473
|
throw new Error(
|
|
453
474
|
`Could not retrieve SDK config after ${maxSdkRetries} attempts.\n` +
|
|
454
|
-
` Last error: ${
|
|
475
|
+
` Last error: ${errMsg}\n\n` +
|
|
455
476
|
chalk.bold(" Try these steps:\n\n") +
|
|
456
477
|
chalk.cyan(
|
|
457
478
|
` 1. Wait 30 seconds, then re-run: forge-remote init\n`,
|