简体   繁体   English

TypeDoc来自一个项目的一些文档

[英]TypeDoc a few documentations from one project

I have to use a TypeDoc to prepare documentation of my project. 我必须使用TypeDoc来准备项目的文档。

In my project I have a few folders (not related with eachother) with TS files, ex. 在我的项目中,我有几个包含TS文件的文件夹(彼此无关),例如。 folder A, folder B, etc. 文件夹A,文件夹B等

I was very simple when I wanted only one documentation from one or more folders but it quite hard for me to generate a seperated documentations for each folder. 当我只想要一个或多个文件夹中的一个文档时,我非常简单,但是很难为每个文件夹生成单独的文档。

For one folder my config file looks like: 对于一个文件夹,我的配置文件如下所示:

typedoc: {
    build: {
        options: {
            module: 'commonjs',
            out: '../Documentation/A',
            name: 'Documentation for A folder',
            target: 'es5',
            exclude: '**/*.d.ts',
            excludePrivate: true,
            mode: 'file'
        },
        src: [
            'js/A/*.ts'
        ]
    }
}

I have not idea how this config should be build if I want to a separated documentations for each of my folders. 如果我想为每个文件夹创建单独的文档,我不知道应该如何构建此配置。

I tried array of builds something like that (but without success): 我尝试了类似的构建数组(但没有成功):

typedoc: {
    build: [{
        options: {
            module: 'commonjs',
            out: '../Documentation/A',
            name: 'Documentation for A folder',
            target: 'es5',
            exclude: '**/*.d.ts',
            excludePrivate: true,
            mode: 'file'
        },
        src: [
            'js/A/*.ts'
        ]
    },
    {
        options: {
            module: 'commonjs',
            out: '../Documentation/B',
            name: 'Documentation for B folder',
            target: 'es5',
            exclude: '**/*.d.ts',
            excludePrivate: true,
            mode: 'file'
        },
        src: [
            'js/B/*.ts'
        ]
    }]
}

any ideas? 有任何想法吗?

OK, I solved my problem by myself. 好,我自己解决了问题。 When I need to a few builds I should to create my config file like that: 当我需要一些构建时,我应该像这样创建配置文件:

typedoc: {
    buildA: {
        options: {
            module: 'commonjs',
            out: '../Documentation/A',
            name: 'Documentation for A folder',
            target: 'es5',
            exclude: '**/*.d.ts',
            excludePrivate: true,
            mode: 'file'
        },
        src: [
            'js/A/*.ts'
        ]
    },
    buildB: {
        options: {
            module: 'commonjs',
            out: '../Documentation/B',
            name: 'Documentation for B folder',
            target: 'es5',
            exclude: '**/*.d.ts',
            excludePrivate: true,
            mode: 'file'
        },
        src: [
            'js/B/*.ts'
        ]
    }
}

and I should to call it something like that: 我应该这样称呼它:

typedoc:buildA

or 要么

typedoc:buildB

that's all :) 就这样 :)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM