forked from sliptree/bootstrap-tokenfield
-
Notifications
You must be signed in to change notification settings - Fork 6
/
Gruntfile.js
86 lines (69 loc) · 2.51 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
module.exports = function (grunt) {
require('jit-grunt')(grunt);
var semver = require('semver'),
f = require('util').format;
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
version: '<%= pkg.version %>',
banner: [
'/*!',
' * bootstrap-tokenfield <%= version %>',
' * https://github.com/sliptree/bootstrap-tokenfield',
' * Copyright 2013-2014 Sliptree and other contributors; Licensed MIT',
' */\n\n'
].join('\n'),
jekyll: {
docs: {}
}
});
grunt.registerTask('manifests', 'Update manifests.', function (version) {
var _ = grunt.util._,
pkg = grunt.file.readJSON('package.json'),
bower = grunt.file.readJSON('bower.json'),
jqueryPlugin = grunt.file.readJSON('bootstrap-tokenfield.jquery.json');
bower = JSON.stringify(_.extend(bower, {
name: pkg.name,
version: version
}), null, 2);
jqueryPlugin = JSON.stringify(_.extend(jqueryPlugin, {
name: pkg.name,
title: pkg.name,
version: version,
author: pkg.author,
description: pkg.description,
keywords: pkg.keywords,
homepage: pkg.homepage,
bugs: pkg.bugs,
maintainers: pkg.contributors
}), null, 2);
pkg = JSON.stringify(_.extend(pkg, {
version: version
}), null, 2);
grunt.file.write('package.json', pkg);
grunt.file.write('bower.json', bower);
grunt.file.write('bootstrap-tokenfield.jquery.json', jqueryPlugin);
});
grunt.registerTask('release', 'Ship it.', function (version) {
var curVersion = grunt.config.get('version');
version = semver.inc(curVersion, version) || version;
if (!semver.valid(version) || semver.lte(version, curVersion)) {
grunt.fatal('invalid version dummy');
}
grunt.config.set('version', version);
grunt.task.run([
'exec:git_on_master',
'exec:git_is_clean',
'manifests:' + version,
'build',
'exec:git_add',
'exec:git_commit:' + version,
'exec:git_tag:' + version,
'exec:update_docs'
// 'exec:git_push',
// 'exec:npm_publish',
]);
});
grunt.loadTasks('tasks/');
// Build task
grunt.registerTask('default', ['eslint', 'copy', 'uglify', 'less']);
};