prebuild-install
Advanced tools
Comparing version 2.5.0 to 2.5.1
10
bin.js
@@ -6,3 +6,3 @@ #!/usr/bin/env node | ||
var fs = require('fs') | ||
var extend = require('xtend') | ||
var whichPmRuns = require('which-pm-runs') | ||
@@ -12,3 +12,2 @@ var pkg = require(path.resolve('package.json')) | ||
var download = require('./download') | ||
var util = require('./util') | ||
@@ -40,7 +39,8 @@ var prebuildClientVersion = require('./package.json').version | ||
var opts = extend(rc, {pkg: pkg, log: log}) | ||
var opts = Object.assign({}, rc, {pkg: pkg, log: log}) | ||
var execPath = process.env.npm_execpath || process.env.NPM_CLI_JS | ||
var pm = whichPmRuns() | ||
var isNpm = !pm || pm.name === 'npm' | ||
if (util.isYarnPath(execPath) && /node_modules/.test(process.cwd())) { | ||
if (!isNpm && /node_modules/.test(process.cwd())) { | ||
// From yarn repository | ||
@@ -47,0 +47,0 @@ } else if (opts.force) { |
@@ -6,4 +6,3 @@ var path = require('path') | ||
var tfs = require('tar-fs') | ||
var extend = require('xtend') | ||
var noop = extend({ | ||
var noop = Object.assign({ | ||
http: function () {}, | ||
@@ -30,10 +29,10 @@ silly: function () {} | ||
log.info('looking for local prebuild @', localPrebuild) | ||
fs.exists(localPrebuild, function (exists) { | ||
if (exists) { | ||
log.info('found local prebuild') | ||
cachedPrebuild = localPrebuild | ||
return unpack() | ||
fs.access(localPrebuild, fs.R_OK | fs.W_OK, function (err) { | ||
if (err && err.code === 'ENOENT') { | ||
return download() | ||
} | ||
download() | ||
log.info('found local prebuild') | ||
cachedPrebuild = localPrebuild | ||
unpack() | ||
}) | ||
@@ -46,4 +45,4 @@ | ||
log.info('looking for cached prebuild @', cachedPrebuild) | ||
fs.exists(cachedPrebuild, function (exists) { | ||
if (exists) { | ||
fs.access(cachedPrebuild, fs.R_OK | fs.W_OK, function (err) { | ||
if (!(err && err.code === 'ENOENT')) { | ||
log.info('found cached prebuild') | ||
@@ -152,15 +151,8 @@ return unpack() | ||
var cacheFolder = util.npmCache() | ||
if (fs.access) { | ||
fs.access(cacheFolder, fs.R_OK | fs.W_OK, function (err) { | ||
if (err && err.code === 'ENOENT') { | ||
return makeNpmCacheDir() | ||
} | ||
cb(err) | ||
}) | ||
} else { | ||
fs.exists(cacheFolder, function (exists) { | ||
if (!exists) return makeNpmCacheDir() | ||
cb() | ||
}) | ||
} | ||
fs.access(cacheFolder, fs.R_OK | fs.W_OK, function (err) { | ||
if (err && err.code === 'ENOENT') { | ||
return makeNpmCacheDir() | ||
} | ||
cb(err) | ||
}) | ||
@@ -167,0 +159,0 @@ function makeNpmCacheDir () { |
{ | ||
"name": "prebuild-install", | ||
"version": "2.5.0", | ||
"version": "2.5.1", | ||
"description": "A command line tool for easily install prebuilds for multiple version of node/iojs on a specific platform", | ||
@@ -27,12 +27,12 @@ "scripts": { | ||
"mkdirp": "^0.5.1", | ||
"node-abi": "^2.1.1", | ||
"node-abi": "^2.2.0", | ||
"noop-logger": "^0.1.1", | ||
"npmlog": "^4.0.1", | ||
"os-homedir": "^1.0.1", | ||
"pump": "^1.0.1", | ||
"pump": "^2.0.1", | ||
"rc": "^1.1.6", | ||
"simple-get": "^1.4.2", | ||
"simple-get": "^2.7.0", | ||
"tar-fs": "^1.13.0", | ||
"tunnel-agent": "^0.6.0", | ||
"xtend": "4.0.1" | ||
"which-pm-runs": "^1.0.0" | ||
}, | ||
@@ -43,3 +43,3 @@ "devDependencies": { | ||
"rimraf": "^2.5.2", | ||
"standard": "^8.6.0", | ||
"standard": "^10.0.3", | ||
"tape": "^4.5.1" | ||
@@ -46,0 +46,0 @@ }, |
# prebuild-install | ||
[![Build Status](https://travis-ci.org/prebuild/prebuild-install.svg?branch=master)](https://travis-ci.org/prebuild/prebuild-install) | ||
[![Build status](https://ci.appveyor.com/api/projects/status/6v6hxxwgjrr99pc8/branch/master?svg=true)](https://ci.appveyor.com/project/mathiask88/prebuild-install) | ||
[![david](https://david-dm.org/prebuild/prebuild-install.svg)](https://david-dm.org/prebuild/prebuild-install) | ||
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/) | ||
@@ -23,3 +25,3 @@ | ||
You need to provide prebuilds made by [prebuild](https://github.com/mafintosh/prebuild) | ||
You need to provide prebuilds made by [prebuild](https://github.com/mafintosh/prebuild). | ||
@@ -46,3 +48,3 @@ ### Help | ||
### Custom binaries | ||
The end user can override binary download location through environment variables in their .npmrc file. | ||
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: | ||
@@ -52,4 +54,4 @@ ``` | ||
``` | ||
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: | ||
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: | ||
``` | ||
@@ -56,0 +58,0 @@ http://overriden-host.com/overriden-path/v1.2.3/leveldown-v1.2.3-node-v57-win32-x64.tar.gz |
@@ -83,6 +83,2 @@ var path = require('path') | ||
function isYarnPath (execPath) { | ||
return execPath ? /^yarn/.test(path.basename(execPath)) : false | ||
} | ||
exports.getDownloadUrl = getDownloadUrl | ||
@@ -95,2 +91,1 @@ exports.urlTemplate = urlTemplate | ||
exports.tempFile = tempFile | ||
exports.isYarnPath = isYarnPath |
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 2 instances in 1 package
18959
13
61
9
343
+ Addedwhich-pm-runs@^1.0.0
+ Addeddecompress-response@3.3.0(transitive)
+ Addedmimic-response@1.0.1(transitive)
+ Addedpump@2.0.1(transitive)
+ Addedsimple-concat@1.0.1(transitive)
+ Addedsimple-get@2.8.2(transitive)
+ Addedwhich-pm-runs@1.1.0(transitive)
+ Addedxtend@4.0.2(transitive)
- Removedxtend@4.0.1
- Removedsimple-get@1.4.3(transitive)
- Removedunzip-response@1.0.2(transitive)
- Removedxtend@4.0.1(transitive)
Updatednode-abi@^2.2.0
Updatedpump@^2.0.1
Updatedsimple-get@^2.7.0