Skip to content

Commit dc92738

Browse files
committed
feat(app): call compodoc, with options
1 parent ca06ad9 commit dc92738

File tree

3 files changed

+54
-14
lines changed

3 files changed

+54
-14
lines changed

README.md

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# gulp-compodoc
2+
[Compodoc](https://github.com/compodoc/compodoc) plugin for gulp
3+
14
<p align="center">
25
<img src="https://avatars3.githubusercontent.com/u/23202313" alt="Compodoc: The missing documentation tool for your Angular application" width="226">
36
<br>
@@ -7,42 +10,42 @@
710
<a href="http://opensource.org/licenses/MIT"><img src="http://img.shields.io/badge/license-MIT-brightgreen.svg" alt="MIT badge"></a>
811
</p>
912

10-
# gulp-compodoc
11-
Compodoc plugin for gulp
13+
<p align="center">The missing documentation tool for your Angular application</p>
14+
15+
<p align="center">
16+
<img src="https://raw.githubusercontent.com/groupe-sii/compodoc/master/screenshots/main-view.png" alt="Compodoc: The missing documentation tool for your Angular application">
17+
</p>
1218

1319
## Install
1420

1521
```
1622
$ npm install --save-dev gulp-compodoc
1723
```
1824

19-
2025
## Usage
2126

2227
```js
2328
const gulp = require('gulp'),
2429
compodoc= require('gulp-compodoc');
2530

2631
gulp.task('default', () => {
27-
gulp.src('src/**/*.ts')
28-
.pipe(compodoc())
32+
return gulp.src('src/**/*.ts')
33+
.pipe(compodoc({
34+
output: 'documentation',
35+
tsconfig: 'src/tsconfig.json',
36+
serve: true
37+
}))
2938
);
3039
```
3140
3241
3342
## API
3443
35-
### compodoc([options])
44+
### compodoc(options)
3645
3746
#### options
3847
39-
##### foo
40-
41-
Type: `boolean`<br>
42-
Default: `false`
43-
44-
Lorem ipsum.
45-
48+
All options from [compodoc](https://github.com/compodoc/compodoc) are available. The list is available [here](https://github.com/compodoc/compodoc#usage).
4649
4750
## License
4851

index.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
'use strict';
2+
const gutil = require('gulp-util'),
3+
PluginError = gutil.PluginError,
4+
es = require('event-stream'),
5+
through = require('through2'),
6+
compodocModule = require('compodoc'),
7+
PLUGIN_NAME = 'gulp-compodoc';
8+
9+
function compodoc(options) {
10+
var files = [];
11+
options = options || {};
12+
13+
return es.through(function(file) {
14+
files.push(file.path);
15+
}, function() {
16+
var stream = this;
17+
18+
if (files.length === 0) {
19+
stream.emit('error', new PluginError(PLUGIN_NAME, 'No input files for compodoc.'));
20+
stream.emit('end');
21+
return;
22+
} else if (!options.output) {
23+
stream.emit('error', new PluginError(PLUGIN_NAME, 'You must either specify the \'output\' option.'));
24+
stream.emit('end');
25+
return;
26+
} else {
27+
var app = new compodocModule.Application(options);
28+
29+
app.setFiles(files);
30+
app.generate();
31+
32+
return;
33+
}
34+
});
35+
}
36+
37+
module.exports = compodoc;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
"dependencies": {
3535
"gulp-util": "^3.0.7",
3636
"through2": "^2.0.1",
37-
"compodoc": "^0.0.23"
37+
"compodoc": "^0.0.24"
3838
},
3939
"devDependencies": {
4040
"gulp": "^3.9.1"

0 commit comments

Comments
 (0)