git-bump-cli
Advanced tools
Comparing version 1.1.1 to 1.3.0
@@ -19,5 +19,7 @@ #!/usr/bin/env node | ||
var defaults = { | ||
push:false | ||
} | ||
var options = _.extend({},defaults,{ | ||
push:cli.flags.push, | ||
}) | ||
@@ -29,4 +31,2 @@ | ||
console.log(type) | ||
self(type,options); |
53
index.js
@@ -11,14 +11,4 @@ const path = require('path'); | ||
// insert defaults here | ||
var defaults = { | ||
files:['bower.json','package.json'], | ||
message:'new version' | ||
} | ||
var getFiles = function(files){ | ||
return _.map(files,function(file){ | ||
return path.join(process.env.PWD,file); | ||
}) | ||
} | ||
var self = function(type='patch',options,done){ | ||
var self = function(type,options,done){ | ||
if(typeof options === 'function'){ | ||
@@ -28,4 +18,17 @@ done = options; | ||
var defaults = { | ||
files:['bower.json','package.json'], | ||
dest:process.env.PWD, | ||
push:false, | ||
message:'new version' | ||
} | ||
if(!type || !semver.inc('0.0.1',type)) type = 'patch'; | ||
var getFiles = function(files){ | ||
return _.map(files,function(file){ | ||
return path.join(options.dest,file); | ||
}) | ||
} | ||
options = _.extend({},defaults,options); | ||
@@ -35,2 +38,3 @@ | ||
files:function(callback){ | ||
// console.log('files') | ||
glob(getFiles(options.files)) | ||
@@ -40,5 +44,7 @@ .then(files => callback(null,files)); | ||
bump:['files',function(results,callback){ | ||
var {files} = results; | ||
// console.log('bump') | ||
var files = results.files; | ||
var run = []; | ||
_.each(files,function(filePath){ | ||
@@ -62,3 +68,4 @@ run.push(function(callback){ | ||
version:['bump',function(results,callback){ | ||
var {files} = results; | ||
// console.log('version') | ||
var files = results.files; | ||
@@ -71,4 +78,6 @@ fs.readFile(files[0],function(err,file){ | ||
gitTag:['version',function(results,callback){ | ||
var {version,files} = results; | ||
var pipe = git(process.env.PWD); | ||
// console.log('gitTag') | ||
var files = results.files; | ||
var version = results.version; | ||
var pipe = git(options.dest); | ||
@@ -79,3 +88,3 @@ _.each(files,function(file){ | ||
console.log(version,type) | ||
// console.log(version,type) | ||
@@ -87,2 +96,12 @@ pipe.commit(options.message+' '+version) | ||
}) | ||
}], | ||
push:['gitTag',function(results,callback){ | ||
if(!options.push){ | ||
callback(null); | ||
return; | ||
} | ||
git(options.dest) | ||
.raw(['push','origin','HEAD','--tags']) | ||
.exec(callback); | ||
}] | ||
@@ -95,3 +114,3 @@ },function(err,results){ | ||
if(done) done(results); | ||
if(done) done(err,results); | ||
}) | ||
@@ -98,0 +117,0 @@ } |
{ | ||
"name": "git-bump-cli", | ||
"version": "1.1.1", | ||
"version": "1.3.0", | ||
"description": "CLI for update package.json version and git tag it", | ||
@@ -12,3 +12,4 @@ "main": "index.js", | ||
"scripts": { | ||
"start": "nodemon test.js --watch index.js --watch test.js --exec 'ava'" | ||
"start": "nodemon test.js --watch index.js --watch test.js --exec 'ava'", | ||
"test": "ava" | ||
}, | ||
@@ -25,3 +26,6 @@ "dependencies": { | ||
"devDependencies": { | ||
"ava": "^0.18.2" | ||
"ava": "^0.18.2", | ||
"data-creatures": "^1.0.1", | ||
"mkdirp": "^0.5.1", | ||
"tempfile": "^2.0.0" | ||
}, | ||
@@ -28,0 +32,0 @@ "keywords": [ |
# git-bump-cli | ||
[![NPM version][npm-image]][npm-url] | ||
<!-- [![Build status][travis-image]][travis-url] --> | ||
<!-- [![Test coverage][coveralls-image]][coveralls-url] --> | ||
[![Build status][travis-image]][travis-url] | ||
@@ -48,4 +47,4 @@ > Bump package.json version and git tags it | ||
[npm-url]: https://npmjs.org/package/git-bump-cli | ||
<!-- [travis-image]: https://img.shields.io/travis/webcaetano/git-bump-cli.svg?style=flat-square | ||
[travis-image]: https://img.shields.io/travis/webcaetano/git-bump-cli.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/webcaetano/git-bump-cli | ||
--> | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
5984
116
2
4
50