Skip to content

Commit d78c8cd

Browse files
committed
(GH-12) Add Gulp task to bump the package version
This commit adds the required modules and gulp task to bump the package.json version via Gulp. This will be used in automated testing and publishing tasks.
1 parent f464aef commit d78c8cd

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

client/gulpfile.js

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ var gulp = require('gulp');
33
var del = require('del');
44
var runSequence = require('run-sequence');
55
var exec = require('child_process').exec;
6+
var bump = require('gulp-bump');
7+
var args = require('yargs').argv;
68

79
// The default task (called when you run `gulp` from cli)
810
gulp.task('default', ['build']);
@@ -33,3 +35,31 @@ gulp.task('build', function (callback) {
3335
runSequence('clean','copy_language_server','build_extension',callback);
3436
})
3537

38+
gulp.task('bump', function () {
39+
/// <summary>
40+
/// It bumps revisions
41+
/// Usage:
42+
/// 1. gulp bump : bumps the package.json and bower.json to the next minor revision.
43+
/// i.e. from 0.1.1 to 0.1.2
44+
/// 2. gulp bump --version 1.1.1 : bumps/sets the package.json and bower.json to the
45+
/// specified revision.
46+
/// 3. gulp bump --type major : bumps 1.0.0
47+
/// gulp bump --type minor : bumps 0.1.0
48+
/// gulp bump --type patch : bumps 0.0.2
49+
/// gulp bump --type prerelease : bumps 0.0.1-2
50+
/// </summary>
51+
52+
var type = args.type;
53+
var version = args.version;
54+
var options = {};
55+
if (version) {
56+
options.version = version;
57+
} else {
58+
options.type = type;
59+
}
60+
61+
return gulp
62+
.src(['package.json'])
63+
.pipe(bump(options))
64+
.pipe(gulp.dest('.'));
65+
});

client/package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@
126126
"vsce": "^1.18.0",
127127
"mocha": "^2.3.3",
128128
"gulp": "^3.9.1",
129+
"gulp-bump": "^2.7.0",
130+
"yargs":"^8.0.1",
129131
"del": "^2.2.2",
130132
"run-sequence":"^1.2.2",
131133
"@types/node": "^6.0.40",

0 commit comments

Comments
 (0)