Skip to content

Commit

Permalink
fix(schematics): do not use npm-run-all when parallel is set ot false
Browse files Browse the repository at this point in the history
  • Loading branch information
vsavkin committed Apr 26, 2018
1 parent c3ea765 commit 30de0b9
Showing 1 changed file with 27 additions and 14 deletions.
41 changes: 27 additions & 14 deletions packages/schematics/src/command-line/affected.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,26 +44,39 @@ function printError(command: string, e: any) {

function build(apps: string[], rest: string[]) {
if (apps.length > 0) {
console.log(`Building ${apps.join(', ')}`);

const parallel = yargsParser(rest, {
default: {
parallel: true
parallel: false
},
boolean: ['parallel']
}).parallel;

console.log(`Building ${apps.join(', ')}`);
const buildCommands = rest.filter(a => !a.startsWith('--parallel'));
runAll(
apps.map(app => `ng build -- ${buildCommands.join(' ')} -a=${app}`),
{
parallel,
stdin: process.stdin,
stdout: process.stdout,
stderr: process.stderr
}
)
.then(() => console.log('Build succeeded.'))
.catch(err => console.error('Build failed.'));
const buildCommands = rest.filter(a => !a.startsWith('--parallel') && !a.startsWith('--no-parallel'));
if (parallel) {
runAll(
apps.map(app => `ng build -- ${buildCommands.join(' ')} -a=${app}`),
{
parallel,
stdin: process.stdin,
stdout: process.stdout,
stderr: process.stderr
}
)
.then(() => console.log('Build succeeded.'))
.catch(err => console.error('Build failed.'));
} else {
apps.forEach(app => {
execSync(
`node ${ngPath()} build ${buildCommands.join(' ')} -a=${app}`,
{
stdio: [0, 1, 2]
}
);
});
}

} else {
console.log('No apps to build');
}
Expand Down

0 comments on commit 30de0b9

Please sign in to comment.