From 9609fc675031bd4dca285ceb942a71d995d1ee7b Mon Sep 17 00:00:00 2001 From: vsavkin Date: Sat, 20 Jan 2018 18:06:38 -0500 Subject: [PATCH] fix(command-line): make affected and format windows-friendly --- packages/schematics/src/command-line/affected.ts | 7 ++++--- packages/schematics/src/command-line/format.ts | 3 ++- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/schematics/src/command-line/affected.ts b/packages/schematics/src/command-line/affected.ts index 89a4f72f695ab..9b0bfdf42adb4 100644 --- a/packages/schematics/src/command-line/affected.ts +++ b/packages/schematics/src/command-line/affected.ts @@ -41,7 +41,7 @@ function build(apps: string[], rest: string[]) { if (apps.length > 0) { console.log(`Building ${apps.join(', ')}`); apps.forEach(app => { - execSync(`${ngPath()} build ${rest.join(' ')} -a=${app}`, { stdio: [0, 1, 2] }); + execSync(`node ${ngPath()} build ${rest.join(' ')} -a=${app}`, { stdio: [0, 1, 2] }); }); } else { console.log('No apps to build'); @@ -52,7 +52,7 @@ function e2e(apps: string[], rest: string[]) { if (apps.length > 0) { console.log(`Testing ${apps.join(', ')}`); apps.forEach(app => { - execSync(`${ngPath()} e2e ${rest.join(' ')} -a=${app}`, { stdio: [0, 1, 2] }); + execSync(`node ${ngPath()} e2e ${rest.join(' ')} -a=${app}`, { stdio: [0, 1, 2] }); }); } else { console.log('No apps to test'); @@ -60,5 +60,6 @@ function e2e(apps: string[], rest: string[]) { } function ngPath() { - return `${path.dirname(path.dirname(path.dirname(resolve.sync('@angular/cli', { basedir: __dirname }))))}/bin/ng`; + const basePath = path.dirname(path.dirname(path.dirname(resolve.sync('@angular/cli', { basedir: __dirname })))); + return path.join(basePath, 'bin', 'ng'); } diff --git a/packages/schematics/src/command-line/format.ts b/packages/schematics/src/command-line/format.ts index 71671185e0dfd..4b62dfb1ae1dd 100644 --- a/packages/schematics/src/command-line/format.ts +++ b/packages/schematics/src/command-line/format.ts @@ -77,5 +77,6 @@ function check(patterns: string[]) { } function prettierPath() { - return `${path.dirname(resolve.sync('prettier', { basedir: __dirname }))}/bin-prettier.js`; + const basePath = path.dirname(resolve.sync('prettier', { basedir: __dirname })); + return path.join(basePath, 'bin-prettier.js'); }