diff options
author | isaacs <i@izs.me> | 2010-07-27 20:53:30 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-08-26 05:01:24 +0400 |
commit | 2dbaf0d208b9d23ca3e49848c0fd98b2c253de68 (patch) | |
tree | 5a01577b5be64116707b91228f82e00eb6c885e1 | |
parent | 329fa3446219a7a7a95ebf1ec0930b97b1f7e62e (diff) |
First crack at something resembling a fix for #74
-rw-r--r-- | lib/bundle.js | 22 | ||||
-rwxr-xr-x | npm.js | 1 |
2 files changed, 23 insertions, 0 deletions
diff --git a/lib/bundle.js b/lib/bundle.js new file mode 100644 index 000000000..5dd6d0b59 --- /dev/null +++ b/lib/bundle.js @@ -0,0 +1,22 @@ + +module.exports = bundle + +var npm = require("../npm") + , fs = require("fs") + , path = require("path") + , log = require("./utils/log") +function bundle (args, cb) { + log(args, "bundle") + var location = args.pop() + , usage = "Usage: npm bundle [<pkg> [<pkg> ...]] <location>" + if (!location) return cb(new Error(usage)) + if (location.charAt(0) !== "/") { + location = path.join(process.cwd(), location) + } + fs.stat(location, function (er, s) { + if (er || !s.isDirectory()) return cb(new Error(usage)) + npm.config.set("root", location) + npm.config.set("binroot", null) + npm.commands.install(args, cb) + }) +} @@ -46,6 +46,7 @@ var commandCache = {} , "view" , "repl" , "rebuild" + , "bundle" ].forEach(function (c) { Object.defineProperty(npm.commands, c, { get : function () { c = c === "list" ? "ls" |