diff options
-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" |