Skip to content
This repository has been archived by the owner on Aug 11, 2022. It is now read-only.

Commit

Permalink
Make it harder to accidentally the project
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Dec 8, 2011
1 parent 4e5130b commit cc17a54
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/unpublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit cc17a54

Please sign in to comment.