@@ -134,6 +134,11 @@ export abstract class CapacitorCommand extends Command {
134
134
}
135
135
} ) ;
136
136
137
+ isCorePlatform ( platform : string ) : boolean {
138
+ const platforms = [ 'android' , 'ios' ] ;
139
+ return platforms . includes ( platform ) ;
140
+ }
141
+
137
142
async getInstalledPlatforms ( ) : Promise < string [ ] > {
138
143
const cli = await this . getCapacitorCLIConfig ( ) ;
139
144
const androidPlatformDirAbs = cli ?. android . platformDirAbs ?? path . resolve ( this . integration . root , 'android' ) ;
@@ -148,6 +153,10 @@ export abstract class CapacitorCommand extends Command {
148
153
platforms . push ( 'ios' ) ;
149
154
}
150
155
156
+ if ( await pathExists ( path . resolve ( this . integration . root , 'electron' ) ) ) {
157
+ platforms . push ( 'electron' ) ;
158
+ }
159
+
151
160
return platforms ;
152
161
}
153
162
@@ -297,8 +306,10 @@ export abstract class CapacitorCommand extends Command {
297
306
}
298
307
299
308
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
+ }
302
313
}
303
314
304
315
await this . runCapacitor ( [ 'add' , platform ] ) ;
0 commit comments