-
Notifications
You must be signed in to change notification settings - Fork 46
/
Copy pathgulpfile.js
62 lines (49 loc) · 1.98 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
const gulp = require('gulp')
const path = require('path')
const fs = require('fs')
const gulpClean = require('gulp-clean')
const run = require('gulp-run-command').default
const testcafe = require('gulp-testcafe')
const { dirs } = require('./etc/common.js')
const ignoredFiles = [
'!' + path.join(dirs.buildSite, '**/_*'), // exclude folders starting with '_'
'!' + path.join(dirs.buildSite, '**/_*/**/*'), // exclude files/subfolders in folders starting with '_'
]
const mergeDist = (path) =>
gulp.src([
path,
...ignoredFiles,
]).pipe(gulp.dest(dirs.dist, { overwrite: false }))
gulp.task('clean', () =>
gulp.src(dirs.dist, { read: false, allowEmpty: true })
.pipe(gulpClean()))
gulp.task('lint:js', run('npm run lint:js'))
gulp.task('lint:ts', run('npm run lint:ts'))
gulp.task('lint', gulp.parallel(['lint:js', 'lint:ts']))
gulp.task('test:e2e', () =>
gulp.src(path.join(dirs.testE2e, 'test.js'))
.pipe(testcafe({
// https://github.com/DevExpress/gulp-testcafe/blob/master/index.js
app: 'npm run start',
browsers: ['firefox'],
reporter: [
{
name: 'spec'
},
{
name: 'xunit',
output: fs.createWriteStream(path.join(dirs.testE2eReports, 'report.xml'))
}
]
})))
gulp.task('compile:app', run('webpack --config etc/webpack.config.app.js'))
gulp.task('compile:site', run('node --max_old_space_size=8192 ./node_modules/react-static/bin/react-static-build'))
gulp.task('combine:app', () => mergeDist(path.join(dirs.buildApp, '**/*')))
gulp.task('combine:site', () => mergeDist(path.join(dirs.buildSite, '**/*')))
gulp.task('build:app', gulp.series('compile:app', 'combine:app'))
gulp.task('build:site', gulp.series('compile:site', 'combine:site'))
gulp.task('build:lambda', run('netlify-lambda build src/lambda'))
gulp.task('prebuild', gulp.series('clean'))
const build = gulp.series('prebuild', 'build:app', 'build:site', 'build:lambda')
gulp.task('build', build)
gulp.task('default', build)