mirror of
https://github.com/browseros-ai/BrowserOS.git
synced 2026-05-13 15:46:22 +00:00
The --compile-only and --ci flags served overlapping purposes for CI builds. Remove --compile-only entirely since --ci already handles the CI use case (skip R2, skip prod env validation, local zip packaging) and --no-upload covers the upload-skipping use case for full builds.
48 lines
1.3 KiB
TypeScript
48 lines
1.3 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(
|
|
'--ci',
|
|
'Build local release zip artifacts for CI without R2 and without requiring production env secrets',
|
|
)
|
|
program.parse(argv, { from: 'user' })
|
|
const options = program.opts<{
|
|
target: string
|
|
manifest: string
|
|
upload: boolean
|
|
ci: boolean
|
|
}>()
|
|
|
|
const ci = options.ci ?? false
|
|
if (ci && options.upload) {
|
|
throw new Error('--ci cannot be combined with --upload')
|
|
}
|
|
|
|
return {
|
|
targets: resolveTargets(options.target),
|
|
manifestPath: options.manifest,
|
|
upload: ci ? false : (options.upload ?? true),
|
|
ci,
|
|
}
|
|
}
|