Skip to content
This repository was archived by the owner on Feb 19, 2026. It is now read-only.

Commit 94f2492

Browse files
authored
Breaking: remove --compile and --prebuild options (#131)
In favor of --build-from-source which is a common option among build tools (node-gyp-build, node-pre-gyp). The --compile option was an alias and --prebuild is the default behavior anyway.
1 parent b6f3b36 commit 94f2492

File tree

4 files changed

+7
-19
lines changed

4 files changed

+7
-19
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ prebuild-install [options]
4949

5050
When `prebuild-install` is run via an `npm` script, options
5151
`--build-from-source`, `--debug`, `--download`, `--target`, `--runtime`, `--arch` and `--platform` may be passed through via
52-
arguments given to the `npm` command. Alternatively you can set environment variables `npm_config_platform`, `npm_config_arch`, `npm_config_target` and `npm_config_runtime`.
52+
arguments given to the `npm` command. Alternatively you can set environment variables `npm_config_build_from_source=true`, `npm_config_platform`, `npm_config_arch`, `npm_config_target` and `npm_config_runtime`.
5353

5454
### Private Repositories
5555

bin.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ if (!isNpm && /node_modules/.test(process.cwd())) {
5454
} else if (origin && origin.length > 4 && origin.substr(0, 4) === 'git+') {
5555
log.info('install', 'installing from git repository, skipping download.')
5656
process.exit(1)
57-
} else if (opts.compile === true || opts.prebuild === false) {
57+
} else if (opts.buildFromSource) {
5858
log.info('install', '--build-from-source specified, not attempting download.')
5959
process.exit(1)
6060
}

rc.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@ var libc = env.LIBC || (detectLibc.isNonGlibcLinux && detectLibc.family) || ''
99
// Get the configuration
1010
module.exports = function (pkg) {
1111
var pkgConf = pkg.config || {}
12-
13-
// TODO: remove compile and prebuild aliases?
14-
var buildFromSource = env.npm_config_build_from_source || env.npm_config_compile
12+
var buildFromSource = env.npm_config_build_from_source
1513

1614
var rc = require('rc')('prebuild-install', {
1715
target: pkgConf.target || env.npm_config_target || process.versions.node,
@@ -22,8 +20,7 @@ module.exports = function (pkg) {
2220
debug: env.npm_config_debug === 'true',
2321
force: false,
2422
verbose: env.npm_config_verbose === 'true',
25-
prebuild: env.npm_config_prebuild !== '',
26-
compile: buildFromSource === pkg.name || buildFromSource === 'true',
23+
buildFromSource: buildFromSource === pkg.name || buildFromSource === 'true',
2724
path: '.',
2825
proxy: env.npm_config_proxy || env['http_proxy'] || env['HTTP_PROXY'],
2926
'https-proxy': env.npm_config_https_proxy || env['https_proxy'] || env['HTTPS_PROXY'],
@@ -39,8 +36,7 @@ module.exports = function (pkg) {
3936
path: 'p',
4037
version: 'v',
4138
download: 'd',
42-
'build-from-source': 'compile',
43-
compile: 'c',
39+
buildFromSource: 'build-from-source',
4440
token: 'T'
4541
}
4642
}))

test/rc-test.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,10 @@ test('npm args are passed on from npm environment into rc', function (t) {
5555
].join(' ')
5656

5757
runRc(t, args, {}, function (rc) {
58-
t.equal(rc.compile, true, 'compile should be true')
58+
t.equal(rc.buildFromSource, true, 'buildFromSource should be true')
5959
t.equal(rc.debug, true, 'debug should be true')
6060
t.equal(rc.verbose, true, 'verbose should be true')
6161
t.equal(rc.download, 'https://foo.bar', 'download is set')
62-
t.equal(rc.prebuild, true, 'prebuild is true')
63-
t.end()
64-
})
65-
})
66-
67-
test('negative npm args are passed on from npm environment into rc', function (t) {
68-
runRc(t, '--no-prebuild', {}, function (rc) {
69-
t.equal(rc.prebuild, false, 'prebuild is false')
7062
t.end()
7163
})
7264
})
@@ -89,7 +81,7 @@ test('npm_config_* are passed on from environment into rc', function (t) {
8981
t.equal(rc.target, '1.4.0', 'target is set')
9082
t.equal(rc.runtime, 'electron', 'runtime is set')
9183
t.equal(rc.platform, 'PLATFORM', 'platform is set')
92-
t.equal(rc.compile, true, 'build-from-source is set')
84+
t.equal(rc.buildFromSource, true, 'build-from-source is set')
9385
t.end()
9486
})
9587
})

0 commit comments

Comments
 (0)