Skip to content

Commit bbb70d0

Browse files
phasenullclaude
andcommitted
Declare --no-minify on build, upload and deploy
The parser refuses unknown flags, so --no-minify failed before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent d3aa432 commit bbb70d0

4 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎src/commands/build.ts‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { keepPayload } from "../payloads.ts";
1111
import { fixCensoredName, uploadPayload } from "../upload.ts";
1212
import { channelFlag, openCloud, project, projectStateDir } from "./common.ts";
1313

14-
export const buildFlags = { branch: "string", channel: "string", clean: "boolean" } as const;
14+
export const buildFlags = { branch: "string", channel: "string", clean: "boolean", "no-minify": "boolean" } as const;
1515

1616
export function describeBuild(meta: PayloadMeta): string {
1717
const state = meta.dirty ? "dirty" : "clean";
@@ -39,6 +39,7 @@ export async function buildCommand(args: ParsedArgs) {
3939
}
4040

4141
export const uploadFlags = {
42+
"no-minify": "boolean",
4243
branch: "string",
4344
channel: "string",
4445
"no-build": "boolean",
@@ -55,7 +56,7 @@ export async function uploadCommand(args: ParsedArgs) {
5556
if (flagBool(args, "no-build")) {
5657
({ meta, bytes } = readBuiltPayload(proj.root));
5758
} else {
58-
const built = await watch.stage("build", () => buildPayload(proj, { branch: flagString(args, "branch"), channel: channelFlag(args), clean: true }));
59+
const built = await watch.stage("build", () => buildPayload(proj, { branch: flagString(args, "branch"), channel: channelFlag(args), clean: true, minify: !flagBool(args, "no-minify") }));
5960
meta = built.meta;
6061
bytes = payloadBytes(proj.root);
6162
info(` build ${formatSeconds(watch.timings.build)} ${describeBuild(meta)}`);

‎src/commands/deploy.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ import type { OpenCloud } from "../opencloud.ts";
4949
import type { LiveHead } from "../deployments.ts";
5050

5151
export const deployFlags = {
52+
"no-minify": "boolean",
5253
branch: "string",
5354
channel: "string",
5455
"no-build": "boolean",

‎src/index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ const COMMANDS: Record<string, Command> = {
8989
flags: uploadFlags,
9090
run: uploadCommand,
9191
summary: "build and upload a payload, no deploy",
92-
usage: `typetorch upload [--branch <b>] [--channel prod|dev] [--no-build] [--moderation-timeout <s>]
92+
usage: `typetorch upload [--branch <b>] [--channel prod|dev] [--no-minify] [--no-build] [--moderation-timeout <s>]
9393
9494
Uploads the payload as a NEW private Model asset named tt-<branch>-<commit>[-dirty] and waits for moderation.
9595
Does not touch live servers.`,

‎test/pack.test.ts‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ import { describe, expect, it } from "bun:test";
22
import { existsSync, mkdirSync, mkdtempSync, readFileSync, writeFileSync } from "node:fs";
33
import { tmpdir } from "node:os";
44
import { dirname, join } from "node:path";
5+
import { buildFlags, uploadFlags } from "../src/commands/build.ts";
6+
import { deployFlags } from "../src/commands/deploy.ts";
57
import { darkluaConfig, defineDev, packProject, remapProject, setsDev, shake } from "../src/pack.ts";
68

79
describe("defineDev", () => {
@@ -112,3 +114,9 @@ describe("packProject", () => {
112114
expect(remapProject({ tree: { a: { $path: "./x" } } }, "d").tree.a.$path).toBe("d/x");
113115
});
114116
});
117+
118+
describe("--no-minify", () => {
119+
it("is a known flag wherever a payload is built", () => {
120+
for (const flags of [buildFlags, uploadFlags, deployFlags]) expect((flags as Record<string, string>)["no-minify"]).toBe("boolean");
121+
});
122+
});

0 commit comments

Comments
 (0)