clawfire 0.6.13 → 0.6.15

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/dev.js CHANGED
@@ -1830,6 +1830,24 @@ function generateDashboardHtml(options) {
1830
1830
  <div style="font-size:11px;color:#a3a3a3;margin-bottom:4px;">Live URL</div>
1831
1831
  <a id="deploy-hosting-link" href="#" target="_blank" style="color:#22c55e;font-family:monospace;font-size:14px;text-decoration:none;word-break:break-all;"></a>
1832
1832
  </div>
1833
+ <div id="deploy-billing-note" style="display:none;margin-top:10px;padding:14px;border-radius:8px;background:#1a1400;border:1px solid #f59e0b;">
1834
+ <div style="display:flex;align-items:center;gap:6px;margin-bottom:8px;">
1835
+ <span style="font-size:16px;">&#9888;&#65039;</span>
1836
+ <span style="font-weight:700;color:#fbbf24;font-size:14px;">Blaze Plan Required for API</span>
1837
+ </div>
1838
+ <div style="font-size:13px;color:#d4d4d4;line-height:1.6;">
1839
+ <div style="margin-bottom:6px;"><strong style="color:#fbbf24;">Current Plan:</strong> <span style="color:#ef4444;">Spark (Free)</span></div>
1840
+ <div style="margin-bottom:6px;"><strong style="color:#fbbf24;">Required Plan:</strong> <span style="color:#22c55e;">Blaze (Pay-as-you-go)</span></div>
1841
+ <div style="margin-bottom:10px;color:#a3a3a3;font-size:12px;">
1842
+ Static pages (HTML/CSS/JS) are deployed and live.<br>
1843
+ API routes (<code style="background:#2a2a2a;padding:2px 6px;border-radius:3px;color:#f97316;">/api/*</code>) require Cloud Functions, which need the Blaze plan.<br>
1844
+ Blaze plan has a generous free tier \u2014 you only pay for usage beyond free limits.
1845
+ </div>
1846
+ <a id="deploy-upgrade-link" href="#" target="_blank" style="display:inline-block;padding:8px 16px;background:#f59e0b;color:#000;border-radius:6px;font-size:13px;font-weight:700;text-decoration:none;">
1847
+ Upgrade to Blaze Plan &#8594;
1848
+ </a>
1849
+ </div>
1850
+ </div>
1833
1851
  </div>
1834
1852
  </div>
1835
1853
  </div>
@@ -2710,11 +2728,13 @@ function generateDashboardHtml(options) {
2710
2728
  var btn = document.getElementById('deploy-hosting-btn');
2711
2729
  var status = document.getElementById('deploy-hosting-status');
2712
2730
  var urlBox = document.getElementById('deploy-hosting-url');
2731
+ var billingNote = document.getElementById('deploy-billing-note');
2713
2732
  btn.disabled = true;
2714
2733
  btn.textContent = 'Deploying...';
2715
- status.textContent = 'Deploying to Firebase Hosting... This may take up to 2 minutes.';
2734
+ status.textContent = 'Deploying to Firebase Hosting... This may take up to 3 minutes.';
2716
2735
  status.style.cssText = 'display:block;margin-top:10px;font-size:13px;padding:10px 14px;border-radius:6px;background:#0a0a1a;border:1px solid #3b82f6;color:#3b82f6;';
2717
2736
  urlBox.style.display = 'none';
2737
+ billingNote.style.display = 'none';
2718
2738
 
2719
2739
  fetch(API + '/__dev/deploy/hosting', { method: 'POST' })
2720
2740
  .then(function(r) { return r.json(); })
@@ -2728,9 +2748,21 @@ function generateDashboardHtml(options) {
2728
2748
  link.textContent = data.url;
2729
2749
  urlBox.style.display = 'block';
2730
2750
  }
2751
+ // Show Blaze plan notice when functions deploy failed
2752
+ if (data.blazeRequired) {
2753
+ billingNote.style.display = 'block';
2754
+ if (data.upgradeUrl) {
2755
+ document.getElementById('deploy-upgrade-link').href = data.upgradeUrl;
2756
+ }
2757
+ }
2731
2758
  } else {
2732
2759
  status.textContent = data.message;
2733
2760
  status.style.cssText = 'display:block;margin-top:10px;font-size:13px;padding:10px 14px;border-radius:6px;background:#1c0808;border:1px solid #ef4444;color:#ef4444;';
2761
+ // Also check if error is billing-related
2762
+ var errMsg = (data.message || '').toLowerCase();
2763
+ if (errMsg.indexOf('blaze') >= 0 || errMsg.indexOf('pay-as-you-go') >= 0 || errMsg.indexOf('upgrade') >= 0 || errMsg.indexOf('artifactregistry') >= 0) {
2764
+ billingNote.style.display = 'block';
2765
+ }
2734
2766
  }
2735
2767
  btn.disabled = false;
2736
2768
  btn.textContent = 'Deploy Hosting';
@@ -3761,7 +3793,8 @@ https://console.developers.google.com/apis/api/firestore.googleapis.com/overview
3761
3793
  return new Promise((resolve7, reject) => {
3762
3794
  const proc = execFile2(command, args, { cwd: cwd || this.projectDir, timeout: timeoutMs }, (err, stdout, stderr) => {
3763
3795
  if (err) {
3764
- const detail = stderr?.trim() || stdout?.trim() || "";
3796
+ const parts = [stderr?.trim(), stdout?.trim()].filter(Boolean);
3797
+ const detail = parts.join("\n");
3765
3798
  const enriched = new Error(`${err.message}${detail ? "\n" + detail : ""}`);
3766
3799
  reject(enriched);
3767
3800
  } else {
@@ -4978,22 +5011,42 @@ ${liveReloadScript}
4978
5011
  steps.push("Functions build failed \u2014 hosting only");
4979
5012
  }
4980
5013
  }
4981
- let targets = deployFunctions ? "hosting,functions" : "hosting";
4982
- console.log(` Deploying ${targets}...`);
4983
- let result = await this.firebaseSetup.deployHosting(targets);
4984
- if (!result.success && deployFunctions) {
4985
- const msg = result.message.toLowerCase();
4986
- if (msg.includes("blaze") || msg.includes("pay-as-you-go") || msg.includes("upgrade") || msg.includes("billing") || msg.includes("artifactregistry")) {
4987
- console.log(" \x1B[33m\u26A0\x1B[0m Functions require Blaze plan. Deploying hosting only...");
4988
- steps.push("Functions skipped (requires Blaze plan)");
4989
- targets = "hosting";
4990
- result = await this.firebaseSetup.deployHosting(targets);
5014
+ console.log(" Deploying hosting...");
5015
+ const hostingResult = await this.firebaseSetup.deployHosting("hosting");
5016
+ if (!hostingResult.success) {
5017
+ clearFirebaseStatusCache();
5018
+ sendJson({
5019
+ ...hostingResult,
5020
+ message: hostingResult.message + (steps.length > 0 ? ` (${steps.join(", ")})` : "")
5021
+ });
5022
+ return;
5023
+ }
5024
+ steps.push("Hosting deployed");
5025
+ let blazeRequired = false;
5026
+ if (deployFunctions) {
5027
+ console.log(" Deploying functions...");
5028
+ const funcResult = await this.firebaseSetup.deployHosting("functions");
5029
+ if (funcResult.success) {
5030
+ console.log(" \x1B[32m\u2713\x1B[0m Functions deployed");
5031
+ steps.push("Functions deployed");
5032
+ } else {
5033
+ blazeRequired = true;
5034
+ console.log(" \x1B[33m\u26A0\x1B[0m Functions deploy failed (Blaze plan likely required)");
5035
+ steps.push("Functions skipped (Blaze plan required)");
4991
5036
  }
4992
5037
  }
4993
5038
  clearFirebaseStatusCache();
5039
+ const state = this.firebaseSetup.loadState();
5040
+ const projectId = state.projectId || firebaseConfig.projectId || "";
5041
+ const upgradeUrl = projectId ? `https://console.firebase.google.com/project/${projectId}/usage/details` : "https://console.firebase.google.com";
5042
+ const stepsStr = steps.length > 0 ? ` (${steps.join(", ")})` : "";
4994
5043
  sendJson({
4995
- ...result,
4996
- message: result.message + (steps.length > 0 ? ` (${steps.join(", ")})` : "")
5044
+ success: true,
5045
+ url: hostingResult.url,
5046
+ blazeRequired,
5047
+ upgradeUrl: blazeRequired ? upgradeUrl : void 0,
5048
+ message: `Hosting deployed successfully!${stepsStr}`,
5049
+ billingNote: blazeRequired ? `Static pages are live! But API routes (/api/*) need Cloud Functions, which require the Blaze (pay-as-you-go) plan. Upgrade: ${upgradeUrl}` : void 0
4997
5050
  });
4998
5051
  } catch (err) {
4999
5052
  sendJson({ success: false, message: err instanceof Error ? err.message : "Failed" }, 500);