From c19a760691f461af2cc87e3a29cdff815234e53b Mon Sep 17 00:00:00 2001 From: Kamil Nikel Date: Wed, 4 Nov 2015 17:32:31 +0100 Subject: [PATCH] Add documentation task --- Gulpfile.js | 7 +++++++ package.json | 1 + src/Viewer.ts | 7 +++++++ 3 files changed, 15 insertions(+) diff --git a/Gulpfile.js b/Gulpfile.js index 322474cb..d33f16cd 100644 --- a/Gulpfile.js +++ b/Gulpfile.js @@ -1,6 +1,7 @@ var gulp = require('gulp') var browserify = require('browserify') +var documentation = require('gulp-documentation') var source = require('vinyl-source-stream') var serve = require('gulp-serve') var standard = require('gulp-standard') @@ -87,4 +88,10 @@ gulp.task('browserify', ['typescript'], function () { .pipe(gulp.dest('./dist/')) }) +gulp.task('documentation', ['typescript'], function () { + gulp.src('./dist/Viewer.js') + .pipe(documentation({format: 'html' })) + .pipe(gulp.dest('html-documentation')) +}) + gulp.task('default', ['serve', 'watch-ts', 'typescript']) diff --git a/package.json b/package.json index dec18640..c779be1b 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "browserify": "12.0.1", "ghooks": "0.3.2", "gulp": "3.9.0", + "gulp-documentation": "2.0.0", "gulp-serve": "1.2.0", "gulp-standard": "5.2.2", "gulp-tsd": "0.0.4", diff --git a/src/Viewer.ts b/src/Viewer.ts index a6fcdcdb..041826fb 100644 --- a/src/Viewer.ts +++ b/src/Viewer.ts @@ -2,6 +2,13 @@ interface INode { node: string; } +/** + * This function initializes the viewer + * @param { string } id of the viewer + * @param { Node } initialNode which the viewer displays + * @returns { Viewer } a new viewer + */ + export class Viewer { constructor (id: string, node: INode ) { return "Viewer -- id: " + id + ", node: " + node.node;