Merge "javascript/syncbase: Setup jsdoc for syncbase."
diff --git a/.gitignore b/.gitignore
index 8c5d116..f3fc3c8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,7 @@
+/docs
 /go/bin
 /node_modules
 /tmp
+/npm-debug.log
 
 /.v23
diff --git a/Makefile b/Makefile
index 589302b..162a083 100644
--- a/Makefile
+++ b/Makefile
@@ -109,6 +109,7 @@
 .PHONY: clean
 clean:
 	rm -rf \
+		docs \
 		go/bin \
 		node_modules \
 		tmp
@@ -120,3 +121,32 @@
 else
 	jshint .
 endif
+
+# The following target is copied and modifed from ../core/Makefile.
+DOCSTRAP_LOC:= node_modules/ink-docstrap
+JS_SRC_FILES = $(shell find src -name "*.js" | sed 's/ /\\ /')
+docs: $(JS_SRC_FILES) ../core/jsdocs/docstrap-template/compiled/site.vanadium.css | node_modules
+	# Copy our compiled style template
+	cp -f ../core/jsdocs/docstrap-template/compiled/site.vanadium.css ${DOCSTRAP_LOC}/template/static/styles
+
+	# Build the docs
+	jsdoc $^ --readme ./jsdocs/index.md --configure ./jsdocs/conf.json --template ${DOCSTRAP_LOC}/template --destination $@
+
+	# Copy favicon
+	cp -f ../core/jsdocs/favicon.ico $@
+
+# serve-docs
+#
+# Serve the docs at http://localhost:8020.
+serve-docs: docs
+	static docs -p 8020
+
+.PHONY: serve-docs
+
+.PHONY: deploy-docs-production
+deploy-docs-production: docs
+	make -C $(V23_ROOT)/infrastructure/deploy jsdoc-syncbase-production
+
+.PHONY: deploy-docs-staging
+deploy-docs-staging: docs
+	make -C $(V23_ROOT)/infrastructure/deploy jsdoc-syncbase-staging
diff --git a/jsdocs/conf.json b/jsdocs/conf.json
new file mode 100644
index 0000000..5010d4e
--- /dev/null
+++ b/jsdocs/conf.json
@@ -0,0 +1,7 @@
+{
+  "templates": {
+    "theme": "vanadium",
+    "inverseNav" : true,
+    "footer" : false
+  }
+}
\ No newline at end of file
diff --git a/jsdocs/index.md b/jsdocs/index.md
new file mode 100644
index 0000000..f30c4cf
--- /dev/null
+++ b/jsdocs/index.md
@@ -0,0 +1 @@
+##TODO(veyron-store): please write an index page similar to https://jsdoc.v.io/
diff --git a/package.json b/package.json
index 9eae686..838bf5d 100644
--- a/package.json
+++ b/package.json
@@ -12,10 +12,13 @@
     "async": "~1.0.0",
     "deep-equal": "~1.0.0",
     "format": "~0.2.1",
+    "ink-docstrap": "~0.4.12",
+    "jsdoc": "^3.3.0-alpha9",
     "jshint": "~2.7.0",
     "json-stable-stringify": "~1.0.0",
     "minimist": "~1.1.1",
     "mkdirp": "~0.5.1",
+    "node-static": "^0.7.4",
     "prova": "aghassemi/prova#0.0.4",
     "run-parallel": "~1.1.1",
     "stream-array": "~1.1.0",