-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
63 lines (56 loc) · 1.58 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
const gulp = require('gulp');
const connect = require('gulp-connect');
const typedoc = require('gulp-typedoc');
const typedocConfig = require('./typedoc.json');
const shell = require('gulp-shell');
/*
[!} IMPORTANT
While running gulp-typedoc for livereload served docs - it will delete 'out' property from typedocConfig
object for whatever hell knows reason. Wasted 30m on this bs...
*/
function serveTask(done) {
connect.server(
{
name: 'Docs',
root: 'docs',
livereload: true,
port: 8000,
},
function () {
this.server.on('close', done);
}
);
}
function watchTypeScriptTask(done) {
gulp.watch('src/**/*.ts').on('change', (filepath) =>
gulp
.src(filepath, { read: false })
/*
Using typedoc from 'gulp-typedoc' throws error
related to `typedoc-plugin-markdown` - without that plugin
everything works fine i.e.:
...pipe(typedoc({ ...typedocConfig }))
This also generates new project.json file on ./website/.eveble/project.json. This however will require reload of Docusaurus is new files are present.
*/
.pipe(shell(['./node_modules/.bin/typedoc <%= file.path %>']))
);
done();
}
function watchDocsTask(done) {
gulp
.watch('docs')
.on('change', (filepath) =>
gulp.src(filepath, { read: false }).pipe(connect.reload())
);
done();
}
gulp.task('docs:build', function () {
return gulp.src(['src/**/*.ts']).pipe(typedoc({ ...typedocConfig }));
});
gulp.task(
'docs:watch',
gulp.series(
'docs:build',
gulp.parallel(watchTypeScriptTask, watchDocsTask, serveTask)
)
);