Skip to content

Commit 8a6aa48

Browse files
committed
Added gulp-tag-version to easily manage semver
1 parent 7dad173 commit 8a6aa48

File tree

3 files changed

+43
-2
lines changed

3 files changed

+43
-2
lines changed

gulpfile.js

+38
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ var del = require('del');
1111
var size = require('gulp-filesize');
1212
var usemin = require('gulp-usemin');
1313
var rev = require('gulp-rev');
14+
var git = require('gulp-git');
15+
var bump = require('gulp-bump');
16+
var filter = require('gulp-filter');
17+
var tag_version = require('gulp-tag-version');
1418

1519
gulp.task('default',['build', 'templates'], function(){
1620

@@ -91,3 +95,37 @@ gulp.task('build',['templates'], function(){
9195
.pipe(size())
9296
.pipe(gulp.dest('dist/'));
9397
});
98+
99+
100+
/**
101+
* Bumping version number and tagging the repository with it.
102+
* Please read http://semver.org/
103+
*
104+
* You can use the commands
105+
*
106+
* gulp patch # makes v0.1.0 → v0.1.1
107+
* gulp feature # makes v0.1.1 → v0.2.0
108+
* gulp release # makes v0.2.1 → v1.0.0
109+
*
110+
* To bump the version numbers accordingly after you did a patch,
111+
* introduced a feature or made a backwards-incompatible release.
112+
*/
113+
114+
function inc(importance) {
115+
// get all the files to bump version in
116+
return gulp.src(['./manifest.json','./package.json', './bower.json'])
117+
// bump the version number in those files
118+
.pipe(bump({type: importance}))
119+
// save it back to filesystem
120+
.pipe(gulp.dest('./'))
121+
// commit the changed version number
122+
.pipe(git.commit('bumps package version'))
123+
// read only one file to get the version number
124+
.pipe(filter('manifest.json'))
125+
// **tag it in the repository**
126+
.pipe(tag_version());
127+
}
128+
129+
gulp.task('patch', function() { return inc('patch'); })
130+
gulp.task('feature', function() { return inc('minor'); })
131+
gulp.task('release', function() { return inc('major'); })

manifest.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
11
{
22
"manifest_version": 2,
3-
43
"name": "Cardboard - New Tab Page",
54
"author": "virtual-dev",
65
"description": "The default New Tab is not Google enough ? Try Cardboard, Now with more Material Design (plus nifty features)",
76
"version": "2.0.0",
8-
"chrome_url_overrides" : {
7+
"chrome_url_overrides": {
98
"newtab": "index.html"
109
},
1110
"icons": {

package.json

+4
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,17 @@
3333
"gulp-angular-filesort": "^1.1.1",
3434
"gulp-angular-htmlify": "^2.1.1",
3535
"gulp-angular-templatecache": "^1.5.0",
36+
"gulp-bump": "^0.2.2",
3637
"gulp-concat": "^2.5.2",
3738
"gulp-filesize": "0.0.6",
39+
"gulp-filter": "^2.0.2",
40+
"gulp-git": "^1.0.1",
3841
"gulp-inject": "^1.2.0",
3942
"gulp-minify-css": "^0.5.1",
4043
"gulp-minify-html": "^1.0.0",
4144
"gulp-ng-annotate": "^0.5.2",
4245
"gulp-rev": "^3.0.1",
46+
"gulp-tag-version": "^1.2.1",
4347
"gulp-uglify": "^1.1.0",
4448
"gulp-usemin": "^0.3.11"
4549
}

0 commit comments

Comments
 (0)