From 77e951dc49ed897866a61d9bb51759356e0a2f4a Mon Sep 17 00:00:00 2001 From: sinedied Date: Fri, 8 Jan 2021 15:21:59 +0100 Subject: [PATCH] feat: add --app option (closes #18) --- README.md | 1 + index.js | 16 +++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6962a52..1a0dc75 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,7 @@ Unless the `--fast` option is provided, the Angular app is rebuilt before execut Any accepted Cordova option can be passed through after `--`. #### Options +- `--app`: The name of the Angular app to build. Only useful if you have a workspace with multiples apps. - `--fast`: Skip Angular app rebuild - `--base-href `: Change application base URL (default is `./`) - `--copy `: Copy built apps to the specified path (only works with `cordova build`) diff --git a/index.js b/index.js index 82d1f84..76c4447 100644 --- a/index.js +++ b/index.js @@ -26,6 +26,7 @@ ${chalk.blue('cordova')} [options] [-- ] rebuilt before executing the command, using ${chalk.cyan('npm run build')}. Any accepted Cordova option can be passed through after ${chalk.cyan('--')}. + --app The name of the Angular app to build --fast Skip Angular app rebuild --base-href Change application base URL (default is ./) --copy Copy built apps to path (only work with ${chalk.cyan( @@ -73,7 +74,15 @@ class NgxScriptsCli { 'dist', 'verbose' ], - string: ['out', 'format', 'copy', 'configuration', 'path', 'base-href'], + string: [ + 'out', + 'format', + 'copy', + 'configuration', + 'path', + 'base-href', + 'app' + ], alias: {c: 'configuration'}, default: {'base-href': './'}, '--': true @@ -152,6 +161,7 @@ class NgxScriptsCli { options.yarn ? [] : ['-s', '--'] ); buildOptions.push(`--base-href=${options['base-href']}`); + if (options.dev) { buildOptions.push('--prod=false'); } @@ -161,6 +171,10 @@ class NgxScriptsCli { buildOptions.push(options.configuration); } + if (options.app) { + buildOptions.push(options.app); + } + const buildResult = child.spawnSync( options.yarn ? 'yarn' : 'npm', buildOptions,