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