File tree Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Expand file tree Collapse file tree 2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 11const Task = require ( '../ember-cli/lib/models/task' ) ;
22import * as chalk from 'chalk' ;
33import { exec } from 'child_process' ;
4+ import { checkYarnOrCNPM } from '../utilities/check-package-manager' ;
45
56
67export default Task . extend ( {
@@ -11,7 +12,7 @@ export default Task.extend({
1112 packageManager = 'npm' ;
1213 }
1314
14- return new Promise ( function ( resolve , reject ) {
15+ return checkYarnOrCNPM ( ) . then ( function ( ) {
1516 ui . writeLine ( chalk . green ( `Installing packages for tooling via ${ packageManager } .` ) ) ;
1617 let installCommand = `${ packageManager } install` ;
1718 if ( packageManager === 'npm' ) {
@@ -21,11 +22,11 @@ export default Task.extend({
2122 ( err : NodeJS . ErrnoException , _stdout : string , stderr : string ) => {
2223 if ( err ) {
2324 ui . writeLine ( stderr ) ;
24- ui . writeLine ( chalk . red ( 'Package install failed, see above.' ) ) ;
25- reject ( ) ;
25+ const message = 'Package install failed, see above.' ;
26+ ui . writeLine ( chalk . red ( message ) ) ;
27+ throw new Error ( message ) ;
2628 } else {
2729 ui . writeLine ( chalk . green ( `Installed packages for tooling via ${ packageManager } .` ) ) ;
28- resolve ( ) ;
2930 }
3031 } ) ;
3132 } ) ;
Original file line number Diff line number Diff line change @@ -8,10 +8,6 @@ const packageManager = CliConfig.fromGlobal().get('packageManager');
88
99
1010export function checkYarnOrCNPM ( ) {
11- if ( packageManager !== 'default' ) {
12- return Promise . resolve ( ) ;
13- }
14-
1511 return Promise
1612 . all ( [ checkYarn ( ) , checkCNPM ( ) ] )
1713 . then ( ( data : Array < boolean > ) => {
@@ -23,6 +19,11 @@ export function checkYarnOrCNPM() {
2319 console . log ( chalk . yellow ( 'You can `ng set --global packageManager=yarn`.' ) ) ;
2420 } else if ( isCNPMInstalled ) {
2521 console . log ( chalk . yellow ( 'You can `ng set --global packageManager=cnpm`.' ) ) ;
22+ } else {
23+ if ( packageManager !== 'default' && packageManager !== 'npm' ) {
24+ console . log ( chalk . yellow ( `Seems that ${ packageManager } is not installed.` ) ) ;
25+ console . log ( chalk . yellow ( 'You can `ng set --global packageManager=npm`.' ) ) ;
26+ }
2627 }
2728 } ) ;
2829}
You can’t perform that action at this time.
0 commit comments