@@ -4,49 +4,32 @@ var detectLibc = require('detect-libc')
4
4
var napi = require ( 'napi-build-utils' )
5
5
6
6
var env = process . env
7
-
8
7
var libc = env . LIBC || ( detectLibc . isNonGlibcLinux && detectLibc . family ) || ''
9
8
10
- // Get `prebuild-install` arguments that were passed to the `npm` command
11
- if ( env . npm_config_argv ) {
12
- var npmargs = [ 'prebuild' , 'compile' , 'build-from-source' , 'debug' , 'verbose' ]
13
- try {
14
- var npmArgv = JSON . parse ( env . npm_config_argv ) . cooked
15
- for ( var i = 0 ; i < npmargs . length ; ++ i ) {
16
- if ( npmArgv . indexOf ( '--' + npmargs [ i ] ) !== - 1 ) {
17
- process . argv . push ( '--' + npmargs [ i ] )
18
- }
19
- if ( npmArgv . indexOf ( '--no-' + npmargs [ i ] ) !== - 1 ) {
20
- process . argv . push ( '--no-' + npmargs [ i ] )
21
- }
22
- }
23
- if ( ( i = npmArgv . indexOf ( '--download' ) ) !== - 1 ) {
24
- process . argv . push ( npmArgv [ i ] , npmArgv [ i + 1 ] )
25
- }
26
- } catch ( e ) { }
27
- }
28
-
29
9
// Get the configuration
30
10
module . exports = function ( pkg ) {
31
11
var pkgConf = pkg . config || { }
32
- var sourceBuild = env . npm_config_build_from_source
33
- var buildFromSource = sourceBuild === pkg . name || sourceBuild === 'true'
12
+
13
+ // TODO: remove compile and prebuild aliases?
14
+ var buildFromSource = env . npm_config_build_from_source || env . npm_config_compile
15
+
34
16
var rc = require ( 'rc' ) ( 'prebuild-install' , {
35
17
target : pkgConf . target || env . npm_config_target || process . versions . node ,
36
18
runtime : pkgConf . runtime || env . npm_config_runtime || 'node' ,
37
19
arch : pkgConf . arch || env . npm_config_arch || process . arch ,
38
20
libc : libc ,
39
21
platform : env . npm_config_platform || process . platform ,
40
- debug : false ,
22
+ debug : env . npm_config_debug === 'true' ,
41
23
force : false ,
42
- verbose : false ,
43
- prebuild : true ,
44
- compile : buildFromSource ,
24
+ verbose : env . npm_config_verbose === 'true' ,
25
+ prebuild : env . npm_config_prebuild !== '' ,
26
+ compile : buildFromSource === pkg . name || buildFromSource === 'true' ,
45
27
path : '.' ,
46
28
proxy : env . npm_config_proxy || env [ 'http_proxy' ] || env [ 'HTTP_PROXY' ] ,
47
29
'https-proxy' : env . npm_config_https_proxy || env [ 'https_proxy' ] || env [ 'HTTPS_PROXY' ] ,
48
30
'local-address' : env . npm_config_local_address ,
49
- 'tag-prefix' : 'v'
31
+ 'tag-prefix' : 'v' ,
32
+ download : env . npm_config_download
50
33
} , minimist ( process . argv , {
51
34
alias : {
52
35
target : 't' ,
0 commit comments