Make bare deploy list the configured deploys

Deploying is opt-in per name; with no names the verb prints each
deploy's buildFile and (subset, cmd) entries instead of shipping
everything.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Christopher Monsanto
2026-08-17 15:52:57 -04:00
parent 167de94fe4
commit 989ffd54ce
2 changed files with 16 additions and 7 deletions

View File

@@ -62,8 +62,8 @@ reuses the build's digests. All state lives in `.build/`.
```
$ pnpm build # build every deploy's rules, GC stale state
$ pnpm deploy # every deploy in deploy.json5
$ node tools/deploy/index.ts deploy assets # one named deploy
$ pnpm deploy # list the deploys in deploy.json5
$ pnpm deploy assets # run a named deploy
$ node tools/deploy/index.ts build ps.build.ts # build one deploy's rules
$ node tools/deploy/index.ts run smogon.build.ts -o deploy/smogon
$ node tools/deploy/index.ts inspect src/minisprites/items/i1.png -o /tmp/out

View File

@@ -175,20 +175,29 @@ common(program.command('build [files...]'))
});
common(program.command('deploy [names...]'))
.description('build, finish, and pipe each subset tar to its command from deploy.json5')
.description('build, finish, and pipe each subset tar to its command from deploy.json5'
+ ' (no names: list the available deploys)')
.action(async (names : string[], opts : CommonOpts) => {
const config = loadDeployConfig('deploy.json5');
const targets = names.length > 0 ? names : [...config.keys()];
for (const name of targets) {
if (names.length === 0) {
for (const [name, target] of config) {
console.log(`${name} (${target.buildFile})`);
for (const entry of target.deploy) {
console.log(` ${entry.subset.join(' ')} | ${entry.cmd}`);
}
}
return;
}
for (const name of names) {
if (!config.has(name)) {
throw new BuildError(`deploy.json5: no deploy named ${name}`);
}
}
setConfig(loadConfig(opts.config));
const files = [...new Set(targets.map(n => config.get(n)!.buildFile))];
const files = [...new Set(names.map(n => config.get(n)!.buildFile))];
const specs = await importDeploys(files);
process.exitCode = await buildThen(getDecls(), opts, false, async () => {
for (const name of targets) {
for (const name of names) {
const target = config.get(name)!;
const aq = await runFinish(finishOf(specs, target.buildFile), Boolean(opts.verbose));
if (aq === null) {