Files
BrowserOS/scripts/build/server/cli.ts
Nikhil 9fdb361d67 feat: build prod server resource artifact pipeline (#417)
* feat: build prod server resource artifacts with cloudflare r2

* fix: address PR review comments for prod_server_resources_cloudflare

* feat: fix prod server build setup and CLI ergonomics

* fix: prevent build env secret inlining and template fallback

* fix: read from fileenv

* feat: add ripgrep

* feat: upload prod artifacts to latest and version prefixes
2026-03-05 14:26:46 -08:00

37 lines
1002 B
TypeScript

import { Command } from 'commander'
import { resolveTargets } from './targets'
import type { BuildArgs } from './types'
const DEFAULT_MANIFEST_PATH = 'scripts/build/config/server-prod-resources.json'
export function parseBuildArgs(argv: string[]): BuildArgs {
const program = new Command()
program
.allowUnknownOption(false)
.allowExcessArguments(false)
.exitOverride((error) => {
throw new Error(error.message)
})
.option('--target <targets>', 'Build target ids or "all"', 'all')
.option(
'--manifest <path>',
'Resource manifest path',
DEFAULT_MANIFEST_PATH,
)
.option('--upload', 'Upload artifact zips to R2')
.option('--no-upload', 'Skip zip upload to R2')
program.parse(argv, { from: 'user' })
const options = program.opts<{
target: string
manifest: string
upload: boolean
}>()
return {
targets: resolveTargets(options.target),
manifestPath: options.manifest,
upload: options.upload ?? true,
}
}