Skip to content

Commit

Permalink
Support npm_config_build_from_source (#99)
Browse files Browse the repository at this point in the history
  • Loading branch information
adipascu authored and vweevers committed Apr 21, 2019
1 parent c269703 commit 79f67f7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion rc.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ if (env.npm_config_argv) {
// Get the configuration
module.exports = function (pkg) {
var pkgConf = pkg.config || {}
var sourceBuild = env.npm_config_build_from_source
var buildFromSource = sourceBuild === pkg.name || sourceBuild === 'true'
var rc = require('rc')('prebuild-install', {
target: pkgConf.target || env.npm_config_target || process.versions.node,
runtime: pkgConf.runtime || env.npm_config_runtime || 'node',
Expand All @@ -39,7 +41,7 @@ module.exports = function (pkg) {
force: false,
verbose: false,
prebuild: true,
compile: false,
compile: buildFromSource,
path: '.',
proxy: env.npm_config_proxy || env['HTTP_PROXY'],
'https-proxy': env.npm_config_https_proxy || env['HTTPS_PROXY'],
Expand Down
4 changes: 3 additions & 1 deletion test/rc-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,8 @@ test('npm_config_* are passed on from environment into rc', function (t) {
npm_config_local_address: 'LOCAL_ADDRESS',
npm_config_target: '1.4.0',
npm_config_runtime: 'electron',
npm_config_platform: 'PLATFORM'
npm_config_platform: 'PLATFORM',
npm_config_build_from_source: 'true'
}
runRc(t, '', env, function (rc) {
t.equal(rc.proxy, 'PROXY', 'proxy is set')
Expand All @@ -77,6 +78,7 @@ test('npm_config_* are passed on from environment into rc', function (t) {
t.equal(rc.target, '1.4.0', 'target is set')
t.equal(rc.runtime, 'electron', 'runtime is set')
t.equal(rc.platform, 'PLATFORM', 'platform is set')
t.equal(rc.compile, true, 'build-from-source is set')
t.end()
})
})
Expand Down

0 comments on commit 79f67f7

Please sign in to comment.