From 9c48e5c5c76231444f5f62e36505ce5d17750b21 Mon Sep 17 00:00:00 2001
From: Vytor Calixto <vytorcalixto@gmail.com>
Date: Mon, 19 Sep 2016 11:42:19 -0300
Subject: [PATCH] Add jsdoc

---
 .gitignore        |  1 +
 gulpfile.babel.js |  9 ++++++++-
 jsdoc.json        | 19 +++++++++++++++++++
 package.json      |  5 ++++-
 4 files changed, 32 insertions(+), 2 deletions(-)
 create mode 100644 jsdoc.json

diff --git a/.gitignore b/.gitignore
index 40ce7767..979717eb 100644
--- a/.gitignore
+++ b/.gitignore
@@ -19,3 +19,4 @@ build/*
 .gulp-cache
 
 config.json
+docs/
diff --git a/gulpfile.babel.js b/gulpfile.babel.js
index cecae587..65d653a6 100644
--- a/gulpfile.babel.js
+++ b/gulpfile.babel.js
@@ -10,6 +10,8 @@ const nodemon = require('gulp-nodemon');
 
 const Cache = require('gulp-file-cache');
 
+const jsdoc = require('gulp-jsdoc3');
+
 const cache = new Cache();
 
 /**
@@ -36,6 +38,12 @@ function compile() {
 
 gulp.task('build', compile);
 
+gulp.task('doc', (cb) => {
+    let config = require('./jsdoc.json');
+    gulp.src(['README.md', './src/**/*.js'], {read: false})
+        .pipe(jsdoc(config, cb));
+});
+
 gulp.task('test', () => {
   gulp.src('test/test.js', {read: false})
     .pipe(mocha())
@@ -69,4 +77,3 @@ gulp.task('run', () => {
 });
 
 gulp.task('default', ['run']);
-
diff --git a/jsdoc.json b/jsdoc.json
new file mode 100644
index 00000000..3456657c
--- /dev/null
+++ b/jsdoc.json
@@ -0,0 +1,19 @@
+{
+    "tags": {
+        "allowUnknownTags": true
+    },
+    "plugins": [
+        "plugins/markdown"
+    ],
+    "opts": {
+        "template": "./node_modules/docdash/",
+        "encoding": "utf8",
+        "destination": "docs/",
+        "recurse": true,
+        "verbose": true
+    },
+    "templates": {
+        "cleverLinks": false,
+        "monospaceLinks": false
+    }
+}
diff --git a/package.json b/package.json
index a01bc76a..87652e4a 100644
--- a/package.json
+++ b/package.json
@@ -39,6 +39,7 @@
     "babel-register": "^6.14.0",
     "babelify": "^7.3.0",
     "browserify": "^13.1.0",
+    "docdash": "^0.4.0",
     "eslint": "^3.3.1",
     "eslint-config-airbnb": "^10.0.1",
     "eslint-plugin-import": "^1.13.0",
@@ -49,10 +50,12 @@
     "gulp-cli": "^1.2.2",
     "gulp-eslint": "^3.0.1",
     "gulp-file-cache": "0.0.1",
+    "gulp-jsdoc3": "^0.3.0",
     "gulp-mocha": "^3.0.1",
     "gulp-nodemon": "^2.1.0",
     "gulp-plumber": "^1.1.0",
     "gulp-rename": "^1.2.2",
-    "gulp-uglify": "^2.0.0"
+    "gulp-uglify": "^2.0.0",
+    "jsdoc": "^3.4.1"
   }
 }
-- 
GitLab