mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-19 19:41:06 +00:00
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.
45 lines
1.2 KiB
TypeScript
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,
|
|
}
|
|
}
|