-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
104 lines (96 loc) · 2.69 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
/*!
* (℠)
* # gulpfile for Bibi
*
*/
'use strict';
const gulp = require('gulp'), del = require('del'), fs = require('fs'), rename = require('gulp-rename'), zip = require('gulp-zip');
const Package = JSON.parse(fs.readFileSync('package.json'));
const Bibi = require('./bibi.info.js');
gulp.task('clean', done => {
del.sync([
'**/.DS_Store',
'**/Thumbs.db',
'LICENSE',
'*.md',
'bibi/*.html',
'bibi/and',
'bibi/extensions',
'bibi/presets',
'bibi/resources',
'bibi/wardrobe',
'bib/i/*.html',
'bib/i.js',
'bib/i/presets'
].map(
X => Bibi.DIST + '/' + X
));
[
'bibi',
'bibi-bookshelf',
'bib/i',
//'bib/bookshelf',
'bib'
].forEach(Dir => {
try { Dir = Bibi.DIST + '/' + Dir ; if(!fs.readdirSync(Dir).length) del.sync(Dir); } catch(E) {}
});
del.sync(Bibi.ARCHIVETMP);
done();
});
gulp.task('initialize', done => {
[
'bibi',
'bibi-bookshelf'
].concat(Bibi.WithBCK ? [
'bib',
'bib/i',
//'bib/bookshelf'
] : []).forEach(Dir => {
fs.mkdirSync((Bibi.ForPack ? Bibi.ARCHIVETMP : Bibi.DIST) + '/' + Dir, { recursive: true });
});
done();
});
gulp.task('reset', gulp.series(
'clean',
'initialize'
));
gulp.task('make:dress-template', () => {
return gulp.src([
Bibi.SRC + '/bibi/wardrobe/_dress-codes/**',
], {
base: Bibi.SRC + '/bibi/wardrobe/_dress-codes'
}).pipe(gulp.dest(
Bibi.SRC + '/bibi/wardrobe/DRESS-TEMPLATE-' + new Date(Date.now() + 1000 * 60 * 60 * (new Date().getTimezoneOffset() / -60)).toISOString().split('.')[0].replace(/[-:]/g, '').replace('T', '-')
));
});
gulp.task('make:package', () => {
const PackageName = (Package.name == 'bibi' ? 'Bibi' : Package.name) + '-v' + Package.version + (Bibi.WithBCK ? '_with_BackCompatKit' : '') + '.zip';
del.sync([
Bibi.ARCHIVES + '/' + PackageName
]);
return gulp.src([
'LICENSE',
'README.md',
'bibi/*.html',
'bibi/and/**',
'bibi/extensions/**',
'bibi/presets/**',
'bibi/resources/**',
'bibi/wardrobe/**',
'bibi-bookshelf'
].concat(Bibi.WithBCK ? [
'README.BackCompatKit.md',
'bib/i/*.html',
'bib/i.js',
'bib/i/presets/**',
//'bib/bookshelf'
] : []).map(
X => Bibi.ARCHIVETMP + '/' + X
), {
base: Bibi.ARCHIVETMP
}).pipe(zip(
PackageName
)).pipe(gulp.dest(
Bibi.ARCHIVES
));
});