Permalink
Browse files

Add `bundle destroy`

  • Loading branch information...
1 parent d7ab4c3 commit 85b372bcbffe97ebad61ae06ab2c5d69390b6e11 @isaacs isaacs committed Dec 6, 2010
Showing with 19 additions and 3 deletions.
  1. +5 −1 doc/bundle.md
  2. +8 −1 lib/bundle.js
  3. +6 −1 man1/bundle.1
View
@@ -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`.
View
@@ -9,19 +9,21 @@ 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)"
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") {
View
@@ -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\|\.

0 comments on commit 85b372b

Please sign in to comment.