Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-07-27 20:53:30 +0400
committerisaacs <i@izs.me>2010-08-26 05:01:24 +0400
commit2dbaf0d208b9d23ca3e49848c0fd98b2c253de68 (patch)
tree5a01577b5be64116707b91228f82e00eb6c885e1
parent329fa3446219a7a7a95ebf1ec0930b97b1f7e62e (diff)
First crack at something resembling a fix for #74
-rw-r--r--lib/bundle.js22
-rwxr-xr-xnpm.js1
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)
+ })
+}
diff --git a/npm.js b/npm.js
index 0b11487de..dc52eae5a 100755
--- a/npm.js
+++ b/npm.js
@@ -46,6 +46,7 @@ var commandCache = {}
, "view"
, "repl"
, "rebuild"
+ , "bundle"
].forEach(function (c) {
Object.defineProperty(npm.commands, c, { get : function () {
c = c === "list" ? "ls"