2016-09-07 63 views
1

我有一個gulp任務,應該採取我的文件併爲他們創建文檔。任務如下所示:TypeDoc創建空文檔

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 
    })); 
}); 

當它完成時,我會得到空白文檔。

Empty Docs

這裏是類結構的例子:

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); 
    } 

} 

正如你所看到的,我沒有使用的模塊,從而將文檔說,使用mode: 'file',所以我做到了,我我沒有得到任何東西。

如果我使用mode: 'modules',我得到的類的列表,但沒有文件:

Empty Doc Modules

有什麼,我做錯了什麼?

+3

你不出口你的'Score'類,所以也許'excludeNotExported'應返回FALSE,而不是'真'? –

+0

這看起來像修復了問題!謝謝! –

回答

0

要重申@Sven所說的話,如果您在不導出任何符號的情況下使用excludedNotExported功能,則不會生成任何文檔。更改此標誌以記錄整個項目。

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