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

Commit

Permalink
Closes #1199 Support 'npm unpublish .'
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Jul 28, 2011
1 parent 22f23e7 commit f451082
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/unpublish.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ function unpublish (args, cb) {
var thing = args.length ? args.shift().split("@") : []
, project = thing.shift()
, version = thing.join("@")
if (!project) {

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.
var cwdJson = path.join(process.cwd(), "package.json")
Expand All @@ -52,6 +53,7 @@ function unpublish (args, cb) {
}
return gotProject(project, version, cb)
}

function gotProject (project, version, cb) {
// remove from the cache first
npm.commands.cache(["clean", project, version], function (er) {
Expand Down

0 comments on commit f451082

Please sign in to comment.