1- import { writeConfigXmlContentSrc } from './configXmlUtils' ;
1+ import { writeConfigXmlContentSrc } from './configXmlUtils' ;
22import {
33 CommandData ,
44 CommandLineInputs ,
55 CommandLineOptions ,
66 normalizeOptionAliases ,
77 minimistOptionsToArray ,
8- appScriptsServe ,
9- appScriptsBuild
108} from '@ionic/cli-utils' ;
9+ import {
10+ generateContext ,
11+ build
12+ } from '@ionic/app-scripts' ;
1113
1214/**
1315 * Filter and gather arguments from command line to be passed to Cordova
@@ -40,7 +42,7 @@ export function filterArgumentsForCordova(metadata: CommandData, inputs: Command
4042/**
4143 * Start the app scripts server for emulator or device
4244 */
43- export async function startAppScriptsServer ( metadata : CommandData , inputs : CommandLineInputs , options : CommandLineOptions ) : Promise < void > {
45+ export async function startAppScriptsServer ( projectDirectory : string , metadata : CommandData , inputs : CommandLineInputs , options : CommandLineOptions ) : Promise < void > {
4446 const results = normalizeOptionAliases ( metadata , options ) ;
4547 let args = minimistOptionsToArray ( metadata , results ) ;
4648
@@ -50,13 +52,17 @@ export async function startAppScriptsServer(metadata: CommandData, inputs: Comma
5052 '--nobrowser'
5153 ] ) ;
5254
53- const serveSettings = await appScriptsServe ( args ) ;
54- await writeConfigXmlContentSrc ( process . cwd ( ) , serveSettings . url ) ;
55+ process . argv = process . argv . slice ( 0 , 3 ) . concat ( args ) ;
56+ const context = generateContext ( ) ;
57+ const serverSettings = await build ( context ) ;
58+ await writeConfigXmlContentSrc ( projectDirectory , serverSettings . url ) ;
5559}
5660
5761export async function runAppScriptsBuild ( metadata : CommandData , inputs : CommandLineInputs , options : CommandLineOptions ) : Promise < void > {
5862 const results = normalizeOptionAliases ( metadata , options ) ;
5963 let args = minimistOptionsToArray ( metadata , results ) ;
6064
61- await appScriptsBuild ( args ) ;
65+ process . argv = process . argv . slice ( 0 , 3 ) . concat ( args ) ;
66+ const context = generateContext ( ) ;
67+ await build ( context ) ;
6268}
0 commit comments