clawfire 0.6.9 → 0.6.10
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/cli.js +1 -1
- package/dist/{dev-server-6BALG4FC.js → dev-server-FNRFWJD3.js} +49 -10
- package/dist/dev.cjs +49 -10
- package/dist/dev.cjs.map +1 -1
- package/dist/dev.js +49 -10
- package/dist/dev.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -269,7 +269,7 @@ async function runDevServer() {
|
|
|
269
269
|
const port = portArg ? parseInt(portArg.split("=")[1], 10) : 3e3;
|
|
270
270
|
const apiPort = apiPortArg ? parseInt(apiPortArg.split("=")[1], 10) : 3456;
|
|
271
271
|
const noHotReload = args.includes("--no-hot-reload");
|
|
272
|
-
const { startDevServer } = await import("./dev-server-
|
|
272
|
+
const { startDevServer } = await import("./dev-server-FNRFWJD3.js");
|
|
273
273
|
await startDevServer({
|
|
274
274
|
projectDir,
|
|
275
275
|
port,
|
|
@@ -3042,27 +3042,63 @@ var FirebaseSetup = class {
|
|
|
3042
3042
|
return { success: true, message: `Synced ${lines.length} env vars to functions/.env`, count: lines.length };
|
|
3043
3043
|
}
|
|
3044
3044
|
/**
|
|
3045
|
-
* Ensure firebase.json
|
|
3045
|
+
* Ensure firebase.json is fully configured for deployment:
|
|
3046
|
+
* - functions config exists
|
|
3047
|
+
* - hosting has cleanUrls
|
|
3048
|
+
* - hosting has API rewrite (/api/** → api function) before catch-all
|
|
3049
|
+
*
|
|
3050
|
+
* Fixes existing configs created by older versions.
|
|
3046
3051
|
*/
|
|
3047
|
-
|
|
3052
|
+
ensureDeployConfig() {
|
|
3048
3053
|
const firebaseJsonPath = resolve4(this.projectDir, "firebase.json");
|
|
3049
3054
|
if (!existsSync5(firebaseJsonPath)) {
|
|
3050
|
-
return { success: false, message: "firebase.json not found." };
|
|
3055
|
+
return { success: false, message: "firebase.json not found.", changes: [] };
|
|
3051
3056
|
}
|
|
3052
3057
|
try {
|
|
3053
3058
|
const config = JSON.parse(readFileSync4(firebaseJsonPath, "utf-8"));
|
|
3059
|
+
const changes = [];
|
|
3054
3060
|
if (!config.functions) {
|
|
3055
3061
|
config.functions = {
|
|
3056
3062
|
source: "functions",
|
|
3057
3063
|
runtime: "nodejs20",
|
|
3058
3064
|
codebase: "clawfire"
|
|
3059
3065
|
};
|
|
3066
|
+
changes.push("Added functions config");
|
|
3067
|
+
}
|
|
3068
|
+
if (config.hosting && !config.hosting.cleanUrls) {
|
|
3069
|
+
config.hosting.cleanUrls = true;
|
|
3070
|
+
changes.push("Added cleanUrls");
|
|
3071
|
+
}
|
|
3072
|
+
if (config.hosting) {
|
|
3073
|
+
if (!config.hosting.rewrites) {
|
|
3074
|
+
config.hosting.rewrites = [];
|
|
3075
|
+
}
|
|
3076
|
+
const rewrites = config.hosting.rewrites;
|
|
3077
|
+
const hasApiRewrite = rewrites.some(
|
|
3078
|
+
(r) => r.source === "/api/**" && r.function === "api"
|
|
3079
|
+
);
|
|
3080
|
+
if (!hasApiRewrite) {
|
|
3081
|
+
const apiRewrite = { source: "/api/**", function: "api" };
|
|
3082
|
+
const catchAllIndex = rewrites.findIndex((r) => r.source === "**");
|
|
3083
|
+
if (catchAllIndex >= 0) {
|
|
3084
|
+
rewrites.splice(catchAllIndex, 0, apiRewrite);
|
|
3085
|
+
} else {
|
|
3086
|
+
rewrites.push(apiRewrite);
|
|
3087
|
+
rewrites.push({ source: "**", destination: "/index.html" });
|
|
3088
|
+
}
|
|
3089
|
+
changes.push("Added API rewrite (/api/** \u2192 Cloud Function)");
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
if (changes.length > 0) {
|
|
3060
3093
|
writeFileSync3(firebaseJsonPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
3061
|
-
return { success: true, message: "Functions config added to firebase.json." };
|
|
3062
3094
|
}
|
|
3063
|
-
return {
|
|
3095
|
+
return {
|
|
3096
|
+
success: true,
|
|
3097
|
+
message: changes.length > 0 ? changes.join(", ") : "Deploy config up to date.",
|
|
3098
|
+
changes
|
|
3099
|
+
};
|
|
3064
3100
|
} catch {
|
|
3065
|
-
return { success: false, message: "Invalid firebase.json." };
|
|
3101
|
+
return { success: false, message: "Invalid firebase.json.", changes: [] };
|
|
3066
3102
|
}
|
|
3067
3103
|
}
|
|
3068
3104
|
/**
|
|
@@ -4543,6 +4579,13 @@ ${liveReloadScript}
|
|
|
4543
4579
|
}
|
|
4544
4580
|
}
|
|
4545
4581
|
}
|
|
4582
|
+
const deployConfig = this.firebaseSetup.ensureDeployConfig();
|
|
4583
|
+
if (deployConfig.success && deployConfig.changes.length > 0) {
|
|
4584
|
+
for (const change of deployConfig.changes) {
|
|
4585
|
+
console.log(` \x1B[32m\u2713\x1B[0m firebase.json: ${change}`);
|
|
4586
|
+
}
|
|
4587
|
+
steps.push(`firebase.json updated (${deployConfig.changes.length} fixes)`);
|
|
4588
|
+
}
|
|
4546
4589
|
let deployFunctions = false;
|
|
4547
4590
|
if (hasFunctions) {
|
|
4548
4591
|
const syncResult = this.firebaseSetup.syncEnvToFunctions(firebaseConfig);
|
|
@@ -4552,10 +4595,6 @@ ${liveReloadScript}
|
|
|
4552
4595
|
} else {
|
|
4553
4596
|
console.log(` \x1B[33m\u26A0\x1B[0m Env sync: ${syncResult.message}`);
|
|
4554
4597
|
}
|
|
4555
|
-
const configResult = this.firebaseSetup.ensureFunctionsConfig();
|
|
4556
|
-
if (configResult.success) {
|
|
4557
|
-
console.log(` \x1B[32m\u2713\x1B[0m ${configResult.message}`);
|
|
4558
|
-
}
|
|
4559
4598
|
console.log(" Building functions...");
|
|
4560
4599
|
const buildResult = await this.firebaseSetup.buildFunctions();
|
|
4561
4600
|
if (buildResult.success) {
|
package/dist/dev.cjs
CHANGED
|
@@ -3454,27 +3454,63 @@ var FirebaseSetup = class {
|
|
|
3454
3454
|
return { success: true, message: `Synced ${lines.length} env vars to functions/.env`, count: lines.length };
|
|
3455
3455
|
}
|
|
3456
3456
|
/**
|
|
3457
|
-
* Ensure firebase.json
|
|
3457
|
+
* Ensure firebase.json is fully configured for deployment:
|
|
3458
|
+
* - functions config exists
|
|
3459
|
+
* - hosting has cleanUrls
|
|
3460
|
+
* - hosting has API rewrite (/api/** → api function) before catch-all
|
|
3461
|
+
*
|
|
3462
|
+
* Fixes existing configs created by older versions.
|
|
3458
3463
|
*/
|
|
3459
|
-
|
|
3464
|
+
ensureDeployConfig() {
|
|
3460
3465
|
const firebaseJsonPath = (0, import_node_path4.resolve)(this.projectDir, "firebase.json");
|
|
3461
3466
|
if (!(0, import_node_fs4.existsSync)(firebaseJsonPath)) {
|
|
3462
|
-
return { success: false, message: "firebase.json not found." };
|
|
3467
|
+
return { success: false, message: "firebase.json not found.", changes: [] };
|
|
3463
3468
|
}
|
|
3464
3469
|
try {
|
|
3465
3470
|
const config = JSON.parse((0, import_node_fs4.readFileSync)(firebaseJsonPath, "utf-8"));
|
|
3471
|
+
const changes = [];
|
|
3466
3472
|
if (!config.functions) {
|
|
3467
3473
|
config.functions = {
|
|
3468
3474
|
source: "functions",
|
|
3469
3475
|
runtime: "nodejs20",
|
|
3470
3476
|
codebase: "clawfire"
|
|
3471
3477
|
};
|
|
3478
|
+
changes.push("Added functions config");
|
|
3479
|
+
}
|
|
3480
|
+
if (config.hosting && !config.hosting.cleanUrls) {
|
|
3481
|
+
config.hosting.cleanUrls = true;
|
|
3482
|
+
changes.push("Added cleanUrls");
|
|
3483
|
+
}
|
|
3484
|
+
if (config.hosting) {
|
|
3485
|
+
if (!config.hosting.rewrites) {
|
|
3486
|
+
config.hosting.rewrites = [];
|
|
3487
|
+
}
|
|
3488
|
+
const rewrites = config.hosting.rewrites;
|
|
3489
|
+
const hasApiRewrite = rewrites.some(
|
|
3490
|
+
(r) => r.source === "/api/**" && r.function === "api"
|
|
3491
|
+
);
|
|
3492
|
+
if (!hasApiRewrite) {
|
|
3493
|
+
const apiRewrite = { source: "/api/**", function: "api" };
|
|
3494
|
+
const catchAllIndex = rewrites.findIndex((r) => r.source === "**");
|
|
3495
|
+
if (catchAllIndex >= 0) {
|
|
3496
|
+
rewrites.splice(catchAllIndex, 0, apiRewrite);
|
|
3497
|
+
} else {
|
|
3498
|
+
rewrites.push(apiRewrite);
|
|
3499
|
+
rewrites.push({ source: "**", destination: "/index.html" });
|
|
3500
|
+
}
|
|
3501
|
+
changes.push("Added API rewrite (/api/** \u2192 Cloud Function)");
|
|
3502
|
+
}
|
|
3503
|
+
}
|
|
3504
|
+
if (changes.length > 0) {
|
|
3472
3505
|
(0, import_node_fs4.writeFileSync)(firebaseJsonPath, JSON.stringify(config, null, 2) + "\n", "utf-8");
|
|
3473
|
-
return { success: true, message: "Functions config added to firebase.json." };
|
|
3474
3506
|
}
|
|
3475
|
-
return {
|
|
3507
|
+
return {
|
|
3508
|
+
success: true,
|
|
3509
|
+
message: changes.length > 0 ? changes.join(", ") : "Deploy config up to date.",
|
|
3510
|
+
changes
|
|
3511
|
+
};
|
|
3476
3512
|
} catch {
|
|
3477
|
-
return { success: false, message: "Invalid firebase.json." };
|
|
3513
|
+
return { success: false, message: "Invalid firebase.json.", changes: [] };
|
|
3478
3514
|
}
|
|
3479
3515
|
}
|
|
3480
3516
|
/**
|
|
@@ -4955,6 +4991,13 @@ ${liveReloadScript}
|
|
|
4955
4991
|
}
|
|
4956
4992
|
}
|
|
4957
4993
|
}
|
|
4994
|
+
const deployConfig = this.firebaseSetup.ensureDeployConfig();
|
|
4995
|
+
if (deployConfig.success && deployConfig.changes.length > 0) {
|
|
4996
|
+
for (const change of deployConfig.changes) {
|
|
4997
|
+
console.log(` \x1B[32m\u2713\x1B[0m firebase.json: ${change}`);
|
|
4998
|
+
}
|
|
4999
|
+
steps.push(`firebase.json updated (${deployConfig.changes.length} fixes)`);
|
|
5000
|
+
}
|
|
4958
5001
|
let deployFunctions = false;
|
|
4959
5002
|
if (hasFunctions) {
|
|
4960
5003
|
const syncResult = this.firebaseSetup.syncEnvToFunctions(firebaseConfig);
|
|
@@ -4964,10 +5007,6 @@ ${liveReloadScript}
|
|
|
4964
5007
|
} else {
|
|
4965
5008
|
console.log(` \x1B[33m\u26A0\x1B[0m Env sync: ${syncResult.message}`);
|
|
4966
5009
|
}
|
|
4967
|
-
const configResult = this.firebaseSetup.ensureFunctionsConfig();
|
|
4968
|
-
if (configResult.success) {
|
|
4969
|
-
console.log(` \x1B[32m\u2713\x1B[0m ${configResult.message}`);
|
|
4970
|
-
}
|
|
4971
5010
|
console.log(" Building functions...");
|
|
4972
5011
|
const buildResult = await this.firebaseSetup.buildFunctions();
|
|
4973
5012
|
if (buildResult.success) {
|