bin-links
Advanced tools
Comparing version 3.0.0 to 3.0.1
@@ -60,5 +60,5 @@ // check to see if a bin is allowed to be overwritten | ||
] | ||
await Promise.all(shims.map(async target => { | ||
const current = await readCmdShim(target) | ||
.catch(er => handleReadCmdShimError({ er, target })) | ||
await Promise.all(shims.map(async shim => { | ||
const current = await readCmdShim(shim) | ||
.catch(er => handleReadCmdShimError({ er, target: shim })) | ||
@@ -69,6 +69,6 @@ if (!current) { | ||
const resolved = resolve(dirname(target), current.replace(/\\/g, '/')) | ||
const resolved = resolve(dirname(shim), current.replace(/\\/g, '/')) | ||
if (resolved.toLowerCase().indexOf(path.toLowerCase()) !== 0) { | ||
return failEEXIST({ target }) | ||
return failEEXIST({ target: shim }) | ||
} | ||
@@ -75,0 +75,0 @@ })) |
@@ -6,3 +6,3 @@ // get all the paths that are (or might be) installed for a given pkg | ||
const manTarget = require('./man-target.js') | ||
const { resolve, basename } = require('path') | ||
const { resolve, basename, extname } = require('path') | ||
const isWindows = require('./is-windows.js') | ||
@@ -31,19 +31,10 @@ module.exports = ({ path, pkg, global, top }) => { | ||
for (const man of pkg.man) { | ||
const parseMan = man.match(/(.*\.([0-9]+)(\.gz)?)$/) | ||
// invalid entries invalidate the entire man set | ||
if (!parseMan) { | ||
if (!/.\.[0-9]+(\.gz)?$/.test(man)) { | ||
return binSet | ||
} | ||
const stem = parseMan[1] | ||
const sxn = parseMan[2] | ||
const base = basename(stem) | ||
const absFrom = resolve(path, man) | ||
const section = extname(basename(man, '.gz')).slice(1) | ||
const base = basename(man) | ||
/* istanbul ignore if - should be impossible */ | ||
if (absFrom.indexOf(path) !== 0) { | ||
return binSet | ||
} | ||
manSet.push(resolve(manTarg, 'man' + sxn, base)) | ||
manSet.push(resolve(manTarg, 'man' + section, base)) | ||
} | ||
@@ -50,0 +41,0 @@ } |
@@ -14,3 +14,3 @@ const { dirname, relative, join, resolve, basename } = require('path') | ||
const set = [...new Set(pkg.man.map(man => | ||
man ? join('/', man).replace(/\\|:/g, '/').substr(1) : null) | ||
man ? join('/', man).replace(/\\|:/g, '/').slice(1) : null) | ||
.filter(man => typeof man === 'string'))] | ||
@@ -17,0 +17,0 @@ |
{ | ||
"name": "bin-links", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "JavaScript package binary linker", | ||
@@ -12,10 +12,11 @@ "main": "./lib/index.js", | ||
"test": "tap", | ||
"lint": "eslint '**/*.js'", | ||
"postlint": "npm-template-check", | ||
"lint": "eslint \"**/*.js\"", | ||
"postlint": "template-oss-check", | ||
"lintfix": "npm run lint -- --fix", | ||
"posttest": "npm run lint" | ||
"posttest": "npm run lint", | ||
"template-oss-apply": "template-oss-apply --force" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/npm/bin-links.git" | ||
"url": "https://github.com/npm/bin-links.git" | ||
}, | ||
@@ -29,6 +30,6 @@ "keywords": [ | ||
"dependencies": { | ||
"cmd-shim": "^4.0.1", | ||
"cmd-shim": "^5.0.0", | ||
"mkdirp-infer-owner": "^2.0.0", | ||
"npm-normalize-package-bin": "^1.0.0", | ||
"read-cmd-shim": "^2.0.0", | ||
"read-cmd-shim": "^3.0.0", | ||
"rimraf": "^3.0.0", | ||
@@ -38,3 +39,4 @@ "write-file-atomic": "^4.0.0" | ||
"devDependencies": { | ||
"@npmcli/template-oss": "^2.5.0", | ||
"@npmcli/eslint-config": "^3.0.1", | ||
"@npmcli/template-oss": "3.2.2", | ||
"mkdirp": "^1.0.3", | ||
@@ -49,13 +51,14 @@ "require-inject": "^1.4.4", | ||
"files": [ | ||
"bin", | ||
"lib" | ||
"bin/", | ||
"lib/" | ||
], | ||
"engines": { | ||
"node": "^12.13.0 || ^14.15.0 || >=16" | ||
"node": "^12.13.0 || ^14.15.0 || >=16.0.0" | ||
}, | ||
"author": "GitHub Inc.", | ||
"templateOSS": { | ||
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.", | ||
"windowsCI": false, | ||
"version": "2.5.0" | ||
"version": "3.2.2" | ||
} | ||
} |
21189
5
453
+ Addedcmd-shim@5.0.0(transitive)
+ Addedread-cmd-shim@3.0.1(transitive)
- Removedcmd-shim@4.1.0(transitive)
- Removedread-cmd-shim@2.0.0(transitive)
Updatedcmd-shim@^5.0.0
Updatedread-cmd-shim@^3.0.0