-
Notifications
You must be signed in to change notification settings - Fork 16
/
Gruntfile.js
82 lines (78 loc) · 2.39 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
module.exports = function(grunt) {
// Project configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
replace: {
version: {
src: ['./README.md','./index.html','./app/deeplio/Deeplio.php'],
overwrite: true,
replacements: [
{
from: /©\s[0-9]{4}/g,
to: '© <%= grunt.template.today("yyyy") %>'
},
{
from: /Copyright\s[0-9]{4}/g,
to: 'Copyright <%= grunt.template.today("yyyy") %>'
},
{
from: /\–\sVersion\s[0-9]+[.]{1}[0-9]+[.]{1}[0-9]+/g,
to: '– Version <%= pkg.version %>'
},
{
from: /Current\sRelease:\s[0-9]+[.]{1}[0-9]+[.]{1}[0-9]+/g,
to: 'Current Release: <%= pkg.version %>'
},
{
from: /archive\/[0-9]+[.]{1}[0-9]+[.]{1}[0-9]+\.zip/g,
to: 'archive/<%= pkg.version %>.zip'
},
{
from: /"Version":\s"[0-9]+[.]{1}[0-9]+[.]{1}[0-9]+"/g,
to: '"version": "<%= pkg.version %>"'
},
{
from: /\([0-9]+[.]{1}[0-9]+[.]{1}[0-9]+\)/g,
to: '(<%= pkg.version %>)'
}
]
},
changelog: {
src: ['./CHANGELOG.md'],
overwrite: true,
replacements: [
{
from: '## Master\n',
to: '## Master\n\n\n## v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %>\n'
}
]
},
},
bump: {
options: {
files: [
'package.json'
],
updateConfigs: ['pkg'],
commit: true,
commitMessage: 'Release Version %VERSION%',
commitFiles: ['-a'], // '-a' for all files
createTag: true,
tagName: '%VERSION%',
tagMessage: 'Released Version %VERSION%',
push: false
/*pushTo: 'upstream',*/
/*gitDescribeOptions: '--tags --always --abbrev=1 --dirty=-d' // options to use with '$ git describe'*/
},
},
});
// Load the plugin that provides the "uglify" task.
grunt.loadNpmTasks('grunt-text-replace');
grunt.loadNpmTasks('grunt-bump');
// Default task(s).
grunt.registerTask('default', ['bump-only:patch', 'replace:version', 'replace:changelog',]);
grunt.registerTask('test', ['bump-only:patch', 'replace:version', 'replace:changelog',]);
grunt.registerTask('patch', [ 'bump-only:patch', 'replace:version', 'bump-commit', 'replace:changelog',]);
grunt.registerTask('minor', [ 'bump-only:minor', 'replace:version', 'bump-commit', 'replace:changelog',]);
grunt.registerTask('major', [ 'bump-only:major', 'replace:version', 'bump-commit', 'replace:changelog',]);
};