diff options
author | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:10:37 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2017-05-24 15:11:17 +0200 |
commit | 7a3df06eb573d36142bd1a8e03c5ce8752d300b3 (patch) | |
tree | 70bfaea8884c374876f607774850a3a51c0cb381 /node_modules/typedoc/tasks/typedoc.js | |
parent | aca1143cb9eed16cf37f04e475e4257418dd18ac (diff) | |
download | wallet-core-7a3df06eb573d36142bd1a8e03c5ce8752d300b3.tar.xz |
fix build issues and add typedoc
Diffstat (limited to 'node_modules/typedoc/tasks/typedoc.js')
-rw-r--r-- | node_modules/typedoc/tasks/typedoc.js | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/node_modules/typedoc/tasks/typedoc.js b/node_modules/typedoc/tasks/typedoc.js new file mode 100644 index 000000000..88338138c --- /dev/null +++ b/node_modules/typedoc/tasks/typedoc.js @@ -0,0 +1,56 @@ +module.exports = function (grunt) { + 'use strict'; + + var Path = require('path'); + var TypeDoc = require(Path.join(__dirname, '..', 'bin', 'typedoc.js')); + + grunt.registerMultiTask('typedoc', 'Generate documentations for TypeScript projects', function () { + var options = this.options({}); + if (!options.out && !options.json) { + grunt.log.error('You must either specify the \'out\' or \'json\' option.'); + return false; + } + + if (this.filesSrc.length == 0) { + grunt.log.error('No source files specified.'); + return false; + } + + var out = options.out; + var json = options.json; + delete options.out; + delete options.json; + + options.logger = function(message, level, newLine) { + switch (level) { + case TypeDoc.LogLevel.Success: + grunt.log.ok(message); + break; + case TypeDoc.LogLevel.Info: + case TypeDoc.LogLevel.Warn: + if (newLine) { + grunt.log.writeln(message); + } else { + grunt.log.write(message); + } + break; + case TypeDoc.LogLevel.Error: + grunt.log.error(message); + break; + default: + grunt.verbose.write(message); + break; + } + }; + + var app = new TypeDoc.Application(options); + var project = app.convert(app.expandInputFiles(this.filesSrc)); + if (!project) { + return false; + } + + if (out) app.generateDocs(project, out); + if (json) app.generateJson(project, json); + return true; + }); +};
\ No newline at end of file |