tscoverage/ts/npmts.typedoc.ts

56 lines
1.6 KiB
TypeScript
Raw Normal View History

2016-09-06 15:21:25 +00:00
import plugins = require('./npmts.plugins')
import paths = require('./npmts.paths')
import { npmtsOra } from './npmts.promisechain'
2016-07-14 22:38:41 +00:00
2016-10-02 18:35:13 +00:00
import * as q from 'q'
2016-09-06 15:21:25 +00:00
import { projectInfo } from './npmts.check'
2016-09-02 12:10:09 +00:00
2016-08-13 21:54:17 +00:00
let genTypeDoc = function (configArg) {
2016-10-02 18:35:13 +00:00
let done = q.defer()
2016-09-06 15:21:25 +00:00
npmtsOra.text('now generating ' + 'TypeDoc documentation'.yellow)
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({
2016-08-13 21:54:17 +00:00
// TypeScript options (see typescript docs)
2016-09-06 15:21:25 +00:00
module: 'commonjs',
target: 'es6',
2016-08-13 21:54:17 +00:00
includeDeclarations: true,
// Output options (see typedoc docs)
2016-08-30 14:35:46 +00:00
out: paths.pagesApiDir,
2016-09-06 15:21:25 +00:00
json: plugins.path.join(paths.pagesApiDir, 'file.json'),
2016-08-13 21:54:17 +00:00
// TypeDoc options (see typedoc docs)
2016-09-02 12:10:09 +00:00
name: projectInfo.name,
2016-09-06 15:21:25 +00:00
readme: plugins.path.join(paths.cwd, 'README.md'),
2016-09-02 12:10:09 +00:00
// theme: "default",
2016-09-06 15:21:25 +00:00
version: true
2016-10-20 20:57:32 +00:00
})
])
localSmartstream.run().then(
() => {
done.resolve(configArg)
},
(err) => {
console.log(err)
done.resolve(configArg)
}
)
2016-09-06 15:21:25 +00:00
return done.promise
}
2016-07-14 22:38:41 +00:00
2016-08-13 21:54:17 +00:00
export let 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)
.then(() => {
2016-09-06 15:21:25 +00:00
done.resolve(configArg)
})
2016-08-19 07:46:36 +00:00
} else {
2016-09-06 15:21:25 +00:00
done.resolve(configArg)
2016-08-13 21:54:17 +00:00
};
2016-09-06 15:21:25 +00:00
return done.promise
}