【问题标题】:TypeDoc a few documentations from one projectTypeDoc 来自一个项目的一些文档
【发布时间】:2018-08-13 14:43:55
【问题描述】:

我必须使用 TypeDoc 来准备我的项目文档。

在我的项目中,我有一些包含 TS 文件的文件夹(彼此不相关),例如。文件夹 A、文件夹 B 等

当我想要一个或多个文件夹中的一个文档时,我非常简单,但我很难为每个文件夹生成单独的文档。

对于一个文件夹,我的配置文件如下所示:

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'
        ]
    }
}

如果我想为我的每个文件夹分开文档,我不知道应该如何构建这个配置。

我尝试了类似的构建数组(但没有成功):

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'
        ]
    }]
}

有什么想法吗?

【问题讨论】:

    标签: typescript gruntjs documentation typedoc


    【解决方案1】:

    好的,我自己解决了我的问题。 当我需要一些构建时,我应该像这样创建我的配置文件:

    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'
            ]
        }
    }
    

    我应该这样称呼它:

    typedoc:buildA
    

    typedoc:buildB
    

    就是这样:)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2019-11-07
      • 2013-04-05
      • 1970-01-01
      • 2010-10-20
      • 1970-01-01
      • 1970-01-01
      • 2014-10-06
      相关资源
      最近更新 更多