UNPKG

1.57 kBJavaScriptView Raw
1'use strict';
2
3var gulp = require('gulp');
4var bump = require('../');
5
6gulp.task('bump', function(){
7 var options = {
8 type: 'minor'
9 };
10 gulp.src('./package.json')
11 .pipe(bump(options))
12 .pipe(gulp.dest('./build'));
13});
14
15gulp.task('version', function(){
16 gulp.src('./package.json')
17 .pipe(bump({version: '1.2.3'}))
18 .pipe(gulp.dest('./version'));
19});
20
21gulp.task('xml', function(){
22 gulp.src('./file.xml')
23 .pipe(bump())
24 .pipe(gulp.dest('./build'));
25});
26
27// WordPress Theme: https://developer.wordpress.org/themes/basics/main-stylesheet-style-css/
28gulp.task('wptheme', function(){
29 gulp.src('./style.css')
30 .pipe(bump())
31 .pipe(gulp.dest('./build'));
32});
33
34// WordPress Plugin: https://developer.wordpress.org/plugins/the-basics/header-requirements/
35gulp.task('wpplugin', function(){
36 gulp.src('./plugin.php')
37 .pipe(bump())
38 .pipe(gulp.dest('./build'));
39});
40
41// PHP Constant: `define( 'MY_PLUGIN_VERSION', '1.0.0' );`
42gulp.task('phpconstant', function(){
43 var constant = "MY_PLUGIN_VERSION";
44 gulp.src('./plugin.php')
45 .pipe(bump({
46 key: constant, // for error reference
47 regex: new RegExp('([<|\'|"]?(' + constant + ')[>|\'|"]?[ ]*[:=,]?[ ]*[\'|"]?[a-z]?)(\\d+.\\d+.\\d+)(-[0-9A-Za-z.-]+)?(\\+[0-9A-Za-z\\.-]+)?([\'|"|<]?)', 'i')
48 }))
49 .pipe(gulp.dest('./build'));
50});
51
52gulp.task('key', function(){
53 gulp.src('./key.json')
54 .pipe(bump({key: 'appversion'}))
55 .pipe(gulp.dest('./build'));
56});
57
58gulp.task('patch', function(){
59 gulp.src('./package.json')
60 .pipe(bump())
61 .pipe(gulp.dest('./build'));
62});
63
64gulp.task('default', ['bump']);