@@ -134,6 +134,11 @@ export abstract class CapacitorCommand extends Command {
134134 }
135135 } ) ;
136136
137+ isCorePlatform ( platform : string ) : boolean {
138+ const platforms = [ 'android' , 'ios' ] ;
139+ return platforms . includes ( platform ) ;
140+ }
141+
137142 async getInstalledPlatforms ( ) : Promise < string [ ] > {
138143 const cli = await this . getCapacitorCLIConfig ( ) ;
139144 const androidPlatformDirAbs = cli ?. android . platformDirAbs ?? path . resolve ( this . integration . root , 'android' ) ;
@@ -148,6 +153,10 @@ export abstract class CapacitorCommand extends Command {
148153 platforms . push ( 'ios' ) ;
149154 }
150155
156+ if ( await pathExists ( path . resolve ( this . integration . root , 'electron' ) ) ) {
157+ platforms . push ( 'electron' ) ;
158+ }
159+
151160 return platforms ;
152161 }
153162
@@ -297,8 +306,10 @@ export abstract class CapacitorCommand extends Command {
297306 }
298307
299308 if ( semver . gte ( version , '3.0.0-alpha.1' ) ) {
300- const [ manager , ...managerArgs ] = await pkgManagerArgs ( this . env . config . get ( 'npmClient' ) , { command : 'install' , pkg : `@capacitor/${ platform } @${ version } ` , saveDev : false } ) ;
301- await this . env . shell . run ( manager , managerArgs , { cwd : this . integration . root } ) ;
309+ if ( this . isCorePlatform ( platform ) ) {
310+ const [ manager , ...managerArgs ] = await pkgManagerArgs ( this . env . config . get ( 'npmClient' ) , { command : 'install' , pkg : `@capacitor/${ platform } @${ version } ` , saveDev : false } ) ;
311+ await this . env . shell . run ( manager , managerArgs , { cwd : this . integration . root } ) ;
312+ }
302313 }
303314
304315 await this . runCapacitor ( [ 'add' , platform ] ) ;
0 commit comments