-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
34 lines (30 loc) · 1019 Bytes
/
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
const gulp = require('gulp');
const zip = require('gulp-zip');
const clean = require('gulp-clean');
const fs = require('fs');
const mainFile = 'promptpay.php';
const mainFileContent = fs.readFileSync(mainFile, 'utf8');
const pluginVersion = /^Version.*$/igm.exec(mainFileContent)[0].substring(9).trim();
const pluginName = /^Plugin Name.*$/igm.exec(mainFileContent)[0].substring(13).trim().toLowerCase();
const packageFolderName = pluginName + '-' + pluginVersion;
gulp.task('clean', function () {
return gulp.src(pluginName + '-*', {read: false})
.pipe(clean());
});
gulp.task('pack', ['clean'], function () {
return gulp.src([
'css/**',
'image/promptpay.jpg',
'js/main.min.js',
'promptpay.php',
'readme.txt',
'screenshot-1.jpg',
'screenshot-2.jpg'
], {base: '.'})
.pipe(gulp.dest(packageFolderName));
});
gulp.task('pack.zip', ['pack'], function () {
return gulp.src(packageFolderName + '/**')
.pipe(zip(packageFolderName + '.zip'))
.pipe(gulp.dest('./'));
});