diff options
Diffstat (limited to 'lib/bundle.js')
-rw-r--r-- | lib/bundle.js | 22 |
1 files changed, 22 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) + }) +} |