diff options
author | isaacs <i@izs.me> | 2010-08-25 03:47:50 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-08-25 16:21:51 +0400 |
commit | 0d4adf74854c37bba02a23566a4b2ec236580932 (patch) | |
tree | 696cda561951bedde884d89b4a167af2ab5be4c9 | |
parent | 7daa66b1948cc05818927186b7f4a32b7791b6f3 (diff) |
Strip extensions from bin keys that are created from filenames
-rw-r--r-- | lib/utils/load-package-defaults.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/utils/load-package-defaults.js b/lib/utils/load-package-defaults.js index 935c1acc7..c8632789c 100644 --- a/lib/utils/load-package-defaults.js +++ b/lib/utils/load-package-defaults.js @@ -26,7 +26,7 @@ function readDefaultModules(pkg, cb) { find(libDir, /\.(js|node)$/, function (er, filenames) { if (er) return cb(er) filenames.forEach(function (filename) { - filename = filename.replace(/\.(js|node)$/, '') + filename = path.basename(filename, path.extname(filename)) pkg.modules[filename.substr(libDir.length + 1)] = filename.substr(pkgDir.length + 1) }) @@ -45,8 +45,9 @@ function readDefaultBins (pkg, cb) { log.silly(filenames, "default bins") if (er) return cb(er) filenames.forEach(function (filename) { - pkg.bin[filename.substr(binDir.length + 1)] = - filename.substr(pkgDir.length + 1) + var key = filename.substr(binDir.length + 1) + .replace(/\.(js|node)$/, '') + pkg.bin[key] = filename.substr(pkgDir.length + 1) }) log.silly(pkg.bin, pkg._id+".bin") cb(null, pkg) |