-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathgulpfile.js
80 lines (65 loc) · 1.88 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
//GULP 4.x.x
//LABS Project - Docs Builder
// Config and Setup Section
var projectName="Project Air";
var projectSource=""; // current Folder
var projectTarget="";
// Subfolder adjustment - default: 2 back
var sfa = "" //labs docs 1 more
// Includes
const { src, dest, watch, series } = require('gulp');
//other used Plugins
var run = require('child_process').exec;
var del = require('del');
// *** just runs Main CLI Commands ***
// ***********************************
var infostr="";
function header(cb) {
console.log('');
console.log('*****************************************');
console.log('*');
console.log('* Project Name : '+projectName+' Docs');
console.log('* Project Target : '+projectTarget);
if (infostr!="") {
console.log('*');
console.log(infostr);
};
console.log('*');
console.log('*****************************************');
console.log('');
cb();
}
function info(cb) {
infostr ='* please use one of these commands: \n';
infostr+='* - gulp build';
cb();
}
function runaction(cb) {
infostr ='* Repo Docs Builder \n';
infostr+='* running action ...';
cb();
}
function runHugo(cb) {
console.log('running hugo');
run('set HUGO_ENV=production&&hugo -D -s '+projectSource+'docs-src', function (err, stdout, stderr) {
// console.log(stdout); // See Hugo output
// console.log(stderr); // Debugging feedback
cb(err);
});
}
function runCopy() {
console.log('*** COPY ...');
// copy Docs
return src(''+projectSource+'docs/**').pipe(dest(sfa +'../../'+projectTarget+'/docs'));
}
function cleanTarget() {
// clean Docs
return del([sfa +''+projectTarget+'/docs/**/*'], {force: true});
};
// *** Gulp series and exports ***
// ***********************************
var sbuild = series(runaction, header, cleanTarget, runHugo);
// run build
exports.build = sbuild;
// Default
exports.default = series(info, header);