-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
57 lines (52 loc) · 2.24 KB
/
gulpfile.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
const { src, dest, series, parallel, watch, task } = require('gulp');
const replace = require('gulp-replace');
const newPluginVersion = '2.8.43'; // Latest version number
const latestWpTest = '6.3'; // Latest WP version number tested
const minWpVersion = '5.0'; // Min WP version number supported
const minPhpVersion = '5.6'; // Min PHP version number required
const authorName = 'Rodgath';
const authorUrl = `https://github.com/${authorName}`
const pluginUrl = `https://github.com/${authorName}/dilaz-panel`
const headerCommentBlock = `/*
* Plugin Name: Dilaz Panel
* Plugin URI: ${pluginUrl}
* Description: Simple options panel for WordPress themes and plugins.
* Requires at least: ${minWpVersion}
* Requires PHP: ${minPhpVersion}
* Author: ${authorName}
* Author URI: ${authorUrl}
* Text Domain: dilaz-panel
* Domain Path: /languages
* Version: ${newPluginVersion}
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt
||
|| --------------------------------------------------------------------------------------------
|| Admin Options Panel
|| --------------------------------------------------------------------------------------------
||
|| @package Dilaz Panel
|| @subpackage Panel
|| @version ${newPluginVersion}
|| @since Dilaz Panel 1.0.0
|| @author ${authorName}, ${authorUrl}
|| @copyright Copyright (C) 2017 - ${new Date().getFullYear()}, ${authorName}
|| @link ${pluginUrl}
|| @License GPL-2.0+
|| @License URI http://www.gnu.org/licenses/gpl-2.0.txt
||
*/`;
task('update-plugin-header', function () {
return src('./dilaz-panel.php')
.pipe(replace(/\/\*[\s\S]*?\*\//, headerCommentBlock)) // Non-greedy match for comment block
.pipe(dest('./'));
});
task('update-readme', function () {
return src('./readme.txt')
.pipe(replace(/(Requires at least:)\s*[\d.]+/g, `$1 ${minWpVersion}`))
.pipe(replace(/(Tested up to:)\s*[\d.]+/g, `$1 ${latestWpTest}`))
.pipe(replace(/(Stable tag:)\s*[\d.]+/g, `$1 ${newPluginVersion}`))
.pipe(replace(/(Requires PHP:)\s*[\d.]+/g, `$1 ${minPhpVersion}`))
.pipe(dest('./'));
});
task('default', series('update-plugin-header', 'update-readme'));