Skip to content

Commit

Permalink
feat(runner): support inline option '--disable-electron-build'
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcherGu committed Jun 15, 2023
1 parent e2a81a2 commit dfb401f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions packages/runner/src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ interface CliOptions {
root?: string
filter?: string // string,string,string...
only?: string // string,string,string...
disableElectronBuild?: boolean
}

// run
Expand All @@ -18,6 +19,7 @@ cli
.option('--root <path>', 'Project root directory')
.option('--filter <names>', 'Filter running names')
.option('--only <names>', 'Only run special names')
.option('--disable-electron-build', 'Disable electron build')
.action(async (command: string, options: CliOptions) => {
const logger = createLogger()
if (!command) {
Expand All @@ -34,6 +36,7 @@ cli
root: options.root,
filter: options.filter?.split(','),
only: options.only?.split(','),
disableElectronBuild: options.disableElectronBuild,
})
}
catch (e) {
Expand Down
15 changes: 12 additions & 3 deletions packages/runner/src/config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import path from 'path'
import path from 'node:path'
import JoyCon from 'joycon'
import { bundleRequire } from 'bundle-require'
import type { Configuration as ElectronBuilderConfiguration } from 'electron-builder'
Expand Down Expand Up @@ -76,7 +76,13 @@ export interface DoubleShotRunnerConfig {
electronBuild?: ElectronBuildConfig
}

export interface InlineConfig extends Pick<DoubleShotRunnerConfig, 'root' | 'filter' | 'only'> { }
export interface InlineConfig extends Pick<DoubleShotRunnerConfig, 'root' | 'filter' | 'only'> {
/**
* Disable electron-builder
* @default false
*/
disableElectronBuild?: boolean
}

export type ResolvedConfig = Readonly<{
configFile: string | undefined
Expand Down Expand Up @@ -135,7 +141,10 @@ export async function resolveConfig(inlineConfig: InlineConfig): Promise<Resolve
root: inlineConfig.root || config.root || cwd,
configFile: configPath,
run: resolvedRunConfig,
electronBuild: resolvedElectronBuildConfig,
electronBuild: {
...resolvedElectronBuildConfig,
disabled: inlineConfig.disableElectronBuild || resolvedElectronBuildConfig.disabled,
},
}
}
else {
Expand Down

0 comments on commit dfb401f

Please sign in to comment.