@@ -11,7 +11,8 @@ import {
11
11
promptForPlatform ,
12
12
getPlatformTargetName ,
13
13
} from '../common' ;
14
- import type { AppConfig , Config } from '../definitions' ;
14
+ import { getCordovaPlugins , writeCordovaAndroidManifest } from '../cordova' ;
15
+ import type { Config } from '../definitions' ;
15
16
import { fatal , isFatal } from '../errors' ;
16
17
import { runIOS } from '../ios/run' ;
17
18
import { logger , output } from '../log' ;
@@ -92,44 +93,41 @@ export async function runCommand(
92
93
93
94
try {
94
95
if ( options . sync ) {
95
- if ( options . liveReload ) {
96
- const newExtConfig =
97
- await CapLiveReloadHelper . editExtConfigForLiveReload (
98
- config ,
99
- platformName ,
100
- options ,
101
- ) ;
102
- const cfg : {
103
- - readonly [ K in keyof Config ] : Config [ K ] ;
104
- } = config ;
105
- const cfgapp : {
106
- - readonly [ K in keyof AppConfig ] : AppConfig [ K ] ;
107
- } = config . app ;
108
- cfgapp . extConfig = newExtConfig ;
109
- cfg . app = cfgapp ;
110
- await sync ( cfg , platformName , false , true ) ;
111
- } else {
112
- await sync ( config , platformName , false , true ) ;
113
- }
114
- } else {
115
- if ( options . liveReload ) {
116
- await CapLiveReloadHelper . editCapConfigForLiveReload (
96
+ await sync ( config , platformName , false , true ) ;
97
+ }
98
+ const cordovaPlugins = await getCordovaPlugins ( config , platformName ) ;
99
+ if ( options . liveReload ) {
100
+ await CapLiveReloadHelper . editCapConfigForLiveReload (
101
+ config ,
102
+ platformName ,
103
+ options ,
104
+ ) ;
105
+ if ( platformName === config . android . name ) {
106
+ await await writeCordovaAndroidManifest (
107
+ cordovaPlugins ,
117
108
config ,
118
109
platformName ,
119
- options ,
110
+ true ,
120
111
) ;
121
112
}
122
113
}
123
114
await run ( config , platformName , options ) ;
124
115
if ( options . liveReload ) {
125
- process . on ( 'SIGINT' , async ( ) => {
126
- if ( options . liveReload ) {
116
+ new Promise ( resolve => process . on ( 'SIGINT' , resolve ) )
117
+ . then ( async ( ) => {
127
118
await CapLiveReloadHelper . revertCapConfigForLiveReload ( ) ;
128
- }
129
- process . exit ( ) ;
130
- } ) ;
131
- console . log (
132
- `\nApp running with live reload listing for: http://${ options . host } :${ options . port } . Press Ctrl+C to quit.` ,
119
+ if ( platformName === config . android . name ) {
120
+ await writeCordovaAndroidManifest (
121
+ cordovaPlugins ,
122
+ config ,
123
+ platformName ,
124
+ false ,
125
+ ) ;
126
+ }
127
+ } )
128
+ . then ( ( ) => process . exit ( ) ) ;
129
+ logger . info (
130
+ `App running with live reload listing for: http://${ options . host } :${ options . port } . Press Ctrl+C to quit.` ,
133
131
) ;
134
132
await sleepForever ( ) ;
135
133
}
0 commit comments