@ambasada/cli 0.8.13 → 0.8.14

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/dist/ambasada.mjs +12 -10
  2. package/package.json +3 -3
package/dist/ambasada.mjs CHANGED
@@ -2050,7 +2050,7 @@ async function importTs(file) {
2050
2050
  }
2051
2051
  async function loadProject(from) {
2052
2052
  const root = findRoot(from);
2053
- if (!root) throw new CliError(`no ${CONFIG_FILE} here or in a parent folder: run \`ambasada init\` first`);
2053
+ if (!root) throw new CliError(`no app in this folder (no ${CONFIG_FILE} here or above it): make one with \`npm create ambasada@latest <slug>\`, then run this in it`);
2054
2054
  const config = await importTs(join2(root, CONFIG_FILE));
2055
2055
  if (!config || typeof config !== "object" || typeof config.id !== "string") {
2056
2056
  throw new CliError(`${CONFIG_FILE} must \`export default defineApp({ id, name, \u2026 })\``);
@@ -2530,7 +2530,7 @@ import { createRequire } from "node:module";
2530
2530
  import { dirname as dirname2, isAbsolute, join as join4, resolve as resolvePath2 } from "node:path";
2531
2531
  import { pathToFileURL as pathToFileURL2 } from "node:url";
2532
2532
  var PLATFORM_CONFIG_KEYS = ["id", "name", "product", "addons"];
2533
- var VERSION = true ? "0.8.13" : "0.1.0-dev";
2533
+ var VERSION = true ? "0.8.14" : "0.1.0-dev";
2534
2534
  var shortName = (pkg) => pkg.replace(/^@ambasada\//, "").replace(/^ambasada-(addon-)?/, "");
2535
2535
  var KNOWN_ADDONS = { village: "@ambasada/village" };
2536
2536
  function readJson(file) {
@@ -3624,7 +3624,7 @@ import { execFileSync as execFileSync3 } from "node:child_process";
3624
3624
  import { existsSync as existsSync9, readdirSync as readdirSync5, statSync as statSync5 } from "node:fs";
3625
3625
  import { mkdir as mkdir5, readFile as readFile5, rm as rm4, writeFile as writeFile5 } from "node:fs/promises";
3626
3626
  import { join as join10, relative as relative4 } from "node:path";
3627
- var VERSION2 = true ? "0.8.13" : "0.1.0-dev";
3627
+ var VERSION2 = true ? "0.8.14" : "0.1.0-dev";
3628
3628
  var RELEASE_SPEC = /^\d+\.\d+\.\d+$/.test(VERSION2) ? `^${VERSION2}` : "latest";
3629
3629
  var out3 = (s = "") => process.stdout.write(`${s}
3630
3630
  `);
@@ -5063,12 +5063,13 @@ async function tunnel(_args, flags) {
5063
5063
  if (!r.apiKey) throw new CliError("not logged in: run `ambasada login` (or set AMBASADA_API_KEY)");
5064
5064
  const port = await tunnelPort(flags);
5065
5065
  const local = `http://localhost:${port}`;
5066
- try {
5067
- await fetch(local, { signal: AbortSignal.timeout(2e3) });
5068
- } catch {
5069
- out6(c.yellow(`! nothing answers on ${local} yet: start your dev server there (or pass --port)`));
5070
- }
5071
5066
  const root = findRoot();
5067
+ const answers = await fetch(local, { signal: AbortSignal.timeout(2e3) }).then(() => true, () => false);
5068
+ if (!answers) {
5069
+ throw new CliError(
5070
+ root ? `nothing answers on ${local}: \`npx ambasada dev --tunnel\` runs your app and the tunnel together (or pass --port)` : `nothing answers on ${local}, and this folder has no app: make one with \`npm create ambasada@latest ${r.project ?? "<slug>"}\``
5071
+ );
5072
+ }
5072
5073
  if (root && existsSync12(join13(root, ".env")) && /AMBASADA_API_URL=http:\/\/(127\.0\.0\.1|localhost)/.test(await readFile8(join13(root, ".env"), "utf8"))) {
5073
5074
  out6(c.yellow("! your .env points AMBASADA_API_URL at the mock: real buyers' receipts won't verify. `ambasada dev --tunnel` runs your dev server against the village instead"));
5074
5075
  }
@@ -5084,7 +5085,7 @@ async function tunnel(_args, flags) {
5084
5085
  }
5085
5086
 
5086
5087
  // src/commands.ts
5087
- var SDK_VERSION = /^\d+\.\d+\.\d+$/.test("0.8.13") ? `^${"0.8.13"}` : "latest";
5088
+ var SDK_VERSION = /^\d+\.\d+\.\d+$/.test("0.8.14") ? `^${"0.8.14"}` : "latest";
5088
5089
  var DEV_PORT = 8788;
5089
5090
  var out7 = (s = "") => process.stdout.write(`${s}
5090
5091
  `);
@@ -5181,6 +5182,7 @@ async function login(_args, flags) {
5181
5182
  out7(`${c.green("\u2713")} logged in as ${c.bold(who.id)} on ${apiUrl} ${c.dim(`(saved to ${configPath()})`)}`);
5182
5183
  const root = findRoot();
5183
5184
  if (here && root && here !== who.id) await offerBind(root, here, who.id, { flags, unambiguous: chosen && !apps?.[here] });
5185
+ if (!root) out7(` next: \`npm create ambasada@latest ${who.id}\`, then \`npx ambasada deploy\` in that folder`);
5184
5186
  }
5185
5187
  async function offerBind(root, here, app, opts) {
5186
5188
  const deployed = await liveUrl(root);
@@ -5739,7 +5741,7 @@ async function logs(_args, flags) {
5739
5741
  }
5740
5742
 
5741
5743
  // src/main.ts
5742
- var VERSION3 = true ? "0.8.13" : "0.1.0-dev";
5744
+ var VERSION3 = true ? "0.8.14" : "0.1.0-dev";
5743
5745
  var MAJOR_MINOR = VERSION3.split(".").slice(0, 2).join(".");
5744
5746
  var HELP = `${c.bold("ambasada")} ${MAJOR_MINOR}: build and host apps on Ambasada
5745
5747
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ambasada/cli",
3
- "version": "0.8.13",
3
+ "version": "0.8.14",
4
4
  "description": "`ambasada`: build and host apps on Ambasada (init, dev, deploy, tunnel, check, storage); add-ons add their own commands.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -21,8 +21,8 @@
21
21
  "typescript": "~5.9.3",
22
22
  "vitest": "^4.1.12",
23
23
  "wrangler": "^4.156.0",
24
- "@ambasada/sdk": "0.8.13",
25
- "@ambasada/village": "0.8.13",
24
+ "@ambasada/sdk": "0.8.14",
25
+ "@ambasada/village": "0.8.14",
26
26
  "@ambasada/protocol": "0.1.0"
27
27
  },
28
28
  "author": "CENTYSO (https://centyso.com)",