From 70b20c8793e63483eb76e95c6495f03b8dd3dd89 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bazyli=20Brz=C3=B3ska?= Date: Sun, 27 Nov 2016 01:13:44 +0100 Subject: [PATCH] feat: make tag prefix configurable (#143) --- command.js | 7 +++++++ defaults.json | 3 ++- index.js | 2 +- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/command.js b/command.js index e6fcdd443..83242af41 100755 --- a/command.js +++ b/command.js @@ -63,6 +63,13 @@ module.exports = require('yargs') default: defaults.silent, global: true }) + .option('tag-prefix', { + alias: 't', + describe: 'Set a custom prefix for the git tag to be created', + type: 'string', + default: defaults.tagPrefix, + global: true + }) .version() .alias('version', 'v') .help() diff --git a/defaults.json b/defaults.json index bb0c6f416..26ef43c73 100644 --- a/defaults.json +++ b/defaults.json @@ -5,5 +5,6 @@ "sign": false, "noVerify": false, "commitAll": false, - "silent": false + "silent": false, + "tagPrefix": "v" } diff --git a/index.js b/index.js index a619c9ccb..906d2e7b6 100755 --- a/index.js +++ b/index.js @@ -203,7 +203,7 @@ function tag (newVersion, pkgPrivate, argv, cb) { tagOption = '-a ' } checkpoint(argv, 'tagging release %s', [newVersion]) - handledExec(argv, 'git tag ' + tagOption + 'v' + newVersion + ' -m "' + formatCommitMessage(argv.message, newVersion) + '"', cb, function () { + handledExec(argv, 'git tag ' + tagOption + argv.tagPrefix + newVersion + ' -m "' + formatCommitMessage(argv.message, newVersion) + '"', cb, function () { var message = 'git push --follow-tags origin master' if (pkgPrivate !== true) message += '; npm publish'