Skip to content
This repository has been archived by the owner on Mar 13, 2024. It is now read-only.

Commit

Permalink
Minor refactoring of bin resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
voxpelli committed Jul 28, 2019
1 parent ca55986 commit 0320bb7
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -201,14 +201,13 @@ function resolveDefaultEntriesPaths (opts) {

// Add the path of binaries
if (pkg.bin) {
if (typeof pkg.bin === 'string') {
paths.push(joinAndResolvePath(pkgDir, pkg.bin))
} else {
Object.keys(pkg.bin).forEach(cmdName => {
const cmd = pkg.bin[cmdName]
paths.push(joinAndResolvePath(pkgDir, cmd))
})
}
const binPaths = typeof pkg.bin === 'string'
? [pkg.bin]
: Object.values(pkg.bin)

binPaths.forEach(cmd => {
paths.push(joinAndResolvePath(pkgDir, cmd))
})
}

return paths
Expand Down

0 comments on commit 0320bb7

Please sign in to comment.