-
-
Notifications
You must be signed in to change notification settings - Fork 14
/
gulpfile.js
123 lines (111 loc) · 2.97 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
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
/**
* Gulpfile for WRN Cleaner
* By Waren Gonzaga
**/
// gulp packages
const gulp = require("gulp");
const fs = require("fs");
const clean = require("gulp-clean");
const rename = require("gulp-rename");
const header = require("gulp-header");
// gulp paths
const path = {
build: "./dist",
source: "./src"
};
// white label & copyright label
const whtlbl = JSON.parse(fs.readFileSync(path.source+'/config.json'));
const pkg = JSON.parse(fs.readFileSync('package.json'));
const whtlbldata = {
whtlblbanner: [
'cls',
'@echo off',
'REM =============================',
'REM Setup Variables',
'REM =============================',
'set appname=<%= title %>',
'set appvers=<%= version %>',
'set appstat=<%= status %>',
'set dev=<%= dev %>',
'set desc=<%= description %>',
'set uicolor=<%= uicolor %>',
'set infouicolor=<%= infouicolor %>',
'set erruicolor=<%= erruicolor %>',
'set cliN=%appname%Cleaner$\n',
].join('\n'),
}
const copydata = {
copybanner: [
'REM =============================',
'REM WRN Cleaner - <%= homepage %>',
'REM <%= description %>',
'REM Version: <%= version %>',
'REM Github: <%= github %>',
'REM Licensed under GNU General Public License v3: https://opensource.org/licenses/GPL-3.0',
'REM Copyright (c) <%= new Date().getFullYear() %> <%= author %>',
'REM ',
'REM Twitter: @warengonzaga',
'REM Github: @warengonzaga',
'REM Website: warengonzaga.com',
'REM ',
'REM Donate or Support!',
'REM https://warengonzaga.com/donate',
'REM =============================\n\n',
].join('\n'),
};
/**
* Gulp Tasks
* Writen by Waren Gonzaga
*/
// add white label
function whitelabel() {
return gulp
.src([path.source+'/core.bat'], {allowEmpty: true})
.pipe(header(whtlbldata.whtlblbanner, whtlbl))
.pipe(gulp.dest([path.build]));
}
// add copyright label
function copyright() {
return gulp
.src([path.build+'/core.bat'], {allowEmpty: true})
.pipe(header(copydata.copybanner, pkg))
.pipe(rename(whtlbl.filename+'-'+whtlbl.version+'.bat'))
.pipe(gulp.dest([path.build]));
}
// delete temporary build
function delcore() {
return gulp
.src(path.build+'/core.bat', {read: false})
.pipe(clean());
}
// copy build to root
function copytoroot() {
return gulp
.src(path.build+'/*.bat')
.pipe(gulp.dest('./'));
}
// clean production folder
function cleanprod() {
return gulp
.src(path.build)
.pipe(clean());
}
// clean existing builds
function cleanroot() {
return gulp
.src('./*.bat')
.pipe(clean());
}
// gulp series
const build = gulp.series([whitelabel, copyright, delcore, copytoroot]);
const cleandev = gulp.series([cleanprod, cleanroot]);
// gulp commands
exports.whitelabel = whitelabel;
exports.copyright = copyright;
exports.delcore = delcore;
exports.copytoroot = copytoroot;
exports.cleanprod = cleanprod;
exports.cleanroot = cleanroot;
exports.cleandev = cleandev;
exports.build = build;
exports.default = build;