├── .travis.yml ├── .gitignore ├── .npmignore ├── test └── fixtures │ └── Main.ts ├── package.json ├── LICENSE-MIT ├── .jshintrc ├── tasks └── typedoc.js ├── Gruntfile.js └── README.md /.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - "0.10" 4 | - "4" 5 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | node_modules 2 | npm-debug.log 3 | tmp 4 | 5 | /.idea 6 | /*.tgz 7 | 8 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .npmignore 2 | .gitignore 3 | .gitmodules 4 | .travis.yml 5 | .jshintrc 6 | bower.json 7 | Gruntfile.js 8 | 9 | /.idea 10 | /node_modules 11 | /test 12 | /*.tgz 13 | -------------------------------------------------------------------------------- /test/fixtures/Main.ts: -------------------------------------------------------------------------------- 1 | export class Foo { 2 | name: string; 3 | bar: Bar; 4 | } 5 | 6 | export class Bar { 7 | name: string; 8 | } 9 | 10 | export class Buzz { 11 | prop: string | Bar[]; 12 | } 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "grunt-typedoc", 3 | "description": "Grunt plugin to generate TypeScript docs with TypeDoc", 4 | "version": "0.2.4", 5 | "homepage": "https://github.com/grunt-ts/grunt-typedoc", 6 | "author": { 7 | "name": "Bart van der Schoor", 8 | "url": "https://github.com/Bartvds" 9 | }, 10 | "repository": { 11 | "type": "git", 12 | "url": "https://github.com/grunt-ts/grunt-typedoc" 13 | }, 14 | "bugs": { 15 | "url": "https://github.com/grunt-ts/grunt-typedoc/issues" 16 | }, 17 | "license": "MIT", 18 | "keywords": [ 19 | "gruntplugin", 20 | "typescript", 21 | "typedoc" 22 | ], 23 | "main": "Gruntfile.js", 24 | "engines": { 25 | "node": ">= 0.10.0" 26 | }, 27 | "scripts": { 28 | "test": "grunt test" 29 | }, 30 | "dependencies": { 31 | "typedoc": "^0.4.1" 32 | }, 33 | "devDependencies": { 34 | "grunt": "^1.0.1", 35 | "grunt-cli": "^1.2.0", 36 | "grunt-contrib-clean": "^1.0.0", 37 | "grunt-contrib-jshint": "^1.0.0", 38 | "recursive-readdir": "^2.0.0" 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /LICENSE-MIT: -------------------------------------------------------------------------------- 1 | Copyright (c) 2014 Bart van der Schoor 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated documentation 5 | files (the "Software"), to deal in the Software without 6 | restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the 9 | Software is furnished to do so, subject to the following 10 | conditions: 11 | 12 | The above copyright notice and this permission notice shall be 13 | included in all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 16 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES 17 | OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 18 | NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 19 | HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 20 | WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 21 | FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "bitwise": true, 3 | "camelcase": false, 4 | "curly": true, 5 | "eqeqeq": true, 6 | "es3": false, 7 | "forin": true, 8 | "freeze": true, 9 | "immed": true, 10 | "indent": 4, 11 | "latedef": true, 12 | "newcap": true, 13 | "noarg": true, 14 | "noempty": true, 15 | "nonew": true, 16 | "plusplus": false, 17 | "quotmark": true, 18 | "undef": true, 19 | "unused": true, 20 | "strict": true, 21 | "trailing": true, 22 | 23 | "maxlen": 120, 24 | 25 | "asi": false, 26 | "boss": false, 27 | "debug": false, 28 | "eqnull": false, 29 | "esnext": true, 30 | "evil": false, 31 | "expr": false, 32 | "funcscope": false, 33 | "gcl": false, 34 | "globalstrict": true, 35 | "iterator": false, 36 | "lastsemic": false, 37 | "laxbreak": false, 38 | "laxcomma": false, 39 | "loopfunc": false, 40 | "maxerr": 50, 41 | "moz": false, 42 | "multistr": false, 43 | "notypeof": false, 44 | "proto": false, 45 | "scripturl": false, 46 | "smarttabs": true, 47 | "shadow": false, 48 | "sub": false, 49 | "supernew": false, 50 | "validthis": false, 51 | 52 | "browser": false, 53 | "couch": false, 54 | "devel": false, 55 | "dojo": false, 56 | "jquery": false, 57 | "mootools": false, 58 | "node": true, 59 | "nonstandard": false, 60 | "prototypejs": false, 61 | "rhino": false, 62 | "worker": false, 63 | "wsh": false, 64 | "yui": false, 65 | 66 | "globals": { 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /tasks/typedoc.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function (grunt) { 4 | 5 | grunt.registerMultiTask('typedoc', 'Generate TypeScript docs', function () { 6 | var options = this.options({}); 7 | 8 | var args = []; 9 | for (var key in options) { 10 | if (options.hasOwnProperty(key) && (typeof options[key] !== 'boolean' || options[key])) { 11 | args.push('--' + key); 12 | if (typeof options[key] !== 'boolean' && !!options[key]) { 13 | args.push(options[key]); 14 | } 15 | } 16 | } 17 | for (var i = 0; i < this.filesSrc.length; i++) { 18 | args.push(this.filesSrc[i]); 19 | } 20 | 21 | // lazy init 22 | var path = require('path'); 23 | var child_process = require('child_process'); 24 | var typedoc; 25 | 26 | try { 27 | typedoc = require.resolve('../../typedoc/package.json'); 28 | } catch(e) { 29 | typedoc = require.resolve('typedoc/package.json'); 30 | } 31 | 32 | var winExt = /^win/.test(process.platform) ? '.cmd' : ''; 33 | 34 | var done = this.async(); 35 | var executable = path.resolve(typedoc, '..', '..', '.bin', 'typedoc' + winExt); 36 | 37 | var child = child_process.spawn(executable, args, { 38 | stdio: 'inherit', 39 | env: process.env 40 | }).on('exit', function (code) { 41 | if (code !== 0) { 42 | done(false); 43 | } 44 | if (child) { 45 | child.kill(); 46 | } 47 | done(); 48 | }); 49 | }); 50 | }; 51 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | /* 2 | * grunt-typedoc 3 | * https://github.com/grunt-ts/grunt-typedoc 4 | * 5 | * Copyright (c) 2013 Bart van der Schoor 6 | * Licensed under the MIT license. 7 | */ 8 | 9 | 'use strict'; 10 | 11 | module.exports = function (grunt) { 12 | 13 | grunt.loadNpmTasks('grunt-contrib-jshint'); 14 | grunt.loadNpmTasks('grunt-contrib-clean'); 15 | 16 | grunt.loadTasks('tasks'); 17 | 18 | var path = require('path'); 19 | 20 | grunt.registerTask('verify', function () { 21 | var done = this.async(); 22 | var expected = [ 23 | 'classes/_main_.bar.html', 24 | 'classes/_main_.foo.html', 25 | 'modules/_main_.html', 26 | 'globals.html', 27 | 'index.html' 28 | ]; 29 | 30 | var recursive = require('recursive-readdir'); 31 | var assert = require('assert'); 32 | 33 | recursive('test/tmp', function (err, files) { 34 | if (err) { 35 | done(err); 36 | return; 37 | } 38 | expected = expected.map(function (file) { 39 | return path.join('test', 'tmp', file.replace(/[\\\/]/g, path.sep)); 40 | }).sort(); 41 | 42 | files.sort(); 43 | 44 | expected.forEach(function (file, i) { 45 | assert(files.indexOf(file) > -1, 'file ' + i + ' ' + expected[i]); 46 | }); 47 | grunt.log.writeln('verfied ' + expected.length + ' files'); 48 | done(); 49 | }); 50 | }); 51 | 52 | grunt.initConfig({ 53 | clean: { 54 | test: ['./test/tmp'] 55 | }, 56 | jshint: { 57 | options: { 58 | jshintrc: '.jshintrc' 59 | }, 60 | all: [ 61 | 'Gruntfile.js', 62 | 'tasks/**/*.js' 63 | ] 64 | }, 65 | typedoc: { 66 | test: { 67 | options: { 68 | module: 'commonjs', 69 | name: 'test-project', 70 | target: 'es5', 71 | out: './test/tmp' 72 | }, 73 | src: ['./test/fixtures/**'] 74 | } 75 | } 76 | }); 77 | 78 | grunt.registerTask('test', ['clean', 'jshint', 'typedoc:test', 'verify']); 79 | grunt.registerTask('default', ['test']); 80 | }; 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # grunt-typedoc 2 | 3 | > Grunt [plugin](http://gruntjs.com/) to generate TypeScript docs with [TypeDoc](https://github.com/sebastian-lenz/typedoc) 4 | 5 | [![Build Status](https://api.travis-ci.org/TypeStrong/grunt-typedoc.png?branch=master)](http://travis-ci.org/TypeStrong/grunt-typedoc) 6 | [![Dependency Status](https://gemnasium.com/TypeStrong/grunt-typedoc.png)](https://gemnasium.com/TypeStrong/grunt-typedoc) 7 | [![NPM version](https://badge.fury.io/js/grunt-typedoc.png)](http://badge.fury.io/js/grunt-typedoc) 8 | 9 | Based on [gulp-typedoc](https://github.com/rogierschouten/gulp-typedoc) by @rogierschouten 10 | 11 | ## Getting Started 12 | This plugin requires Grunt `~0.4.1` 13 | 14 | If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: 15 | 16 | ```shell 17 | $ npm install grunt-typedoc --save-dev 18 | ``` 19 | 20 | Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: 21 | 22 | ```js 23 | grunt.loadNpmTasks('grunt-typedoc'); 24 | ``` 25 | 26 | ## The "grunt-typedoc" task 27 | 28 | ### Default Options 29 | 30 | All options are passed directly to [TypeDoc](https://sebastian-lenz.github.io/typedoc/). 31 | 32 | ```js 33 | grunt.initConfig({ 34 | typedoc: { 35 | build: { 36 | options: { 37 | module: 'commonjs', 38 | out: './docs', 39 | name: 'my-project', 40 | target: 'es5' 41 | }, 42 | src: ['./src/**/*'] 43 | } 44 | } 45 | }); 46 | ``` 47 | 48 | 49 | ## History 50 | 51 | * 0.1.1 - First release 52 | 53 | ## Contributing 54 | 55 | Contributions are very welcome, please create an Issue before doing something major. 56 | 57 | In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com/). 58 | 59 | 60 | ## License 61 | 62 | Copyright (c) 2014 [Bart van der Schoor](https://github.com/Bartvds) 63 | 64 | Licensed under the MIT license. 65 | --------------------------------------------------------------------------------