11cb0ef41Sopenharmony_ciconst linkBins = require('./link-bins.js') 21cb0ef41Sopenharmony_ciconst linkMans = require('./link-mans.js') 31cb0ef41Sopenharmony_ci 41cb0ef41Sopenharmony_ciconst binLinks = opts => { 51cb0ef41Sopenharmony_ci const { path, pkg, force, global, top } = opts 61cb0ef41Sopenharmony_ci // global top pkgs on windows get bins installed in {prefix}, and no mans 71cb0ef41Sopenharmony_ci // 81cb0ef41Sopenharmony_ci // unix global top pkgs get their bins installed in {prefix}/bin, 91cb0ef41Sopenharmony_ci // and mans in {prefix}/share/man 101cb0ef41Sopenharmony_ci // 111cb0ef41Sopenharmony_ci // non-top pkgs get their bins installed in {prefix}/node_modules/.bin, 121cb0ef41Sopenharmony_ci // and do not install mans 131cb0ef41Sopenharmony_ci // 141cb0ef41Sopenharmony_ci // non-global top pkgs don't have any bins or mans linked. From here on 151cb0ef41Sopenharmony_ci // out, if it's top, we know that it's global, so no need to pass that 161cb0ef41Sopenharmony_ci // option further down the stack. 171cb0ef41Sopenharmony_ci if (top && !global) { 181cb0ef41Sopenharmony_ci return Promise.resolve() 191cb0ef41Sopenharmony_ci } 201cb0ef41Sopenharmony_ci 211cb0ef41Sopenharmony_ci return Promise.all([ 221cb0ef41Sopenharmony_ci // allow clobbering within the local node_modules/.bin folder. 231cb0ef41Sopenharmony_ci // only global bins are protected in this way, or else it is 241cb0ef41Sopenharmony_ci // yet another vector for excessive dependency conflicts. 251cb0ef41Sopenharmony_ci linkBins({ path, pkg, top, force: force || !top }), 261cb0ef41Sopenharmony_ci linkMans({ path, pkg, top, force }), 271cb0ef41Sopenharmony_ci ]) 281cb0ef41Sopenharmony_ci} 291cb0ef41Sopenharmony_ci 301cb0ef41Sopenharmony_ciconst shimBin = require('./shim-bin.js') 311cb0ef41Sopenharmony_ciconst linkGently = require('./link-gently.js') 321cb0ef41Sopenharmony_ciconst resetSeen = () => { 331cb0ef41Sopenharmony_ci shimBin.resetSeen() 341cb0ef41Sopenharmony_ci linkGently.resetSeen() 351cb0ef41Sopenharmony_ci} 361cb0ef41Sopenharmony_ci 371cb0ef41Sopenharmony_ciconst checkBins = require('./check-bins.js') 381cb0ef41Sopenharmony_ciconst getPaths = require('./get-paths.js') 391cb0ef41Sopenharmony_ci 401cb0ef41Sopenharmony_cimodule.exports = Object.assign(binLinks, { 411cb0ef41Sopenharmony_ci checkBins, 421cb0ef41Sopenharmony_ci resetSeen, 431cb0ef41Sopenharmony_ci getPaths, 441cb0ef41Sopenharmony_ci}) 45