Comparing version 0.0.1 to 0.0.2
15
cli.js
@@ -16,5 +16,7 @@ #!/usr/bin/env node | ||
console.log('Custom options:'); | ||
console.log(' $ bump -t=major -i=4'); | ||
console.log(' $ bump -t=major -i=4 -g=0'); | ||
console.log(' $ bump --type=major --indentation=4'); | ||
console.log(' $ bump --type=minor --indentation=tab'); | ||
console.log(' $ bump --type=minor --git=0'); | ||
console.log(' $ bump --type=minor --git=0'); | ||
} | ||
@@ -27,2 +29,3 @@ | ||
var type = 'patch'; | ||
var git = 1; | ||
@@ -34,2 +37,5 @@ process.argv.forEach(function (val) { | ||
} | ||
if(item[0] === '-g' || item[0] === '--git') { | ||
git = Number(item[1]); | ||
} | ||
if(item[0] === '-i' || item[0] === '--indentation') { | ||
@@ -47,3 +53,8 @@ if(!isNaN(Number(item[1]))){ | ||
pkg.version = semver.inc(pkg.version, type); | ||
exec("git tag " + pkg.version, puts); | ||
if(git){ | ||
exec('git tag ' + pkg.version, puts); | ||
exec('git add package.json', puts); | ||
exec('git commit -m "bump to "'+ pkg.version, puts); | ||
exec('git push origin master', puts); | ||
} | ||
fs.writeFileSync(process.cwd() + '/package.json', JSON.stringify(pkg, null, indentation)); | ||
@@ -50,0 +61,0 @@ } catch(e) { |
{ | ||
"name": "bump-tag", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Bump version and add tag", | ||
@@ -37,2 +37,2 @@ "keywords": [ | ||
"readmeFilename": "Readme.md" | ||
} | ||
} |
@@ -5,2 +5,4 @@ # bump-tag [![Build Status](https://travis-ci.org/danielhusar/bump-tag.svg)](https://travis-ci.org/danielhusar/bump-tag) | ||
I have created this cli mainly because I keep forgetting to add tag when I bump the version. | ||
## Install | ||
@@ -35,3 +37,3 @@ | ||
Major, Minor or Patch. | ||
Check (node-semver)[https://github.com/isaacs/node-semver#functions] inc release parameter. | ||
Check [node-semver](https://github.com/isaacs/node-semver#functions) inc release parameter. | ||
@@ -38,0 +40,0 @@ #### indentation |
3337
64
47