diff --git a/node_modules/bin-links/CHANGELOG.md b/node_modules/bin-links/CHANGELOG.md
index 7966938ae21ea..697e3c53559b4 100644
--- a/node_modules/bin-links/CHANGELOG.md
+++ b/node_modules/bin-links/CHANGELOG.md
@@ -2,6 +2,16 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
+
+## [1.1.6](https://github.com/npm/bin-links/compare/v1.1.5...v1.1.6) (2019-12-11)
+
+
+### Bug Fixes
+
+* prevent improper clobbering of man/bin links ([642cd18](https://github.com/npm/bin-links/commit/642cd18)), closes [#11](https://github.com/npm/bin-links/issues/11) [#12](https://github.com/npm/bin-links/issues/12)
+
+
+
## [1.1.5](https://github.com/npm/bin-links/compare/v1.1.4...v1.1.5) (2019-12-10)
diff --git a/node_modules/bin-links/index.js b/node_modules/bin-links/index.js
index eda6abd19e232..4f6d3c055c02e 100644
--- a/node_modules/bin-links/index.js
+++ b/node_modules/bin-links/index.js
@@ -3,8 +3,9 @@
const path = require('path')
const fs = require('graceful-fs')
const BB = require('bluebird')
-const linkIfExists = BB.promisify(require('gentle-fs').linkIfExists)
-const cmdShimIfExists = BB.promisify(require('cmd-shim').ifExists)
+const gentleFs = require('gentle-fs')
+const linkIfExists = BB.promisify(gentleFs.linkIfExists)
+const gentleFsBinLink = BB.promisify(gentleFs.binLink)
const open = BB.promisify(fs.open)
const close = BB.promisify(fs.close)
const read = BB.promisify(fs.read, {multiArgs: true})
@@ -42,9 +43,9 @@ function isHashbangFile (file) {
return read(fileHandle, Buffer.alloc(2), 0, 2, 0).spread((_, buf) => {
if (!hasHashbang(buf)) return []
return read(fileHandle, Buffer.alloc(2048), 0, 2048, 0)
- }).spread((_, buf) => buf && hasCR(buf), () => false)
+ }).spread((_, buf) => buf && hasCR(buf), /* istanbul ignore next */ () => false)
.finally(() => close(fileHandle))
- }).catch(() => false)
+ }).catch(/* istanbul ignore next */ () => false)
}
function hasHashbang (buf) {
@@ -109,6 +110,7 @@ function linkBins (pkg, folder, parent, gtop, opts) {
opts.log.showProgress()
}
}).catch(err => {
+ /* istanbul ignore next */
if (err.code === 'ENOENT' && opts.ignoreScripts) return
throw err
})
@@ -116,11 +118,11 @@ function linkBins (pkg, folder, parent, gtop, opts) {
}
function linkBin (from, to, opts) {
- if (process.platform !== 'win32') {
- return linkIfExists(from, to, opts)
- } else {
- return cmdShimIfExists(from, to)
+ // do not clobber global bins
+ if (opts.globalBin && to.indexOf(opts.globalBin) === 0) {
+ opts.clobberLinkGently = true
}
+ return gentleFsBinLink(from, to, opts)
}
function linkMans (pkg, folder, parent, gtop, opts) {
@@ -132,17 +134,22 @@ function linkMans (pkg, folder, parent, gtop, opts) {
// make sure that the mans are unique.
// otherwise, if there are dupes, it'll fail with EEXIST
var set = pkg.man.reduce(function (acc, man) {
+ if (typeof man !== 'string') {
+ return acc
+ }
const cleanMan = path.join('/', man).replace(/\\|:/g, '/').substr(1)
acc[path.basename(man)] = cleanMan
return acc
}, {})
var manpages = pkg.man.filter(function (man) {
+ if (typeof man !== 'string') {
+ return false
+ }
const cleanMan = path.join('/', man).replace(/\\|:/g, '/').substr(1)
return set[path.basename(man)] === cleanMan
})
return BB.map(manpages, man => {
- if (typeof man !== 'string') return
opts.log.silly('linkMans', 'preparing to link', man)
var parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/)
if (!parseMan) {
@@ -165,6 +172,11 @@ function linkMans (pkg, folder, parent, gtop, opts) {
var manDest = path.join(manRoot, 'man' + sxn, bn)
+ // man pages should always be clobbering gently, because they are
+ // only installed for top-level global packages, so never destroy
+ // a link if it doesn't point into the folder we're linking
+ opts.clobberLinkGently = true
+
return linkIfExists(manSrc, manDest, getLinkOpts(opts, gtop && folder))
})
}
diff --git a/node_modules/bin-links/package.json b/node_modules/bin-links/package.json
index 71c3ee3fcfdfc..a4d2c02226e5f 100644
--- a/node_modules/bin-links/package.json
+++ b/node_modules/bin-links/package.json
@@ -1,19 +1,19 @@
{
- "_from": "bin-links@1.1.5",
- "_id": "bin-links@1.1.5",
+ "_from": "bin-links@1.1.6",
+ "_id": "bin-links@1.1.6",
"_inBundle": false,
- "_integrity": "sha512-GQuxeiclIjomNfQ7LSaERfIz2RSZrF44c0cDEV+Iu4uVhyYndSSwl1RjjunxHU1dYqh+QCP4S/1/DUsjquNRhQ==",
+ "_integrity": "sha512-b5rV3uVyrlrJWLI3mawUUf5t2f9mCEQm/TqT5zNj6DPYhYDZaNp0AYaYd/CVASkSEklayNDLliZHVdo2J3niPw==",
"_location": "/bin-links",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
- "raw": "bin-links@1.1.5",
+ "raw": "bin-links@1.1.6",
"name": "bin-links",
"escapedName": "bin-links",
- "rawSpec": "1.1.5",
+ "rawSpec": "1.1.6",
"saveSpec": null,
- "fetchSpec": "1.1.5"
+ "fetchSpec": "1.1.6"
},
"_requiredBy": [
"#USER",
@@ -21,9 +21,9 @@
"/libcipm",
"/libnpm"
],
- "_resolved": "https://registry.npmjs.org/bin-links/-/bin-links-1.1.5.tgz",
- "_shasum": "bbbcd1d7a8101105b927d54aa895a4cc75138169",
- "_spec": "bin-links@1.1.5",
+ "_resolved": "https://registry.npmjs.org/bin-links/-/bin-links-1.1.6.tgz",
+ "_shasum": "30d33e810829305e5e61b90cfcb9a3a4f65eb516",
+ "_spec": "bin-links@1.1.6",
"_where": "/Users/isaacs/dev/npm/cli",
"author": {
"name": "Mike Sherov"
@@ -35,7 +35,7 @@
"dependencies": {
"bluebird": "^3.5.3",
"cmd-shim": "^3.0.0",
- "gentle-fs": "^2.0.1",
+ "gentle-fs": "^2.3.0",
"graceful-fs": "^4.1.15",
"npm-normalize-package-bin": "^1.0.0",
"write-file-atomic": "^2.3.0"
@@ -70,12 +70,12 @@
},
"scripts": {
"postrelease": "npm publish && git push --follow-tags",
+ "posttest": "standard",
"prerelease": "npm t",
- "pretest": "standard",
"release": "standard-version -s",
- "test": "tap -J --nyc-arg=--all --coverage test/*.js",
+ "test": "tap -J --nyc-arg=--all --coverage test/*.js --100",
"update-coc": "weallbehave -o . && git add CODE_OF_CONDUCT.md && git commit -m 'docs(coc): updated CODE_OF_CONDUCT.md'",
"update-contrib": "weallcontribute -o . && git add CONTRIBUTING.md && git commit -m 'docs(contributing): updated CONTRIBUTING.md'"
},
- "version": "1.1.5"
+ "version": "1.1.6"
}
diff --git a/package-lock.json b/package-lock.json
index 18bd93f12f192..0e502dba5686a 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -463,13 +463,13 @@
}
},
"bin-links": {
- "version": "1.1.5",
- "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-1.1.5.tgz",
- "integrity": "sha512-GQuxeiclIjomNfQ7LSaERfIz2RSZrF44c0cDEV+Iu4uVhyYndSSwl1RjjunxHU1dYqh+QCP4S/1/DUsjquNRhQ==",
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/bin-links/-/bin-links-1.1.6.tgz",
+ "integrity": "sha512-b5rV3uVyrlrJWLI3mawUUf5t2f9mCEQm/TqT5zNj6DPYhYDZaNp0AYaYd/CVASkSEklayNDLliZHVdo2J3niPw==",
"requires": {
"bluebird": "^3.5.3",
"cmd-shim": "^3.0.0",
- "gentle-fs": "^2.0.1",
+ "gentle-fs": "^2.3.0",
"graceful-fs": "^4.1.15",
"npm-normalize-package-bin": "^1.0.0",
"write-file-atomic": "^2.3.0"
diff --git a/package.json b/package.json
index 833a79d59b8a8..073c4e06b2ee5 100644
--- a/package.json
+++ b/package.json
@@ -39,7 +39,7 @@
"ansistyles": "~0.1.3",
"aproba": "^2.0.0",
"archy": "~1.0.0",
- "bin-links": "^1.1.5",
+ "bin-links": "^1.1.6",
"bluebird": "^3.5.5",
"byte-size": "^5.0.1",
"cacache": "^12.0.3",