2016-07-14 22:38:41 +00:00
|
|
|
"use strict";
|
2016-10-21 15:48:52 +00:00
|
|
|
/* ------------------------------------------
|
|
|
|
* This module creates TypeScript documentation
|
|
|
|
* -------------------------------------------- */
|
2016-10-02 18:35:13 +00:00
|
|
|
const q = require("q");
|
2016-10-21 15:48:52 +00:00
|
|
|
const paths = require("../npmts.paths");
|
|
|
|
const npmts_log_1 = require("../npmts.log");
|
|
|
|
const plugins = require("./mod01.plugins");
|
|
|
|
const mod00_check_1 = require("../mod00/mod00.check");
|
2016-09-22 21:23:16 +00:00
|
|
|
let genTypeDoc = function (configArg) {
|
2016-10-02 18:35:13 +00:00
|
|
|
let done = q.defer();
|
2016-10-21 15:48:52 +00:00
|
|
|
npmts_log_1.npmtsOra.text('now generating ' + 'TypeDoc documentation'.yellow);
|
2016-09-06 15:21:25 +00:00
|
|
|
plugins.beautylog.log('TypeDoc Output:');
|
2016-10-20 20:57:32 +00:00
|
|
|
let localSmartstream = new plugins.smartstream.Smartstream([
|
|
|
|
plugins.gulp.src(plugins.path.join(paths.tsDir, '**/*.ts')),
|
|
|
|
plugins.gulpTypedoc({
|
|
|
|
// TypeScript options (see typescript docs)
|
|
|
|
module: 'commonjs',
|
|
|
|
target: 'es6',
|
|
|
|
includeDeclarations: true,
|
|
|
|
// Output options (see typedoc docs)
|
|
|
|
out: paths.pagesApiDir,
|
|
|
|
json: plugins.path.join(paths.pagesApiDir, 'file.json'),
|
|
|
|
// TypeDoc options (see typedoc docs)
|
2016-10-21 15:48:52 +00:00
|
|
|
name: mod00_check_1.projectInfo.name,
|
2016-10-20 20:57:32 +00:00
|
|
|
readme: plugins.path.join(paths.cwd, 'README.md'),
|
|
|
|
// theme: "default",
|
|
|
|
version: true
|
|
|
|
})
|
|
|
|
]);
|
|
|
|
localSmartstream.run().then(() => {
|
2016-10-21 15:48:52 +00:00
|
|
|
plugins.beautylog.ok('TypeDoc documentation generated!');
|
2016-10-20 20:57:32 +00:00
|
|
|
done.resolve(configArg);
|
|
|
|
}, (err) => {
|
2016-10-21 15:48:52 +00:00
|
|
|
plugins.beautylog.warn('TypeDoc documentation generation failed!');
|
2016-10-20 20:57:32 +00:00
|
|
|
console.log(err);
|
|
|
|
done.resolve(configArg);
|
|
|
|
});
|
2016-07-14 22:38:41 +00:00
|
|
|
return done.promise;
|
|
|
|
};
|
|
|
|
exports.run = function (configArg) {
|
2016-10-02 18:35:13 +00:00
|
|
|
let done = q.defer();
|
2016-08-19 07:46:36 +00:00
|
|
|
if (configArg.docs) {
|
2016-08-13 21:54:17 +00:00
|
|
|
genTypeDoc(configArg)
|
2016-09-22 21:23:16 +00:00
|
|
|
.then(() => {
|
2016-08-13 21:54:17 +00:00
|
|
|
done.resolve(configArg);
|
|
|
|
});
|
|
|
|
}
|
2016-08-19 07:46:36 +00:00
|
|
|
else {
|
|
|
|
done.resolve(configArg);
|
|
|
|
}
|
2016-08-13 21:54:17 +00:00
|
|
|
;
|
2016-07-14 22:38:41 +00:00
|
|
|
return done.promise;
|
|
|
|
};
|