PR-URL: https://github.com/nodejs/node/pull/41621 Reviewed-By: Ruy Adorno <ruyadorno@github.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com> Reviewed-By: Richard Lau <rlau@redhat.com>
19 lines
493 B
JavaScript
19 lines
493 B
JavaScript
const checkBin = require('./check-bin.js')
|
|
const normalize = require('npm-normalize-package-bin')
|
|
const checkBins = async ({ pkg, path, top, global, force }) => {
|
|
// always ok to clobber when forced
|
|
// always ok to clobber local bins, or when forced
|
|
if (force || !global || !top) {
|
|
return
|
|
}
|
|
|
|
pkg = normalize(pkg)
|
|
if (!pkg.bin) {
|
|
return
|
|
}
|
|
|
|
await Promise.all(Object.keys(pkg.bin)
|
|
.map(bin => checkBin({ bin, path, top, global, force })))
|
|
}
|
|
module.exports = checkBins
|