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

Commit

Permalink
Close #974 Better 'doing it wrong' output for 'npm version'
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed May 30, 2011
1 parent b1f6cf2 commit c82ea14
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/version.js
Expand Up @@ -12,13 +12,15 @@ var exec = require("./utils/exec")
, npm = require("../npm")

version.usage = "npm version <newversion>\n(run in package dir)\n"
+ "'npm -v' or 'npm --version' to print npm version\n"
+ "(which is "+npm.version+")"
+ "'npm -v' or 'npm --version' to print npm version "
+ "("+npm.version+")\n"
+ "'npm view <pkg> version' to view a package's "
+ "published version"

function version (args, cb) {
if (args.length !== 1) return cb(version.usage)
var newVer = semver.valid(args[0])
if (!newVer) return cb(new Error("invalid version: "+args[0]))
if (!newVer) return cb(version.usage)
readJson(path.join(process.cwd(), "package.json"), function (er, data) {
if (er) return log.er(cb, "No package.json found")(er)
if (data.version === newVer) return cb(new Error("Version not changed"))
Expand Down

0 comments on commit c82ea14

Please sign in to comment.