-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
36 lines (28 loc) · 936 Bytes
/
gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
'use strict';
var semver = require('semver');
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
});
grunt.registerTask('bump', 'Bump manifest version', function (type) {
var options = this.options({
file: grunt.config('pkgFile') || 'package.json'
});
function setup(file, type) {
var pkg = grunt.file.readJSON(file);
var newVersion = pkg.version = semver.inc(pkg.version, type || 'patch');
return {
file: file,
pkg: pkg,
newVersion: newVersion
};
}
var config = setup(options.file, type);
grunt.file.write(
config.file,
JSON.stringify(config.pkg, null, ' ') + '\n'
);
grunt.config('pkg', config.pkg);
grunt.log.ok('Version bumped to ' + config.newVersion);
});
}