-
Notifications
You must be signed in to change notification settings - Fork 64
/
Gruntfile.js
96 lines (85 loc) · 1.79 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
87
88
89
90
91
92
93
94
95
96
/* global module, require */
module.exports = function( grunt ) {
'use strict';
var pkg = grunt.file.readJSON( 'package.json' );
grunt.initConfig( {
pkg: pkg,
devUpdate: {
packages: {
options: {
packageJson: null,
packages: {
devDependencies: true,
dependencies: false
},
reportOnlyPkgs: [],
reportUpdated: false,
semver: true,
updateType: 'force'
}
}
},
replace: {
php: {
overwrite: true,
replacements: [
{
from: /@deprecated(\s+)NEXT/g,
to: '@deprecated$1<%= pkg.version %>'
},
{
from: /@since(\s+)NEXT/g,
to: '@since$1<%= pkg.version %>'
},
{
from: /@NEXT/g,
to: '<%= pkg.version %>'
},
{
from: /'GO_VERSION',(\s*)'[\w.+-]+'/,
to: "'GO_VERSION',$1'<%= pkg.version %>'"
},
{
from: /'[\w.+-]+',(\s*)GO_VERSION/,
to: "'<%= pkg.version %>',$1GO_VERSION"
}
],
src: [ '*.php', '**/*.php', '.dev/tests/php/test-functions.php' ]
},
style_css: {
overwrite: true,
replacements: [
{
from: /Version:(\s*)[\w.+-]+/,
to: 'Version:$1<%= pkg.version %>'
}
],
src: [ 'style.css' ]
},
readme: {
overwrite: true,
replacements: [
{
from: /Stable tag:(\s*)[\w.+-]+/,
to: 'Stable tag:$1<%= pkg.version %>'
}
],
src: [ 'readme.txt' ]
},
readme_md: {
overwrite: true,
replacements: [
{
from: /goVersion=&message=v[\w.+-]+&/,
to: 'goVersion=&message=v<%= pkg.version %>&'
}
],
src: [ 'readme.md' ]
}
}
} );
require( 'load-grunt-tasks' )( grunt );
grunt.registerTask( 'default', [ 'version' ] );
grunt.registerTask( 'version', [ 'replace' ] );
grunt.registerTask( 'check', [ 'devUpdate' ] );
};