-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathgulpfile.js
99 lines (93 loc) · 2.93 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
'use strict';
const gulp = require('gulp');
const shell = require('gulp-shell');
const stringify = require('json-stringify-safe');
const targetConfig = require('./demo-config/config.js');
gulp.registry(targetConfig); // targetConfig as custom gulp registry
console.log('targetConfig', stringify(targetConfig, null, 2));
[
// TODO: Can these entries be obtained from `ls plugins/*/configurator.js`? What is the appropriate order of registrations? 'inject' must be the last to register
'@thin-hook/build',
'@thin-hook/build-test',
'@thin-hook/examples',
'@thin-hook/demo-convert-skinny',
'@thin-hook/demo-convert-full',
'@thin-hook/demo-gulpfile-js',
'clean-gzip-json',
'generate-version',
'get-version',
'non-js-imports',
'generate-cert-sh',
'certificates',
'keys',
'entry-page',
'hook-min-js',
'bootstrap-js',
'hook-worker-js',
'no-hook-authorization',
'url-parameters',
'empty-document',
'cache-automation-js',
'cache-bundle-js',
'about-blank-redirector',
'content-loader-js',
'mark-parsed-js',
'script-hashes-js',
'wrap-globals-js',
'hook-native-api-js',
'context-generator-js',
'integrity-js',
'integrity-json',
'policy',
'disable-devtools',
'automation-secret',
'cache-bundle-automation-json',
'dummy-integrity',
'script-hashes',
'script-hashes-integrity',
'gzip-json',
'clean-frontend',
'frontend-components',
'gzip-frontend',
'generate-import-maps',
'bundler-helpers',
'bundle-browserify',
'bundle-webpack',
'bundle-rollup',
'dependency-graph',
'injector-helpers',
'reportage-nginx-conf',
'reportage-config-js',
// Notes on 'inject' plugin
// - targetConfig.commands are registered as tasks
// - Plugins with targetConfig[plugin].series are registered as gulp.task(plugin, gulp.series(...this[plugin].series))
// - Each phase in targetConfig.inject.phases is registered as gulp.task(phase, gulp.series('injector-helpers', ...dependencies))
// - A helper task `${phase}-phase` for each phase is registered as gulp.task(`${phase}-phase`, (done) => { this.inject.currentPhase = phase; done(); })
// - 'inject dependencies' is registered to perform dependency tasks for this.inject.currentPhase
// - 'inject' is registered as gulp.task('inject', gulp.series(...phases))
'inject',
].forEach(plugin => gulp.task(plugin));
gulp.task('default',
gulp.series(
'@thin-hook/build',
'@thin-hook/build-test',
'@thin-hook/examples',
'inject', // Process tasks in targetConfig.inject.phases
/* equivalent to 'inject'
gulp.series(
'clean',
'backend',
'plugin',
'cache',
'frontend'
)
*/
'dependency-graph',
)
);
// Skip the standard transform middleware for polyserve
gulp.task('patch-wct-istanbul', () => {
return gulp.src([ 'test/plugin.js' ], { base: 'test' })
.pipe(gulp.dest('node_modules/wct-istanbul/lib'));
});
gulp.task('test', gulp.series('patch-wct-istanbul', shell.task('wct')));