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-12-06 23:07:30 +0300
committerisaacs <i@izs.me>2010-12-06 23:07:30 +0300
commit85b372bcbffe97ebad61ae06ab2c5d69390b6e11 (patch)
tree0858af9e01c7d3d91b58807f4b26b89aca8200e5
parentd7ab4c3b011cc667c726ba537fbf68ac10eb1ae9 (diff)
Add `bundle destroy`
-rw-r--r--doc/bundle.md6
-rw-r--r--lib/bundle.js9
-rw-r--r--man1/bundle.17
3 files changed, 19 insertions, 3 deletions
diff --git a/doc/bundle.md b/doc/bundle.md
index 2a205b7b9..dda6bf9bd 100644
--- a/doc/bundle.md
+++ b/doc/bundle.md
@@ -3,7 +3,9 @@ npm-bundle(1) -- Bundle package dependencies
## SYNOPSIS
- npm bundle [<cmd> ...]
+ npm bundle
+ npm bundle destroy
+ npm bundle <cmd> <args>
Run in a package folder.
@@ -21,6 +23,8 @@ dependencies that already exist in the bundle.
To bundle all the dependencies of a given package, run `npm bundle`
without any arguments.
+To completely remove the bundle folder, run `npm bundle destroy`.
+
To operate on the bundle packages, any npm command and arguments may be
passed to the `npm bundle` command. For example, to install a package
into the bundle, you can do `npm bundle install express`.
diff --git a/lib/bundle.js b/lib/bundle.js
index 51a8269e0..81d5128c0 100644
--- a/lib/bundle.js
+++ b/lib/bundle.js
@@ -9,11 +9,13 @@ var npm = require("../npm")
, mkdir = require("./utils/mkdir-p")
, fs = require("./utils/graceful-fs")
, conf = require("./utils/ini").configList
+ , rm = require("./utils/rm-rf")
, notAllowed = [ "adduser", "build", "bundle", "config", "init", "link"
, "owner", "publish", "restart", "start", "stop", "tag"
, "unpublish", "update-dependents", "view" ]
bundle.usage = "npm bundle\n"
+ + "npm bundle destroy\n"
+ "npm bundle <cmd> <args>\n"
+ "(run in package dir)"
@@ -21,7 +23,7 @@ bundle.completion = function(args, index, cb) {
var getCompletions = require("./utils/completion/get-completions")
, subcmdList = npm.fullList.filter(function(c) {
return notAllowed.indexOf(c) === -1
- })
+ }).concat(["destroy"])
, subcmd = args[0] || ""
if (subcmdList.indexOf(subcmd) !== -1) {
@@ -63,6 +65,11 @@ function bundle (args, cb_) {
if (cmd === npm.commands.ls) c.registry = null
}
+ if (cmd === "destroy") return rm(location, function (er) {
+ if (er) return cb(er)
+ log.info(location, "destroyed", cb)
+ })
+
mkdir(npm.dir, function(er) {
if (er) return log.er(cb, "Error creating "+npm.dir+" for bundling")(er)
if (typeof cmd === "function") {
diff --git a/man1/bundle.1 b/man1/bundle.1
index f0c3e35fe..da602a521 100644
--- a/man1/bundle.1
+++ b/man1/bundle.1
@@ -9,7 +9,9 @@
.SH "SYNOPSIS"
.
.nf
-npm bundle [<cmd> \.\.\.]
+npm bundle
+npm bundle destroy
+npm bundle <cmd> <args>
.
.fi
.
@@ -33,6 +35,9 @@ To bundle all the dependencies of a given package, run \fBnpm bundle\fR
without any arguments\.
.
.P
+To completely remove the bundle folder, run \fBnpm bundle destroy\fR\|\.
+.
+.P
To operate on the bundle packages, any npm command and arguments may be
passed to the \fBnpm bundle\fR command\. For example, to install a package
into the bundle, you can do \fBnpm bundle install express\fR\|\.