forked from publishpress/PublishPress-Future
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGruntfile.js
127 lines (121 loc) · 4.05 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
module.exports = function (grunt) {
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
files_php: [
'*.php',
'**/*.php',
'!.git/**',
'!.github/**',
'!assets/**',
'!bin/**',
'!vendor/**',
'!node_modules/**',
'!logs/**',
'!codeceptjs/**',
'!codecept**',
'!tests/**',
],
files_js: [
'*.js',
'**/*.js',
'!.git/**',
'!.github/**',
'!vendor/**',
'!node_modules/**',
'!logs/**',
'!Gruntfile.js',
'!.git/**',
'!codeceptjs/**',
'!codecept**',
'!tests/**',
'!webpack.config.js',
'!assets/js/gutenberg-panel.js',
],
mkdir: {
logs: {
options: {
create: ['logs']
}
}
},
phpcs: {
options: {
bin: 'vendor/bin/phpcs',
standard: 'phpcs.xml',
reportFile: 'logs/phpcs.log',
extensions: 'php',
showSniffCodes: true
},
src: [
'<%= files_php %>'
]
},
phpcbf: {
options: {
bin: 'vendor/bin/phpcbf',
standard: 'phpcs.xml',
noPatch: false,
extensions: 'php'
},
src: [
'<%= files_php %>'
]
},
phplint: {
options: {
standard: 'phpcs.xml'
},
src: [
'<%= files_php %>'
]
},
jshint: {
options: {
jshintrc: true,
reporterOutput: 'logs/jslogs.log'
},
all: [
'<%= files_js %>'
]
},
pot_config: '<%= pkg.pot %>',
makepot: {
target: {
options: {
mainFile: 'post-expirator.php',
type: 'wp-plugin',
exclude: ['/vendor'],
updateTimestamp: false,
processPot: function (pot, options) {
// https://github.com/cedaro/grunt-wp-i18n/blob/develop/docs/examples/remove-package-metadata.md
var translation,
excluded_meta = [
'Plugin Name of the plugin/theme',
'Plugin URI of the plugin/theme',
'Author of the plugin/theme',
'Author URI of the plugin/theme'
];
for (translation in pot.translations['']) {
if ('undefined' !== typeof pot.translations[''][translation].comments.extracted) {
if (excluded_meta.indexOf(pot.translations[''][translation].comments.extracted) >= 0) {
console.log('Excluded meta: ' + pot.translations[''][translation].comments.extracted);
delete pot.translations[''][translation];
}
}
}
// additional
pot.headers['last-translator'] = grunt.config.get('pot_config').lasttranslator;
pot.headers['language-team'] = grunt.config.get('pot_config').languageteam;
delete pot.headers['lang-translator'];
delete pot.headers['x-generator'];
delete pot.headers['po-revision-date'];
return pot;
}
}
}
}
});
// default tasks
grunt.registerTask('default', ['mkdir', 'phpcbf', 'phpcs', 'phplint', 'jshint', 'makepot']);
};