Skip to content

Commit

Permalink
feat: add --app option (closes #18)
Browse files Browse the repository at this point in the history
  • Loading branch information
sinedied committed Jan 8, 2021
1 parent 654caec commit 77e951d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <ref>`: Change application base URL (default is `./`)
- `--copy <path>`: Copy built apps to the specified path (only works with `cordova build`)
Expand Down
16 changes: 15 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ ${chalk.blue('cordova')} <command> [options] [-- <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 <name> The name of the Angular app to build
--fast Skip Angular app rebuild
--base-href <ref> Change application base URL (default is ./)
--copy <path> Copy built apps to path (only work with ${chalk.cyan(
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -152,6 +161,7 @@ class NgxScriptsCli {
options.yarn ? [] : ['-s', '--']
);
buildOptions.push(`--base-href=${options['base-href']}`);

if (options.dev) {
buildOptions.push('--prod=false');
}
Expand All @@ -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,
Expand Down

0 comments on commit 77e951d

Please sign in to comment.