File tree 2 files changed +23
-8
lines changed
2 files changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -3,4 +3,10 @@ declare module "npm" {
3
3
var commands : { [ index : string ] : any } ;
4
4
var prefix : string ;
5
5
function load ( config : Object , callback : ( err : any , data : any ) => void ) : void ;
6
+ module config {
7
+ var loaded : boolean ;
8
+ module sources {
9
+ var cli : { data : Object } ;
10
+ }
11
+ }
6
12
}
Original file line number Diff line number Diff line change @@ -19,15 +19,24 @@ export class NodePackageManager implements INodePackageManager {
19
19
}
20
20
21
21
public load ( config ?: any ) : IFuture < void > {
22
- let future = new Future < void > ( ) ;
23
- npm . load ( config , ( err : Error ) => {
24
- if ( err ) {
25
- future . throw ( err ) ;
26
- } else {
27
- future . return ( ) ;
22
+ if ( npm . config . loaded ) {
23
+ let data = npm . config . sources . cli . data ;
24
+ Object . keys ( data ) . forEach ( k => delete data [ k ] ) ;
25
+ if ( config ) {
26
+ _ . assign ( data , config ) ;
28
27
}
29
- } ) ;
30
- return future ;
28
+ return Future . fromResult ( ) ;
29
+ } else {
30
+ let future = new Future < void > ( ) ;
31
+ npm . load ( config , ( err : Error ) => {
32
+ if ( err ) {
33
+ future . throw ( err ) ;
34
+ } else {
35
+ future . return ( ) ;
36
+ }
37
+ } ) ;
38
+ return future ;
39
+ }
31
40
}
32
41
33
42
public install ( packageName : string , pathToSave : string , config ?: any ) : IFuture < any > {
You can’t perform that action at this time.
0 commit comments