diff options
Diffstat (limited to 'deps/npm/lib/unbuild.js')
-rw-r--r-- | deps/npm/lib/unbuild.js | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/deps/npm/lib/unbuild.js b/deps/npm/lib/unbuild.js index 1cbf054e1..c89a538f2 100644 --- a/deps/npm/lib/unbuild.js +++ b/deps/npm/lib/unbuild.js @@ -76,19 +76,27 @@ function rmMans (pkg, folder, parent, top, cb) { } var manRoot = path.resolve(npm.config.get("prefix"), "share", "man") asyncMap(pkg.man, function (man, cb) { - var parseMan = man.match(/(.*)\.([0-9]+)(\.gz)?$/) - , stem = parseMan[1] - , sxn = parseMan[2] - , gz = parseMan[3] || "" - , bn = path.basename(stem) - , manDest = path.join( manRoot - , "man"+sxn - , (bn.indexOf(pkg.name) === 0 ? bn - : pkg.name + "-" + bn) - + "." + sxn + gz - ) - gentlyRm( manDest - , !npm.config.get("force") && folder - , cb ) + if (Array.isArray(man)) { + man.forEach(rm) + } else { + rm(man) + } + + function rm(man) { + var parseMan = man.match(/(.*)\.([0-9]+)(\.gz)?$/) + , stem = parseMan[1] + , sxn = parseMan[2] + , gz = parseMan[3] || "" + , bn = path.basename(stem) + , manDest = path.join( manRoot + , "man"+sxn + , (bn.indexOf(pkg.name) === 0 ? bn + : pkg.name + "-" + bn) + + "." + sxn + gz + ) + gentlyRm( manDest + , !npm.config.get("force") && folder + , cb ) + } }, cb) } |