Skip to content

Commit

Permalink
Finish 0.0.8
Browse files Browse the repository at this point in the history
  • Loading branch information
vogloblinsky committed Oct 31, 2017
2 parents c3372c3 + 700f56b commit ce9d852
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 29 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
<a name="0.0.8"></a>
## 0.0.8 (2017-10-31)

### Bug Fixes

* **chore:** don't stop stream ([4d74a147](https://github.com/compodoc/gulp-compodoc/commit/4d74a147)), closes [#4](https://github.com/compodoc/gulp-compodoc/issues/4)

<a name="0.0.7"></a>
## 0.0.7 (2017-07-08)

Expand Down
61 changes: 34 additions & 27 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,48 @@
'use strict';
const gutil = require('gulp-util'),
PluginError = gutil.PluginError,
es = require('event-stream'),
through = require('through2'),
compodocModule = require('@compodoc/compodoc'),
PLUGIN_NAME = 'gulp-compodoc';
PluginError = gutil.PluginError,
es = require('event-stream'),
through = require('through2'),
compodocModule = require('@compodoc/compodoc'),
PLUGIN_NAME = 'gulp-compodoc';

function compodoc(options) {
var files = [];
options = options || {};
options = options || {};

return es.through(function(file) {
files.push(file.path);
}, function() {
var stream = this;
files.push(file.path);
}, function() {
var stream = this;

if (files.length === 0) {
stream.emit('error', new PluginError(PLUGIN_NAME, 'No input files for compodoc.'));
stream.emit('end');
return;
} else if (!options.output) {
stream.emit('error', new PluginError(PLUGIN_NAME, 'You must either specify the \'output\' option.'));
stream.emit('end');
return;
} else {
if (files.length === 0) {
stream.emit('error', new PluginError(PLUGIN_NAME, 'No input files for compodoc.'));
stream.emit('end');
return;
} else if (!options.output) {
stream.emit('error', new PluginError(PLUGIN_NAME, 'You must either specify the \'output\' option.'));
stream.emit('end');
return;
} else {
var app = new compodocModule.Application(options);

app.setFiles(files);
app.generate();

process.on('exit', function() {
try {
app.setFiles(files);
app.generate().then(function() {
stream.emit('end');
return;
}, function(error) {
stream.emit('error', new PluginError(PLUGIN_NAME, error));
stream.emit('end');
return;
});
} catch (e) {
stream.emit('error', e);
stream.emit('end');
});

return;
}
});
return;
}
}
});
}

module.exports = compodoc;
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@compodoc/gulp-compodoc",
"version": "0.0.7",
"version": "0.0.8",
"description": "Compodoc plugin for gulp",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -32,7 +32,7 @@
"node": ">=5.10.0"
},
"dependencies": {
"@compodoc/compodoc": "^1.0.0-beta.11",
"@compodoc/compodoc": "^1.0.3",
"event-stream": "^3.3.4",
"gulp-util": "^3.0.7",
"through2": "^2.0.1"
Expand Down

0 comments on commit ce9d852

Please sign in to comment.