forked from codeceptjs/CodeceptJS
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
43 lines (36 loc) · 1.43 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
const path = require('path');
const gulp = require('gulp');
const documentation = require('gulp-documentation');
const gap = require('gulp-append-prepend');
const glob = require('glob');
const mustache = require('gulp-mustache');
const cpath = '.';
gulp.task('docs', (done) => {
glob.sync(path.join(cpath, 'lib/helper/*.js')).forEach((file) => {
gulp.src(file)
.pipe(gulp.dest(path.join(cpath, 'docs/build')))
.pipe(mustache({}, { extension: '.js' }))
.pipe(gulp.dest(path.join(cpath, 'docs/build')))
.pipe(documentation('md', { filename: `${path.basename(file, '.js')}.md`, shallow: true, sortOrder: 'alpha' }))
.pipe(gap.prependText(`---
id: ${path.basename(file, '.js')}
title: ${path.basename(file, '.js')}
---`))
.pipe(gulp.dest(path.join(cpath, 'docs/helpers')));
});
const api = ['container', 'config', 'recorder', 'output', 'helper', 'codecept'];
api.forEach((baseName) => {
gulp.src(path.join(cpath, `lib/${baseName}.js`))
.pipe(documentation('md', { filename: `${baseName}.md`, shallow: true, sortOrder: 'alpha' }))
.pipe(gulp.dest(path.join(cpath, 'docs/api')));
});
gulp.src(path.join(cpath, 'lib/plugin/*.js'))
.pipe(documentation('md', { filename: 'plugins.md', shallow: true, sortOrder: 'alpha' }))
.pipe(gap.prependText(`---
id: plugins
title: Plugins
---`))
.pipe(gulp.dest(path.join(cpath, 'docs')));
done();
});
gulp.task('default', gulp.series('docs'));