Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 0a951783f3bacb96c122bd5627ea59be64b53869
parent af8948946c67afbf8f6e10f11f40b81445d4b315
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Tue,  6 Oct 2026 12:30:58 -0400

cli: deploy hub / deploy homepage are aliases of publish hub|homepage --deploy-only (through the deploy stage)

The two legacy rows called build.ts's deployHub / deployHomepage, which ship
from export/out and record nothing. They now print their alias and run the
deploy stage over the target's bundle, like `deploy site` (S2 review I2).

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

Diffstat:
Mcommon/bin/_cli.test.ts | 10+++++++++-
Mcommon/bin/archilyzer.ts | 52++++++++++++++++------------------------------------
Mcommon/bin/publish.ts | 54+++++++++++++++++++++++++++++++++++++++++++-----------
3 files changed, 68 insertions(+), 48 deletions(-)

diff --git a/common/bin/_cli.test.ts b/common/bin/_cli.test.ts @@ -439,9 +439,15 @@ test("the publish rows and their flags (status and now are S3's)", () => { assert.deepEqual(row("publish", "build", "jer")?.flags, { runner: "string", force: "boolean", "skip-archives": "boolean" }); assert.equal(row("publish", "build", "all")?.maxPositionals, 1); assert.deepEqual(row("publish", "deploy", "all")?.flags, { preview: "string", to: "string", force: "boolean" }); - assert.deepEqual(row("publish", "hub")?.flags, { deploy: "boolean", preview: "string", force: "boolean" }); + assert.deepEqual(row("publish", "hub")?.flags, { + deploy: "boolean", + "deploy-only": "boolean", + preview: "string", + force: "boolean", + }); assert.deepEqual(row("publish", "homepage")?.flags, { deploy: "boolean", + "deploy-only": "boolean", preview: "string", to: "string", force: "boolean", @@ -464,6 +470,8 @@ test("build site, build all and deploy site are printed aliases of the publish r assert.equal(ALIASES.buildSite("jer", true), "archilyzer publish build jer --force", "--nodata skips the index"); assert.equal(ALIASES.buildAll, "archilyzer publish index && archilyzer publish build all --runner auto"); assert.equal(ALIASES.deploySite("jer"), "archilyzer publish deploy jer"); + assert.equal(ALIASES.deployHub(), "archilyzer publish hub --deploy-only"); + assert.equal(ALIASES.deployHomepage("r18"), "archilyzer publish homepage --deploy-only --preview r18"); assert.equal(ALIASES.deploySite("jer", "r18"), "archilyzer publish deploy jer --preview r18"); const row = (...p: string[]) => resolveCommand(COMMANDS, p)!.command; // Same flags as ever: a script that called them still parses. diff --git a/common/bin/archilyzer.ts b/common/bin/archilyzer.ts @@ -128,11 +128,12 @@ export const COMMANDS: Command[] = [ { path: ["publish", "hub"], usage: - "[--deploy] [--preview <branch>] [--force] build the hub into its bundle <exportBuildsDir>/_hub/out, then (--deploy) ship it", - flags: { deploy: "boolean", preview: "string", force: "boolean" }, + "[--deploy | --deploy-only] [--preview <branch>] [--force] build the hub into its bundle <exportBuildsDir>/_hub/out, then (--deploy) ship it; --deploy-only ships the bundle as built", + flags: { deploy: "boolean", "deploy-only": "boolean", preview: "string", force: "boolean" }, run: async ({ flags }) => (await import("./publish")).publishHub({ deploy: flags.deploy === true, + deployOnly: flags["deploy-only"] === true, preview: typeof flags.preview === "string" ? flags.preview : undefined, force: flags.force === true, }), @@ -140,8 +141,8 @@ export const COMMANDS: Command[] = [ { path: ["publish", "homepage"], usage: - "[--deploy] [--preview <branch>] [--to local] [--force] build homepage/out (source mirror included), then (--deploy) ship it", - flags: { deploy: "boolean", preview: "string", to: "string", force: "boolean" }, + "[--deploy | --deploy-only] [--preview <branch>] [--to local] [--force] build homepage/out (source mirror included), then (--deploy) ship it; --deploy-only ships it as built", + flags: { deploy: "boolean", "deploy-only": "boolean", preview: "string", to: "string", force: "boolean" }, run: async ({ flags }) => { const to = flags.to; if (to !== undefined && to !== "pages" && to !== "local") { @@ -150,6 +151,7 @@ export const COMMANDS: Command[] = [ } return (await import("./publish")).publishHomepage({ deploy: flags.deploy === true, + deployOnly: flags["deploy-only"] === true, preview: typeof flags.preview === "string" ? flags.preview : undefined, to: to as "pages" | "local" | undefined, force: flags.force === true, @@ -364,32 +366,22 @@ export const COMMANDS: Command[] = [ { path: ["deploy", "hub"], usage: - "[--preview <branch>] ship the hub built in export/out to homepage.json's Pages project", + "[--preview <branch>] alias: publish hub --deploy-only [--preview <branch>] — ship the hub's bundle to homepage.json's Pages project", flags: { preview: "string" }, - run: async ({ flags }) => { - const { deployHub } = await import("../publish/build"); - return refusalsExit(() => - deployHub({ - signal: interrupted(), - previewBranch: typeof flags.preview === "string" ? flags.preview : undefined, - }), - ); - }, + run: async ({ flags }) => + (await import("./publish")).deployHubAlias({ + preview: typeof flags.preview === "string" ? flags.preview : undefined, + }), }, { path: ["deploy", "homepage"], usage: - "[--preview <branch>] ship homepage/out to the Pages project archilyzer (production branch main)", + "[--preview <branch>] alias: publish homepage --deploy-only [--preview <branch>] — ship homepage/out to the Pages project archilyzer", flags: { preview: "string" }, - run: async ({ flags }) => { - const { deployHomepage } = await import("../publish/build"); - return refusalsExit(() => - deployHomepage({ - signal: interrupted(), - previewBranch: typeof flags.preview === "string" ? flags.preview : undefined, - }), - ); - }, + run: async ({ flags }) => + (await import("./publish")).deployHomepageAlias({ + preview: typeof flags.preview === "string" ? flags.preview : undefined, + }), }, { path: ["run"], @@ -614,16 +606,4 @@ function interrupted(): AbortSignal { return ac.signal; } -// An entry point that THROWS its refusals and failures (the deploys): the -// sentence goes to stderr and the exit code is 1. -async function refusalsExit(fn: () => Promise<void>): Promise<number> { - try { - await fn(); - return 0; - } catch (err) { - console.error((err as Error).message); - return 1; - } -} - runIfEntryPoint(import.meta.url, () => runCli(COMMANDS, process.argv.slice(2))); diff --git a/common/bin/publish.ts b/common/bin/publish.ts @@ -195,23 +195,37 @@ export async function publishDeploy(a: DeployArgs, out: Out = console): Promise< } export async function publishHub( - a: { deploy?: boolean; preview?: string; force?: boolean; runId?: string; paths?: Paths; signal?: AbortSignal }, + a: { + deploy?: boolean; + // Ship the hub's bundle as it is: no build (`deploy hub`, the old row). + deployOnly?: boolean; + preview?: string; + force?: boolean; + runId?: string; + paths?: Paths; + signal?: AbortSignal; + }, out: Out = console, ): Promise<number> { - if (a.preview && !a.deploy) { + const deploy = a.deploy || a.deployOnly; + if (a.preview && !deploy) { out.error("publish hub: --preview is a deploy — add --deploy"); return STAGE_EXIT.usage; } const signal = a.signal ?? interrupted(); const runId = a.runId ?? cliRunId(); - const built = await run({ kind: "build-hub", target: "_hub", runId, ...(a.force ? { force: true } : {}) }, signal, a.paths); - if (built !== 0 || !a.deploy) return built; + if (!a.deployOnly) { + const built = await run({ kind: "build-hub", target: "_hub", runId, ...(a.force ? { force: true } : {}) }, signal, a.paths); + if (built !== 0 || !deploy) return built; + } return run({ kind: "deploy-hub", target: "_hub", runId, ...(a.preview ? { preview: a.preview } : {}) }, signal, a.paths); } export async function publishHomepage( a: { deploy?: boolean; + // Ship homepage/out as it is: no build (`deploy homepage`, the old row). + deployOnly?: boolean; preview?: string; to?: "pages" | "local"; force?: boolean; @@ -221,18 +235,21 @@ export async function publishHomepage( }, out: Out = console, ): Promise<number> { - if ((a.preview || a.to) && !a.deploy) { + const deploy = a.deploy || a.deployOnly; + if ((a.preview || a.to) && !deploy) { out.error("publish homepage: --preview and --to are a deploy's — add --deploy"); return STAGE_EXIT.usage; } const signal = a.signal ?? interrupted(); const runId = a.runId ?? cliRunId(); - const built = await run( - { kind: "build-homepage", target: "_homepage", runId, ...(a.force ? { force: true } : {}) }, - signal, - a.paths, - ); - if (built !== 0 || !a.deploy) return built; + if (!a.deployOnly) { + const built = await run( + { kind: "build-homepage", target: "_homepage", runId, ...(a.force ? { force: true } : {}) }, + signal, + a.paths, + ); + if (built !== 0 || !deploy) return built; + } return run( { kind: "deploy-homepage", @@ -254,6 +271,9 @@ export const ALIASES = { buildAll: "archilyzer publish index && archilyzer publish build all --runner auto", deploySite: (id: string, preview?: string) => `archilyzer publish deploy ${id}${preview ? ` --preview ${preview}` : ""}`, + deployHub: (preview?: string) => `archilyzer publish hub --deploy-only${preview ? ` --preview ${preview}` : ""}`, + deployHomepage: (preview?: string) => + `archilyzer publish homepage --deploy-only${preview ? ` --preview ${preview}` : ""}`, } as const; /** `build site <id> [--nodata]` = `publish index` (skipped by --nodata) + `publish build <id> --force`. */ @@ -297,3 +317,15 @@ export async function deploySiteAlias( out.log(`[alias] deploy site is now: ${ALIASES.deploySite(a.siteId, a.preview)}`); return publishDeploy({ target: a.siteId, preview: a.preview }, out); } + +/** `deploy hub` = `publish hub --deploy-only` (the hub's bundle, as built). */ +export async function deployHubAlias(a: { preview?: string }, out: Out = console): Promise<number> { + out.log(`[alias] deploy hub is now: ${ALIASES.deployHub(a.preview)}`); + return publishHub({ deployOnly: true, preview: a.preview }, out); +} + +/** `deploy homepage` = `publish homepage --deploy-only` (homepage/out, as built). */ +export async function deployHomepageAlias(a: { preview?: string }, out: Out = console): Promise<number> { + out.log(`[alias] deploy homepage is now: ${ALIASES.deployHomepage(a.preview)}`); + return publishHomepage({ deployOnly: true, preview: a.preview }, out); +}