@lizard-build/cli 0.3.44 → 0.3.45

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.
@@ -1,4 +1,4 @@
1
- export declare const CURRENT_VERSION = "0.3.44";
1
+ export declare const CURRENT_VERSION = "0.3.45";
2
2
  /**
3
3
  * True only when running as the Bun-compiled standalone binary. Under
4
4
  * npm/node, `process.execPath` is the *node* executable — self-update would
@@ -4,7 +4,7 @@ import { Readable } from "node:stream";
4
4
  import { join, dirname } from "node:path";
5
5
  import os from "node:os";
6
6
  import { spawn } from "node:child_process";
7
- export const CURRENT_VERSION = "0.3.44";
7
+ export const CURRENT_VERSION = "0.3.45";
8
8
  const RELEASES_API = "https://api.github.com/repos/lizard-build/lizard-cli/releases/latest";
9
9
  const RELEASE_BASE = "https://github.com/lizard-build/lizard-cli/releases/latest/download";
10
10
  /** Minimum gap between background update checks. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lizard-build/cli",
3
- "version": "0.3.44",
3
+ "version": "0.3.45",
4
4
  "description": "Lizard CLI — deploy and manage apps on Lizard",
5
5
  "type": "module",
6
6
  "bin": {
@@ -5,7 +5,7 @@ import { join, dirname } from "node:path";
5
5
  import os from "node:os";
6
6
  import { spawn } from "node:child_process";
7
7
 
8
- export const CURRENT_VERSION = "0.3.44";
8
+ export const CURRENT_VERSION = "0.3.45";
9
9
  const RELEASES_API = "https://api.github.com/repos/lizard-build/lizard-cli/releases/latest";
10
10
  const RELEASE_BASE = "https://github.com/lizard-build/lizard-cli/releases/latest/download";
11
11
 
package/test/cli.test.ts CHANGED
@@ -6,6 +6,9 @@
6
6
  * - Authed: `lizard login --token <token>` (or any prior session)
7
7
  * - Optionally point at a specific built binary: LIZARD_BIN=./dist/index.js
8
8
  * - Optionally pin a project: LIZARD_TEST_PROJECT_ID=<id>
9
+ * Without the pin only read-only/self-contained tests run; suites that
10
+ * mutate services (deploy, scale) are skipped so they can never touch
11
+ * an arbitrary real project picked from the account.
9
12
  *
10
13
  * Run: npm test
11
14
  *
@@ -258,8 +261,11 @@ describe("ps (service inventory)", () => {
258
261
  });
259
262
 
260
263
  // ── Scale (no-op against existing app) ────────────────────────────────────────
264
+ //
265
+ // Mutates a real app (forces replicas=1) — only safe against a dedicated,
266
+ // explicitly pinned test project.
261
267
 
262
- describe("scale", () => {
268
+ describe.skipIf(!process.env.LIZARD_TEST_PROJECT_ID)("scale", () => {
263
269
  test("scale --replicas succeeds when an app exists", async () => {
264
270
  const services = await cliJSON("ps", "--project", projectId);
265
271
  const apps: Array<{ id: string; name: string }> = services?.apps ?? [];
@@ -284,10 +290,10 @@ describe("domain", () => {
284
290
  console.log(" ⚠ no apps, skipping domain test");
285
291
  return;
286
292
  }
287
- const data = await cliJSON("domain", "--service", apps[0].name, "--project", projectId).catch(
288
- () => [],
289
- );
290
- expect(Array.isArray(data)).toBe(true);
293
+ // `domain` (no subcommand) prints the current domain: { hostname, generated }
294
+ const data = await cliJSON("domain", "--service", apps[0].name, "--project", projectId);
295
+ expect(data).toHaveProperty("hostname");
296
+ expect(typeof data.hostname).toBe("string");
291
297
  });
292
298
  });
293
299
 
@@ -296,23 +302,22 @@ describe("domain", () => {
296
302
  // Heavy test: uploads the fixture as a fresh app, waits for it to come up,
297
303
  // then exercises service-scope secrets against it. Set LIZARD_SKIP_DEPLOY=1
298
304
  // to skip while iterating locally.
305
+ //
306
+ // SAFETY: runs only when LIZARD_TEST_PROJECT_ID explicitly pins a dedicated
307
+ // test project. Without the pin, projectId falls back to an arbitrary real
308
+ // project from the account — deploying into (let alone cleaning up) such a
309
+ // project is never acceptable. The suite must also never mass-delete apps
310
+ // it didn't create: a teardown used to wipe every app in the project and
311
+ // destroyed real services. Cleanup is limited to `createdApps` in afterAll.
299
312
 
300
313
  let DEPLOY_DIR: string | undefined;
301
314
 
302
- describe.skipIf(process.env.LIZARD_SKIP_DEPLOY === "1")("deploy", () => {
315
+ describe.skipIf(
316
+ process.env.LIZARD_SKIP_DEPLOY === "1" || !process.env.LIZARD_TEST_PROJECT_ID,
317
+ )("deploy", () => {
303
318
  const appName = `cli-test-${Date.now()}`;
304
319
  let appId: string;
305
320
 
306
- beforeAll(async () => {
307
- // Tear down any leftover apps in the test project so we deploy clean.
308
- // `service rm` requires --project (after the command, per commander).
309
- const services = await cliJSON("ps", "--project", projectId).catch(() => ({ apps: [] }));
310
- const existing: Array<{ id: string }> = services?.apps ?? [];
311
- for (const app of existing) {
312
- await cli("service", "rm", app.id, "-y", "--project", projectId).catch(() => {});
313
- }
314
- }, 60_000);
315
-
316
321
  test(
317
322
  "deploy local fixture app (detached)",
318
323
  async () => {