Commit e75ff56 1 parent e0f2406 commit e75ff56 Copy full SHA for e75ff56
File tree 2 files changed +10
-8
lines changed
2 files changed +10
-8
lines changed Original file line number Diff line number Diff line change 1
1
const Task = require ( '../ember-cli/lib/models/task' ) ;
2
2
import * as chalk from 'chalk' ;
3
3
import { exec } from 'child_process' ;
4
+ import { checkYarnOrCNPM } from '../utilities/check-package-manager' ;
4
5
5
6
6
7
export default Task . extend ( {
@@ -11,7 +12,7 @@ export default Task.extend({
11
12
packageManager = 'npm' ;
12
13
}
13
14
14
- return new Promise ( function ( resolve , reject ) {
15
+ return checkYarnOrCNPM ( ) . then ( function ( ) {
15
16
ui . writeLine ( chalk . green ( `Installing packages for tooling via ${ packageManager } .` ) ) ;
16
17
let installCommand = `${ packageManager } install` ;
17
18
if ( packageManager === 'npm' ) {
@@ -21,11 +22,11 @@ export default Task.extend({
21
22
( err : NodeJS . ErrnoException , _stdout : string , stderr : string ) => {
22
23
if ( err ) {
23
24
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 ) ;
26
28
} else {
27
29
ui . writeLine ( chalk . green ( `Installed packages for tooling via ${ packageManager } .` ) ) ;
28
- resolve ( ) ;
29
30
}
30
31
} ) ;
31
32
} ) ;
Original file line number Diff line number Diff line change @@ -8,10 +8,6 @@ const packageManager = CliConfig.fromGlobal().get('packageManager');
8
8
9
9
10
10
export function checkYarnOrCNPM ( ) {
11
- if ( packageManager !== 'default' ) {
12
- return Promise . resolve ( ) ;
13
- }
14
-
15
11
return Promise
16
12
. all ( [ checkYarn ( ) , checkCNPM ( ) ] )
17
13
. then ( ( data : Array < boolean > ) => {
@@ -23,6 +19,11 @@ export function checkYarnOrCNPM() {
23
19
console . log ( chalk . yellow ( 'You can `ng set --global packageManager=yarn`.' ) ) ;
24
20
} else if ( isCNPMInstalled ) {
25
21
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
+ }
26
27
}
27
28
} ) ;
28
29
}
You can’t perform that action at this time.
0 commit comments