-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
124 lines (112 loc) · 3.03 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
124
/**
* Gulpfile for WRN Fix IT
* 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: "./prod",
source: "./src"
};
// white label & copyright label
const conf = JSON.parse(fs.readFileSync(path.source+'/config.json'));
const pkg = JSON.parse(fs.readFileSync('package.json'));
const tooldata = {
vars: [
'set uicolor=<%= uicolor %>',
'set infouicolor=<%= infouicolor %>',
'set erruicolor=<%= erruicolor %>',
'set cliname=$%appname%\n',
].join('\n'),
}
const copydata = {
copybanner: [
'rem =============================',
'rem WRN Fix IT - <%= homepage %>',
'rem <%= description %>',
'rem Version: <%= version %>',
'rem Github: <%= github %>',
'rem Licensed under GPL v3 - https://opensource.org/licenses/GPL-3.0',
'rem Copyright (c) <%= new Date().getFullYear() %> <%= author %>',
'rem ',
'rem Facebook: @warengonzagaofficial',
'rem Twitter: @warengonzaga',
'rem Github: @warengonzaga',
'rem Website: warengonzaga.com',
'rem ',
'rem Donate or Support!',
'rem https://buymeacoff.ee/warengonzaga',
'rem =============================\n',
'cls',
'@echo off',
'rem =============================',
'rem Setup Variables',
'rem =============================',
'set appname=<%= appname %>',
'set appvers=<%= version %>',
'set appstat=<%= status %>',
'set dev=<%= author %>',
'set desc=<%= description %>\n',
].join('\n'),
};
/**
* Gulp Tasks
* Writen by Waren Gonzaga
*/
// add white label
function setup() {
return gulp
.src([path.source+'/core.bat'], {allowEmpty: true})
.pipe(header(tooldata.vars, conf))
.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(conf.filename+'-'+pkg.version+'.bat'))
.pipe(gulp.dest([path.build]));
}
// delete temporary build
function delcore() {
return gulp
.src(path.build+'/core.bat', {read: false, allowEmpty: true})
.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('./prod', {read: false, allowEmpty: true})
.pipe(clean());
}
// clean existing builds
function cleanroot() {
return gulp
.src('./*.bat', {read: false, allowEmpty: true})
.pipe(clean());
}
// gulp series
const build = gulp.series([setup, copyright, delcore, copytoroot]);
const cleandev = gulp.series([cleanprod, cleanroot]);
// gulp commands
exports.setup = setup;
exports.copyright = copyright;
exports.delcore = delcore;
exports.copytoroot = copytoroot;
exports.cleanprod = cleanprod;
exports.cleanroot = cleanroot;
exports.cleandev = cleandev;
exports.build = build;
exports.default = build;