parent
c7593efb9c
commit
ed62c716f6
@ -1,2 +1,5 @@ |
||||
/** |
||||
* test type docs |
||||
*/ |
||||
export type ShardID = string | number; |
||||
export type Shards = Map<ShardID, string>; |
||||
|
@ -0,0 +1,87 @@ |
||||
import path from 'path'; |
||||
import {projects, preProcessFunc, preProcessProjects} from './projects'; |
||||
// tslint:disable-next-line: no-implicit-dependencies no-var-requires
|
||||
import spawn from 'cross-spawn'; |
||||
|
||||
// tslint:disable-next-line: no-var-requires
|
||||
const runner = require.resolve('./typedoc/runner'); |
||||
const options = {stdio: 'inherit'}; |
||||
|
||||
const outputs = process.argv.slice(2)[0].split(','); |
||||
// docusaurus,vuepress,gitbook,bitbucket
|
||||
|
||||
async function docs() { |
||||
await preProcessFunc(preProcessProjects); |
||||
for (const pkg of projects) { |
||||
if (outputs.indexOf('gitbook') !== -1) { |
||||
spawn( |
||||
'node', |
||||
[runner, '-p', `${pkg.path}`, '-s', `${pkg.src}`, '-t', 'gitbook'], |
||||
options, |
||||
); |
||||
} |
||||
if (outputs.indexOf('vuepress') !== -1) { |
||||
spawn( |
||||
'node', |
||||
[runner, '-p', `${pkg.path}`, '-s', `${pkg.src}`, '-t', 'vuepress'], |
||||
options, |
||||
); |
||||
} |
||||
if (outputs.indexOf('docusaurus') !== -1) { |
||||
spawn( |
||||
'node', |
||||
[runner, '-p', `${pkg.path}`, '-s', `${pkg.src}`, '-t', 'docusaurus'], |
||||
options, |
||||
); |
||||
} |
||||
if (outputs.indexOf('bitbucket') !== -1) { |
||||
spawn( |
||||
'node', |
||||
[runner, '-p', `${pkg.path}`, '-s', `${pkg.src}`, '-t', 'bitbucket'], |
||||
options, |
||||
); |
||||
} |
||||
if (outputs.indexOf('default') !== -1) { |
||||
spawn( |
||||
'node', |
||||
[runner, '-p', `${pkg.path}`, '-s', `${pkg.src}`, '-t', 'default'], |
||||
options, |
||||
); |
||||
} |
||||
} |
||||
} |
||||
|
||||
docs(); |
||||
|
||||
// async function docs() {
|
||||
// await preProcessFunc(preProcessProjects);
|
||||
|
||||
// for (const pkg of projects) {
|
||||
// const app = new Application({
|
||||
// mode: 'file',
|
||||
// tsconfig: `${pkg.path}/tsconfig.json`,
|
||||
// theme: 'markdown',
|
||||
// plugin: path.resolve('node_modules/typedoc-plugin-markdown'),
|
||||
// platform: 'gitbook',
|
||||
// });
|
||||
|
||||
// const files = [...app.expandInputFiles([pkg.src])];
|
||||
// app.options.setValue('platform', 'gitbook');
|
||||
// // const project = app.convert();
|
||||
// const outputDir = `${pkg.path}/doc`;
|
||||
|
||||
// // Rendered docs
|
||||
// app.generateDocs(files, outputDir);
|
||||
// // if (project) {
|
||||
// // // Project may not have converted correctly
|
||||
// // const outputDir = `${pkg.path}/doc`;
|
||||
|
||||
// // // Rendered docs
|
||||
// // app.generateDocs(project, outputDir);
|
||||
// // // Alternatively generate JSON output
|
||||
// // // app.generateJson(project, outputDir + '/documentation.json');
|
||||
// // }
|
||||
// }
|
||||
// }
|
||||
|
||||
// docs();
|
@ -0,0 +1,35 @@ |
||||
// tslint:disable-next-line: no-var-requires
|
||||
const path = require('path'); |
||||
// tslint:disable-next-line: no-implicit-dependencies no-var-requires
|
||||
const {Application} = require('typedoc'); |
||||
// tslint:disable-next-line: no-implicit-dependencies no-var-requires
|
||||
const arg = require('arg'); |
||||
|
||||
const args = arg({ |
||||
'--pkgPath': String, |
||||
'-p': '--pkgPath', |
||||
'--pkgSrc': String, |
||||
'-s': '--pkgSrc', |
||||
'--target': String, |
||||
'-t': '--target', |
||||
}); |
||||
|
||||
const pkgSrc = args['--pkgSrc']; |
||||
const pkgPath = args['--pkgPath']; |
||||
const target = args['--target']; |
||||
|
||||
const app = new Application({ |
||||
mode: 'file', |
||||
tsconfig: `${pkgPath}/tsconfig.json`, |
||||
theme: target === 'default' ? 'default' : 'markdown', |
||||
plugin: path.resolve('node_modules/typedoc-plugin-markdown'), |
||||
platform: target, |
||||
}); |
||||
|
||||
const files = [...app.expandInputFiles([pkgSrc])]; |
||||
|
||||
// // const project = app.convert();
|
||||
const outputDir = `${pkgPath}/doc/${target}`; |
||||
// console.log({ttt, files, outputDir});
|
||||
// // Rendered docs
|
||||
app.generateDocs(files, outputDir); |
Loading…
Reference in new issue