Search code examples
typescriptgruntjsdocumentationtypedoc

TypeDoc a few documentations from one project


I have to use a TypeDoc to prepare documentation of my project.

In my project I have a few folders (not related with eachother) with TS files, ex. folder A, folder B, etc.

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?


Solution

  • 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 :)