prebuild-install
Advanced tools
Comparing version 2.3.0 to 2.4.0
@@ -44,2 +44,5 @@ #!/usr/bin/env node | ||
// From yarn repository | ||
} else if (opts.force) { | ||
log.warn('install', 'prebuilt binaries enforced with --force!') | ||
log.warn('install', 'prebuilt binaries may be out of date!') | ||
} else if (!(typeof pkg._from === 'string')) { | ||
@@ -46,0 +49,0 @@ log.info('install', 'installing standalone, skipping download.') |
@@ -6,3 +6,7 @@ var path = require('path') | ||
var tfs = require('tar-fs') | ||
var noop = require('noop-logger') | ||
var extend = require('xtend') | ||
var noop = extend({ | ||
http: function () {}, | ||
silly: function () {} | ||
}, require('noop-logger')) | ||
var zlib = require('zlib') | ||
@@ -9,0 +13,0 @@ var util = require('./util') |
@@ -7,2 +7,3 @@ prebuild-install [options] | ||
--path -p path (make a prebuild-install here) | ||
--force (always use prebuilt binaries when available) | ||
--build-from-source (skip prebuild download) | ||
@@ -9,0 +10,0 @@ --verbose (log verbosely) |
{ | ||
"name": "prebuild-install", | ||
"version": "2.3.0", | ||
"version": "2.4.0", | ||
"description": "A command line tool for easily install prebuilds for multiple version of node/iojs on a specific platform", | ||
@@ -5,0 +5,0 @@ "scripts": { |
@@ -35,2 +35,3 @@ var minimist = require('minimist') | ||
debug: false, | ||
force: false, | ||
verbose: false, | ||
@@ -37,0 +38,0 @@ prebuild: true, |
@@ -1,5 +0,8 @@ | ||
# prebuild-install [![Build Status](https://travis-ci.org/mafintosh/prebuild-install.svg?branch=master)](https://travis-ci.org/mafintosh/prebuild-install) | ||
# prebuild-install | ||
A command line tool for easily install prebuilds for multiple version of node/iojs on a specific platform. | ||
[![Build Status](https://travis-ci.org/prebuild/prebuild-install.svg?branch=master)](https://travis-ci.org/prebuild/prebuild-install) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) | ||
> A command line tool for easily install prebuilds for multiple version of node/iojs on a specific platform. | ||
`prebuild-install` supports installing prebuilt binaries from GitHub by default. | ||
@@ -41,4 +44,16 @@ | ||
### Custom binaries | ||
The end user can override binary download location through environment variables in their .npmrc file. | ||
The variable needs to meet the mask `% your package name %_binary_host` or `% your package name %_binary_host_mirror`. For example: | ||
``` | ||
leveldown_binary_host=http://overriden-host.com/overriden-path | ||
``` | ||
Note that the package version subpath and file name will still be appended. | ||
So if you are installing `leveldown@1.2.3` the resulting url will be: | ||
``` | ||
http://overriden-host.com/overriden-path/v1.2.3/leveldown-v1.2.3-node-v57-win32-x64.tar.gz | ||
``` | ||
## License | ||
MIT |
12
util.js
@@ -34,2 +34,8 @@ var path = require('path') | ||
var packageName = '{name}-v{version}-{runtime}-v{abi}-{platform}{libc}-{arch}.tar.gz' | ||
var hostMirrorUrl = getHostMirrorUrl(opts) | ||
if (hostMirrorUrl) { | ||
return hostMirrorUrl + '/v{version}/' + packageName | ||
} | ||
if (opts.pkg.binary) { | ||
@@ -44,5 +50,11 @@ return [ | ||
} | ||
return github(opts.pkg) + '/releases/download/v{version}/' + packageName | ||
} | ||
function getHostMirrorUrl (opts) { | ||
var propName = 'npm_config_' + opts.pkg.name + '_binary_host' | ||
return process.env[propName] || process.env[propName + '_mirror'] | ||
} | ||
function trimSlashes (str) { | ||
@@ -49,0 +61,0 @@ if (str) return str.replace(/^\.\/|^\/|\/$/g, '') |
Sorry, the diff of this file is not supported yet
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
17777
348
59