diff --git a/packages/@ionic/cli/src/commands/capacitor/build.ts b/packages/@ionic/cli/src/commands/capacitor/build.ts index fce55ce540..a8349d3fcf 100644 --- a/packages/@ionic/cli/src/commands/capacitor/build.ts +++ b/packages/@ionic/cli/src/commands/capacitor/build.ts @@ -24,6 +24,12 @@ export class BuildCommand extends CapacitorCommand implements CommandPreRun { type: Boolean, default: true, }, + { + name: 'open', + summary: 'Do not invoke Capacitor open', + type: Boolean, + default: true, + }, ]; const footnotes: Footnote[] = [ @@ -121,7 +127,9 @@ To configure your native project, see the common configuration docs[^capacitor-n this.env.log.info(this.getContinueMessage(platform)); this.env.log.nl(); - await this.runCapacitor(['open', platform]); + if (options['open']) { + await this.runCapacitor(['open', platform]); + } } protected getContinueMessage(platform: string): string { diff --git a/packages/@ionic/cli/src/commands/capacitor/run.ts b/packages/@ionic/cli/src/commands/capacitor/run.ts index 98f95e11d6..f7fef8bb2c 100644 --- a/packages/@ionic/cli/src/commands/capacitor/run.ts +++ b/packages/@ionic/cli/src/commands/capacitor/run.ts @@ -30,6 +30,12 @@ export class RunCommand extends CapacitorCommand implements CommandPreRun { type: Boolean, default: true, }, + { + name: 'open', + summary: 'Do not invoke Capacitor open', + type: Boolean, + default: true, + }, ...COMMON_SERVE_COMMAND_OPTIONS.filter(o => !['livereload'].includes(o.name)).map(o => ({ ...o, hint: weak('(--livereload)') })), { name: 'livereload', @@ -157,7 +163,9 @@ For Android and iOS, you can setup Remote Debugging on your device with browser this.env.log.info(this.getContinueMessage(platform)); this.env.log.nl(); - await this.runCapacitor(['open', platform]); + if (options['open']) { + await this.runCapacitor(['open', platform]); + } if (options['livereload']) { this.env.log.nl();