File tree 1 file changed +20
-0
lines changed
packages/angular-cli/tasks
1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -2,13 +2,33 @@ const Task = require('ember-cli/lib/models/task');
2
2
import * as chalk from 'chalk' ;
3
3
import { exec } from 'child_process' ;
4
4
5
+ const RElocalNodeModulesFolder = / n o d e _ m o d u l e s \/ \. b i n / ;
6
+ function isLocalNodeModulesFolder ( name : string ) {
7
+ return RElocalNodeModulesFolder . test ( name ) ;
8
+ }
9
+
10
+ function getPath ( ) {
11
+ const pathArr = process . env . PATH . split ( ':' ) ;
12
+ const newPathArr = [ ] ;
13
+ for ( let pathItem of pathArr ) {
14
+ if ( ! isLocalNodeModulesFolder ( pathItem ) ) {
15
+ newPathArr . push ( pathItem ) ;
16
+ }
17
+ }
18
+ return newPathArr . join ( ':' ) ;
19
+ }
5
20
6
21
export default Task . extend ( {
7
22
run : function ( ) {
8
23
const ui = this . ui ;
9
24
10
25
return new Promise ( function ( resolve , reject ) {
11
26
ui . writeLine ( chalk . green ( 'Installing packages for tooling via npm.' ) ) ;
27
+ const options = {
28
+ env : {
29
+ PATH : getPath ( )
30
+ }
31
+ }
12
32
exec ( 'npm install' ,
13
33
( err : NodeJS . ErrnoException , stdout : string , stderr : string ) => {
14
34
if ( err ) {
You can’t perform that action at this time.
0 commit comments