()
| 9 | import { resolveWorkingDir } from './util/resolve-working-dir'; |
| 10 | |
| 11 | export async function getMakeOptions(): Promise<MakeOptions> { |
| 12 | let workingDir: string; |
| 13 | program |
| 14 | .version( |
| 15 | packageJSON.version, |
| 16 | '-V, --version', |
| 17 | 'Output the current version.', |
| 18 | ) |
| 19 | .helpOption('-h, --help', 'Output usage information.') |
| 20 | .argument( |
| 21 | '[dir]', |
| 22 | 'Directory to run the command in. (default: current directory)', |
| 23 | ) |
| 24 | .option( |
| 25 | '--skip-package', |
| 26 | `Skip packaging the Electron application, and use the output from a previous ${chalk.green('package')} run instead.`, |
| 27 | ) |
| 28 | .option('-a, --arch [arch]', 'Target build architecture.', process.arch) |
| 29 | .option( |
| 30 | '-p, --platform [platform]', |
| 31 | 'Target build platform.', |
| 32 | process.platform, |
| 33 | ) |
| 34 | .option( |
| 35 | '--targets [targets]', |
| 36 | `Override your ${chalk.green('make')} targets for this run.`, |
| 37 | ) |
| 38 | .allowUnknownOption(true) |
| 39 | .action((dir) => { |
| 40 | workingDir = resolveWorkingDir(dir, false); |
| 41 | }) |
| 42 | .parse(process.argv); |
| 43 | |
| 44 | const options = program.opts(); |
| 45 | |
| 46 | const makeOpts: MakeOptions = { |
| 47 | dir: workingDir!, |
| 48 | interactive: true, |
| 49 | skipPackage: options.skipPackage, |
| 50 | }; |
| 51 | if (options.targets) makeOpts.overrideTargets = options.targets.split(','); |
| 52 | if (options.arch) makeOpts.arch = options.arch; |
| 53 | if (options.platform) makeOpts.platform = options.platform; |
| 54 | |
| 55 | return makeOpts; |
| 56 | } |
| 57 | |
| 58 | if (require.main === module) { |
| 59 | (async () => { |
no test coverage detected