-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
103 lines (85 loc) · 2.08 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
var gulp = require("gulp"),
clean = require("gulp-clean");
/*
* series for doing multiple task in order 1->2->3
* src is for getting files from the computer
* dest is for transfer file to destination
*/
const { series, src, dest } = require('gulp');
//install plugins
const zip = require('gulp-zip');
const babel = require('gulp-babel');
const package = require('./package.json');
//clean existing build zip file
function cleanZip(cb) {
return gulp.src("./*.zip", {
read: false,
allowEmpty: true
}).pipe(clean());
cb();
}
//clean file & folders from build
function cleanBuild(cb) {
return gulp.src("./build", {
read: false,
allowEmpty: true
}).pipe(clean());
cb();
};
// bundle all files export to destination directory
function bundleFiles(cb){
return src([
'./**/*.*',
'!./build/**',
'!./assets/**/*.map',
'!./assets/react/**',
'!./assets/scss/**',
'!./assets/.sass-cache',
'!./node_modules/**',
'!./v2-library/**',
'!./test/**',
'!./.docz/**',
'!./**/*.zip',
'!.github',
'!./readme.md',
'!.DS_Store',
'!./**/.DS_Store',
'!./LICENSE.txt',
'!./*.lock',
'!./*.js',
'!./*.json',
'!yarn-error.log',
'!bin/**',
'!tests/**',
'!vendor/bin/**',
'!vendor/doctrine/**',
'!vendor/myclabs/**',
'!vendor/nikic/**',
'!vendor/phar-io/**',
'!vendor/phpdocumentor/**',
'!vendor/phpspec/**',
'!vendor/phpunit/**',
'!vendor/sebastian/**',
'!vendor/theseer/**',
'!vendor/webmozart/**',
'!vendor/yoast/**',
'!.phpunit.result.cache',
'!.travis.yml',
'!phpunit.xml.dist',
'!phpunit.xml',
])
.pipe(dest("build/tutor-lms-bunnynet-integration"));
cb();
}
// from destination directory take all files make zip
function exportZip(cb) {
const package = require('./package.json');
const buildName = `${package.name}-${package.version}.zip`;
return src("./build/**/*.*").pipe(zip(buildName)).pipe(dest("./"));
cb();
}
gulp.task("watch", function () {
gulp.watch("assets/scss/**/*.scss", gulp.series(...task_keys));
});
//exports.default = series(...task_keys, "watch");
exports.zip = series(cleanZip,cleanBuild,bundleFiles, exportZip);