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
path: root/lib
diff options
context:
space:
mode:
authorMaciej MaƂecki <maciej.malecki@notimplemented.org>2011-09-26 22:35:26 +0400
committerisaacs <i@izs.me>2011-10-13 06:02:59 +0400
commitd52386b40d1f7896e259b4deb559e8496ef4ecec (patch)
tree051d5b64a748669f079278894a7c532144445825 /lib
parent2999a8516970c2613337e5cfb03ad83852ea0c1b (diff)
Add --message option and -m shorthand
Specify commit message when creating a tag Use --message/-m option when commiting changes in `npm version`. Mention message option in `npm version` docs Mention message option in doc/cli/config.md
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/config-defs.js3
-rw-r--r--lib/version.js6
2 files changed, 7 insertions, 2 deletions
diff --git a/lib/utils/config-defs.js b/lib/utils/config-defs.js
index 2824080e0..2ff8de652 100644
--- a/lib/utils/config-defs.js
+++ b/lib/utils/config-defs.js
@@ -146,6 +146,7 @@ Object.defineProperty(exports, "defaults", {get: function () {
, loglevel : "warn"
, logprefix : process.platform !== "win32"
, long : false
+ , message : "%s"
, "node-version" : process.version
, npaturl : "http://npat.npmjs.org/"
, npat : false
@@ -226,6 +227,7 @@ exports.types =
, loglevel : ["silent","win","error","warn","info","verbose","silly"]
, logprefix : Boolean
, long : Boolean
+ , message: String
, "node-version" : [null, semver]
, npaturl : url
, npat : Boolean
@@ -284,6 +286,7 @@ exports.shorthands =
, "no-desc" : ["--no-description"]
, "local" : ["--no-global"]
, l : ["--long"]
+ , m : ["--message"]
, p : ["--parseable"]
, porcelain : ["--parseable"]
, g : ["--global"]
diff --git a/lib/version.js b/lib/version.js
index 77aaa0ec6..8d481ea89 100644
--- a/lib/version.js
+++ b/lib/version.js
@@ -11,7 +11,8 @@ var exec = require("./utils/exec.js")
, log = require("./utils/log.js")
, npm = require("../npm.js")
-version.usage = "npm version <newversion>\n(run in package dir)\n"
+version.usage = "npm version <newversion> [--message commit-message]"
+ + "\n(run in package dir)\n"
+ "'npm -v' or 'npm --version' to print npm version "
+ "("+npm.version+")\n"
+ "'npm view <pkg> version' to view a package's "
@@ -46,9 +47,10 @@ function checkGit (data, cb) {
"Git working directory not clean.\n"+lines.join("\n")))
write(data, function (er) {
if (er) return cb(er)
+ var message = npm.config.get("message").replace(/%s/g, data.version)
chain
( [ [ exec, "git", ["add","package.json"], process.env, false ]
- , [ exec, "git", ["commit", "-m", "version "+data.version]
+ , [ exec, "git", ["commit", "-m", message ]
, process.env, false ]
, [ exec, "git", ["tag", "v"+data.version], process.env, false ] ]
, cb )