Files
BrowserOS/packages/browseros-agent/scripts/build/server/cli.ts
Nikhil af65bdbcfb feat(build): add build:server:ci script with --compile-only flag (#567)
Add a compile-only mode to the server build pipeline for CI/CD
environments that don't have R2 credentials. The --compile-only flag
skips resource staging and upload, producing only compiled binaries.
2026-03-26 11:21:39 -07:00

45 lines
1.2 KiB
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')
.option(
'--compile-only',
'Compile binaries only (skip R2 staging and upload)',
)
program.parse(argv, { from: 'user' })
const options = program.opts<{
target: string
manifest: string
upload: boolean
compileOnly: boolean
}>()
const compileOnly = options.compileOnly ?? false
return {
targets: resolveTargets(options.target),
manifestPath: options.manifest,
upload: compileOnly ? false : (options.upload ?? true),
compileOnly,
}
}