-
Notifications
You must be signed in to change notification settings - Fork 7
/
gulpfile.js
55 lines (47 loc) · 1.48 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
import { mkdirSync } from 'fs';
import {
buildCSS,
buildJS,
generateManifest,
runTests,
watchJS,
} from '@hypothesis/frontend-build';
import gulp from 'gulp';
import tailwindConfig from './tailwind.config.js';
gulp.task('build-js', () => buildJS('./rollup.config.js'));
gulp.task('watch-js', () => watchJS('./rollup.config.js'));
gulp.task('build-css', () =>
buildCSS(['./via/static/styles/video_player.css'], { tailwindConfig })
);
gulp.task('watch-css', () => {
gulp.watch(
[
'./via/static/styles/**/*.{css,scss}',
'./via/static/scripts/**/*.{js,ts,tsx}',
],
{ ignoreInitial: false },
gulp.series('build-css')
);
});
gulp.task('watch-manifest', () => {
// Ensure build dir exists, otherwise `gulp.watch` may not work.
mkdirSync('build', { recursive: true });
gulp.watch('build/**/*.{css,js,map}', generateManifest);
});
gulp.task('build', gulp.series(['build-js', 'build-css'], generateManifest));
gulp.task('watch', gulp.parallel(['watch-js', 'watch-css', 'watch-manifest']));
// Unit and integration testing tasks.
//
// Some (eg. a11y) tests rely on CSS bundles. We assume that JS will always take
// longer to build than CSS, so build in parallel.
gulp.task(
'test',
gulp.parallel('build-css', () =>
runTests({
bootstrapFile: 'via/static/scripts/setup-tests.js',
karmaConfig: 'via/static/scripts/karma.config.cjs',
rollupConfig: 'rollup-tests.config.js',
testsPattern: 'via/static/scripts/**/*-test.js',
})
)
);