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>2011-12-08 20:48:21 +0400
committerisaacs <i@izs.me>2011-12-08 20:48:21 +0400
commitcc17a5460f020900e4f998b6e0ef3b571f0fb0b4 (patch)
treefef4ff7512ead52ffc4a0f9ebffc338362c1f3d5
parent4e5130bdcee41059b5fb2ff72b2b811bfd4f839a (diff)
Make it harder to accidentally the project
-rw-r--r--lib/unpublish.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/unpublish.js b/lib/unpublish.js
index 2945a7887..b7f6cbec8 100644
--- a/lib/unpublish.js
+++ b/lib/unpublish.js
@@ -39,10 +39,19 @@ unpublish.completion = function (opts, cb) {
}
function unpublish (args, cb) {
+
+ if (args.length > 1) return cb(unpublish.usage)
+
var thing = args.length ? args.shift().split("@") : []
, project = thing.shift()
, version = thing.join("@")
+ if (!version && !npm.config.get("force")) {
+ return cb("Refusing to delete entire project.\n"
+ +"Run with --force to do this.\n"
+ +unpublish.usage)
+ }
+
if (!project || path.resolve(project) === npm.prefix) {
// if there's a package.json in the current folder, then
// read the package name and version out of that.