diff --git a/gruntfile.js b/gruntfile.js index de86c4858..8094a9619 100644 --- a/gruntfile.js +++ b/gruntfile.js @@ -132,6 +132,7 @@ module.exports = function(grunt) { outModulesDir: tsconfig.compilerOptions.outDir, outAppsDir: "./bin/dist/apps", outTsAppsDir: "./bin/dist/ts-apps", + outApiRefDir: "./bin/dist/api-ref" }; var nodeTestEnv = JSON.parse(JSON.stringify(process.env)); @@ -150,6 +151,16 @@ module.exports = function(grunt) { "!android17.d.ts", "!libjs.d.ts" ]); + localCfg.srcTsdFiles = [ + "**/*.d.ts", + "!apps/**", + "!node-tests/**", + "!org.nativescript.widgets.d.ts", + "!android17.d.ts", + "!**/*.android.d.ts", + "!ios.d.ts", + "!**/*.ios.d.ts" + ].concat(localCfg.defaultExcludes); var tsOptions = tsconfig.compilerOptions; tsOptions.fast = 'never'; @@ -412,6 +423,26 @@ module.exports = function(grunt) { pathModule.join(localCfg.outDir, "**/*.xml") ] } + }, + typedoc: { + build: { + options: { + // 'flag:undefined' will set flags without options. + "module": 'commonjs', + "target": 'es5', + "out": localCfg.outApiRefDir, + //"json": './dist/doc.json', + "name": 'NativeScript', + "includeDeclarations": undefined, + //"excludeExternals": undefined, + //"externalPattern": './declarations.d.ts', + "mode": "file", + //"readme": "source/README.md", + //"entryPoint": '"a-module"' + // verbose: undefined + }, + src: localCfg.srcTsdFiles + } } }); @@ -425,6 +456,7 @@ module.exports = function(grunt) { grunt.loadNpmTasks("grunt-env"); grunt.loadNpmTasks("grunt-simple-mocha"); grunt.loadNpmTasks('grunt-bom-removal'); + grunt.loadNpmTasks('grunt-typedoc'); var cloneTasks = function(originalTasks, taskNameSuffix) { var clonedTasks = []; diff --git a/package.json b/package.json index de79d000a..3cce63271 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "grunt-simple-mocha": "0.4.0", "grunt-ts": "5.0.0-beta.5", "grunt-tslint": "2.5.0", + "grunt-typedoc": "0.2.3", "grunt-untar": "0.0.1", "mocha": "2.2.5", "typescript": "1.6.2"