【问题标题】:TypeDoc and how to exclude *.d.ts files only from few pathsTypeDoc 以及如何仅从少数路径中排除 *.d.ts 文件
【发布时间】:2019-01-29 14:33:54
【问题描述】:

我有下一个关于 TypeDoc 的问题。 所以我有一个这样的 TypeDoc 配置:

typedoc: {
    build: {
        options: {
            module: 'commonjs',
            out: '../MyDocumentation/',
            name: 'MyApp',
            target: 'es5',
            exclude: '**/*/*.d.ts',
            excludePrivate: true,
            mode: 'file'
        },
        src: [
            ...some sources...
        ]
    }
}

在我的应用程序中有一些带有 *.ts 文件的路径。重新编译这些文件后,*.d.ts 文件已创建,我想将其排除。

因此,出于这个问题的需要,我们假设我的路径如下所示:

  • MyApp/Scr​​ipts/FolderA/(有几个*.ts文件,例如:fileA.ts)
  • MyApp/Scr​​ipts/FolderB/(有几个*.ts文件,例如:fileB.ts)
  • MyApp/Scr​​ipts/FolderC/(有几个*.ts文件,例如:fileC.ts)

现在我的 TypeDoc 配置正在从完整的应用程序中排除所有 *.d.ts 文件。

我正在尝试排除 *.d.ts 文件,但仅从我定义的路径中排除,因此我尝试了几种方法来定义我的排除模式:

  1. exclude: 'Scripts/{FolderA,FolderB,FolderC}/*.d.ts' 但它只是忽略了
  2. exclude: '**/*+(FolderA|FolderB|FolderC)/*.d.ts' 但我遇到了 Process terminated with code 3. 'FolderB' is not recognized as an internal or external command, operable program or batch file 错误。
  3. exclude: '**/{FolderA,FolderB,FolderC}/*.d.ts' 但它也只是忽略了
  4. exclude: [
        'Scripts/FolderA/*.d.ts',
        'Scripts/FolderB/*.d.ts',
        'Scripts/FolderC/*.d.ts'
    ]
    

    但它也忽略了......

  5. **/FolderA/*.d.ts 不忽略但是怎么加几条路径?我的一些路径有一个子文件夹,例如。 **/FolderA/ver1/*.d.ts

这都是因为我需要在我的文档中包含来自node_modules 的所有index.d.ts 文件。我需要参考那些库。

也许还有其他方法可以做到这一点?

我看到了this comment,但我不知道为什么 - 我的 typedoc 重新编译任务忽略了该模式。

【问题讨论】:

    标签: regex typescript gruntjs documentation typedoc


    【解决方案1】:

    好的,我自己找到了答案……再次!

    我需要这样的东西:

    exclude: [
        '**/FolderA/*.d.ts',
        '**/FolderA/ver1/*.d.ts',
        '**/FolderB/*.d.ts',
        '**/FolderC/*.d.ts'
    ]
    

    现在我必须知道如何仅包含来自node_moduleindex.d.ts 文件:D


    这是小菜一碟 - 我需要添加到 src 行:'node_modules/*/index.d.ts'

    【讨论】:

      猜你喜欢
      • 2014-11-21
      • 2021-05-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-08
      • 1970-01-01
      相关资源
      最近更新 更多