forked from brainly/style-guide
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
109 lines (91 loc) · 2.59 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
'use strict';
const gulp = require('gulp');
const argv = require('yargs').argv;
const path = require('path');
const pkg = require('./package');
const plugins = require('gulp-load-plugins')({
pattern: ['gulp-*', 'gulp.*'],
});
plugins.path = path;
const consts = {
PROJECT_DIR: __dirname,
IS_PRODUCTION: Boolean(argv.production),
VERSION: argv.production ? pkg.version : 'dev',
BUCKET_NAME: argv.production ?
'styleguide.brainly.com' : 'beta.styleguide.brainly.com',
AWS_REGION: 'eu-west-1',
get SRC() {
return path.join(this.PROJECT_DIR, 'src');
},
get DIST() {
return path.join(this.PROJECT_DIR, 'dist');
},
get DOCS() {
return path.join(this.SRC, 'docs');
},
get VERSIONED_DIST() {
return path.join(this.DIST, this.VERSION);
},
get COMPONENTS() {
return path.join(this.SRC, 'components');
},
get LATEST_DIST() {
return path.join(this.DIST, 'latest');
},
};
function getTask(task, options = {}) {
return require(path.join(consts.PROJECT_DIR, 'scripts', 'tasks', task))(
gulp,
plugins,
consts,
options
);
}
gulp.task('sass:build', getTask('sass-build'));
gulp.task('watch:sass', getTask('watch-sass'));
gulp.task('sass:docs-build', getTask('sass-docs-build'));
gulp.task('watch:docs-sass', getTask('watch-docs-sass'));
gulp.task('fingerprint', getTask('fingerprint'));
gulp.task('fingerprint-replace', getTask('fingerprint-replace'));
gulp.task('index-fingerprint-replace', getTask('index-fingerprint-replace'));
gulp.task('svgs-generate', getTask('svgs-generate'));
gulp.task('root-redirect-page', getTask('root-redirect-page'));
gulp.task(
'build:react-iframe-pages',
getTask(
'build-react-pages', {
iframe: true
}
)
);
gulp.task('build:react-pages', getTask('build-react-pages'));
gulp.task(
'build:react-interactive-pages',
getTask('build-react-interactive-pages')
);
gulp.task('watch:docs-templates', getTask('watch-docs-templates'));
gulp.task('upload-files', getTask('upload-files'));
gulp.task('copy-static', getTask('copy-static'));
gulp.task('clean:dist', getTask('clean-dist'));
gulp.task('copy-latest', getTask('copy-latest'));
gulp.task('build', gulp.series(
'clean:dist',
'sass:build',
'sass:docs-build',
'svgs-generate',
'build:react-pages',
'build:react-iframe-pages',
'build:react-interactive-pages',
'copy-static',
'fingerprint',
'fingerprint-replace',
'index-fingerprint-replace',
'root-redirect-page',
'copy-latest'
));
gulp.task('watch', gulp.series(
'watch:sass',
'watch:docs-sass',
'watch:docs-templates'
));
gulp.task('deploy', gulp.series('build', 'upload-files'));