@@ -7,7 +7,9 @@ export class PacoteService implements IPacoteService {
7
7
constructor ( private $fs : IFileSystem ,
8
8
private $injector : IInjector ,
9
9
private $logger : ILogger ,
10
- private $proxyService : IProxyService ) { }
10
+ private $npmConfigService : INpmConfigService ,
11
+ private $proxyService : IProxyService ) {
12
+ }
11
13
12
14
@cache ( )
13
15
public get $packageManager ( ) : INodePackageManager {
@@ -18,13 +20,16 @@ export class PacoteService implements IPacoteService {
18
20
public async manifest ( packageName : string , options ?: IPacoteManifestOptions ) : Promise < any > {
19
21
this . $logger . trace ( `Calling pacoteService.manifest for packageName: '${ packageName } ' and options: ${ options } ` ) ;
20
22
const manifestOptions : IPacoteBaseOptions = await this . getPacoteBaseOptions ( ) ;
23
+
21
24
if ( options ) {
22
25
_ . extend ( manifestOptions , options ) ;
23
26
}
24
27
25
28
packageName = this . getRealPackageName ( packageName ) ;
26
29
this . $logger . trace ( `Calling pacote.manifest for packageName: ${ packageName } and options: ${ JSON . stringify ( manifestOptions , null , 2 ) } ` ) ;
27
- return pacote . manifest ( packageName , manifestOptions ) ;
30
+ const result = pacote . manifest ( packageName , manifestOptions ) ;
31
+
32
+ return result ;
28
33
}
29
34
30
35
public async extractPackage ( packageName : string , destinationDirectory : string , options ?: IPacoteExtractOptions ) : Promise < void > {
@@ -67,7 +72,10 @@ export class PacoteService implements IPacoteService {
67
72
private async getPacoteBaseOptions ( ) : Promise < IPacoteBaseOptions > {
68
73
// In case `tns create myapp --template https://github.com/NativeScript/template-hello-world.git` command is executed, pacote module throws an error if cache option is not provided.
69
74
const cachePath = await this . $packageManager . getCachePath ( ) ;
70
- const pacoteOptions = { cache : cachePath } ;
75
+
76
+ // Add NPM Configuration to our Manifest options
77
+ const npmConfig = this . $npmConfigService . getConfig ( ) ;
78
+ const pacoteOptions = _ . extend ( npmConfig , { cache : cachePath } ) ;
71
79
const proxySettings = await this . $proxyService . getCache ( ) ;
72
80
if ( proxySettings ) {
73
81
_ . extend ( pacoteOptions , proxySettings ) ;
0 commit comments