1const linkBins = require('./link-bins.js') 2const linkMans = require('./link-mans.js') 3 4const binLinks = opts => { 5 const { path, pkg, force, global, top } = opts 6 // global top pkgs on windows get bins installed in {prefix}, and no mans 7 // 8 // unix global top pkgs get their bins installed in {prefix}/bin, 9 // and mans in {prefix}/share/man 10 // 11 // non-top pkgs get their bins installed in {prefix}/node_modules/.bin, 12 // and do not install mans 13 // 14 // non-global top pkgs don't have any bins or mans linked. From here on 15 // out, if it's top, we know that it's global, so no need to pass that 16 // option further down the stack. 17 if (top && !global) { 18 return Promise.resolve() 19 } 20 21 return Promise.all([ 22 // allow clobbering within the local node_modules/.bin folder. 23 // only global bins are protected in this way, or else it is 24 // yet another vector for excessive dependency conflicts. 25 linkBins({ path, pkg, top, force: force || !top }), 26 linkMans({ path, pkg, top, force }), 27 ]) 28} 29 30const shimBin = require('./shim-bin.js') 31const linkGently = require('./link-gently.js') 32const resetSeen = () => { 33 shimBin.resetSeen() 34 linkGently.resetSeen() 35} 36 37const checkBins = require('./check-bins.js') 38const getPaths = require('./get-paths.js') 39 40module.exports = Object.assign(binLinks, { 41 checkBins, 42 resetSeen, 43 getPaths, 44}) 45