@montytools/cli 0.2.2 → 0.2.4

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/bin/monty.mjs +24 -9
  2. package/package.json +1 -1
package/bin/monty.mjs CHANGED
@@ -565,7 +565,7 @@ async function dev() {
565
565
  }
566
566
  }
567
567
  await heartbeat(originUrl);
568
- console.log(`workspace: ${host}/apps/${meta.slug} — DEV mode for admins while this runs; click Publish there to ship`);
568
+ console.log(`studio: ${host}/studio/${meta.slug} — your app is live there while this runs; click Publish to ship`);
569
569
  hbTimer = setInterval(() => void heartbeat(originUrl), 30_000);
570
570
  }
571
571
 
@@ -596,16 +596,31 @@ async function dev() {
596
596
  // the origin before it resolves would make admins' browsers cache NXDOMAIN
597
597
  // (macOS negative cache ≈ 30 min of a broken iframe) — so gate on DNS via
598
598
  // DoH, which never touches the local resolver.
599
+ async function resolvesVia(dohBase, hostname) {
600
+ try {
601
+ const r = await fetch(`${dohBase}?name=${hostname}&type=A`, {
602
+ headers: { accept: "application/dns-json" },
603
+ });
604
+ const d = await r.json();
605
+ return Array.isArray(d.Answer) && d.Answer.some((a) => a.type === 1);
606
+ } catch {
607
+ return false;
608
+ }
609
+ }
610
+
599
611
  async function waitForDns(hostname) {
612
+ // Confirm on TWO independent public resolvers, then hold a grace period so
613
+ // slower home/ISP resolver chains catch up — an admin's browser asking one
614
+ // beat too early caches NXDOMAIN for a long time (macOS ≈ 30 min).
600
615
  for (let i = 0; i < 36; i++) {
601
- try {
602
- const r = await fetch(
603
- `https://cloudflare-dns.com/dns-query?name=${hostname}&type=A`,
604
- { headers: { accept: "application/dns-json" } },
605
- );
606
- const d = await r.json();
607
- if (Array.isArray(d.Answer) && d.Answer.some((a) => a.type === 1)) return true;
608
- } catch { /* transient — retry */ }
616
+ const [cf, goog] = await Promise.all([
617
+ resolvesVia("https://cloudflare-dns.com/dns-query", hostname),
618
+ resolvesVia("https://dns.google/resolve", hostname),
619
+ ]);
620
+ if (cf && goog) {
621
+ await new Promise((res) => setTimeout(res, 10_000));
622
+ return true;
623
+ }
609
624
  await new Promise((res) => setTimeout(res, 5000));
610
625
  }
611
626
  return false;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@montytools/cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "monty": "./bin/monty.mjs"