Search code examples
javascripttypescriptgulptypedocgulp-typedoc

TypeDoc creating empty documentation


I have a gulp task that is supposed to take my files and create documentation for them. The task looks like this:

var gulp = require('gulp');
var gulptypedoc = require('gulp-typedoc');

gulp.task('typedoc-gamesmart', function () {
    return gulp.src([
        './src/util/Config.ts',
        './src/util/Http.ts',
        './typings/crypto-js/crypto-js.d.ts',
        './src/gamesmart/GameSmart.ts',
        './src/gamesmart/apis/Client.ts',
        './src/gamesmart/apis/Data.ts',
        './src/gamesmart/apis/Game.ts',
        './src/gamesmart/apis/Score.ts',
        './src/gamesmart/apis/Store.ts',
        './src/gamesmart/apis/User.ts',
        './src/gamesmart/main.ts',
    ]).pipe(gulptypedoc({
        // module: 'system',
        target: 'es5',
        out: 'docs/gamesmart/',
        name: 'GameSmart SDK',
        excludeNotExported: true,
        mode: 'file',
        version: true
    }));
});

When it completes, I get empty docs.

Empty Docs

Here is an example of the class structure:

class Score extends GameSmart {

    /**
     * Saves a score for the game
     *
     * @param {number} score        The score to be saved.
     * @param {Function} callback   The callback to run once complete.
     * @returns
     */
    public save(options: { score?: number } = {}, callback: Function = null, obj: Object = null): void {
        if ((options.score || 0) <= 0) { return; }
        this.makeRequest('/save', HttpMethod.Post, options, callback, obj);
    }

}

As you can see, I am not using modules, so as the documentation says to use mode: 'file' so I did, and I am not getting anything.

If I use mode: 'modules', I get a list of the classes, but no documentation:

Empty Doc Modules

Is there something that I am doing wrong?


Solution

  • To reiterate what @Sven said, no documentation will be generated if you use the excludedNotExported feature while not exporting any symbols. Change this flag to document the whole project.

    { // TypeDoc config
        target: 'es5',
        out: 'docs/gamesmart/',
        name: 'GameSmart SDK',
        excludeNotExported: false,
        mode: 'file',
        version: true
    }