Procházet zdrojové kódy

Merge pull request #42 from opensheetmusicdisplay/feature/typedoc

Class documentation
matt-uib před 8 roky
rodič
revize
bc91091099
5 změnil soubory, kde provedl 42 přidání a 5 odebrání
  1. 3 0
      .gitignore
  2. 2 0
      .travis.yml
  3. 16 1
      Gruntfile.js
  4. 15 0
      bin/publish_docs.sh
  5. 6 4
      package.json

+ 3 - 0
.gitignore

@@ -11,6 +11,9 @@ pids
 *.pid
 *.seed
 
+# Documentation
+docs
+
 # Directory for instrumented libs generated by jscoverage/JSCover
 lib-cov
 

+ 2 - 0
.travis.yml

@@ -15,3 +15,5 @@ deploy:
     tags: true
     branch: master
     repo: opensheetmusicdisplay/opensheetmusicdisplay
+after_deploy:
+  - ./bin/publish_docs.sh

+ 16 - 1
Gruntfile.js

@@ -121,6 +121,19 @@ module.exports = function (grunt) {
         typings: {
             install: {}
         },
+        // Class documentation using typedoc
+        typedoc: {
+            build: {
+                options: {
+                    module: 'commonjs',
+                    out: './build/docs',
+                    name: 'opensheetmusicdisplay',
+                    target: 'es5',
+                    mode: 'file'
+                },
+                src: ['./src/**/*.ts', './external/**/*.ts', './typings/**/*.ts']
+            }
+        },
         // Cleaning task setup
         clean: {
             options: {
@@ -168,6 +181,7 @@ module.exports = function (grunt) {
     grunt.loadNpmTasks('grunt-contrib-jshint');
     grunt.loadNpmTasks('grunt-contrib-uglify');
     grunt.loadNpmTasks('grunt-http-server');
+    grunt.loadNpmTasks('grunt-typedoc');
 
     // Register tasks
     grunt.registerTask('lint',      ['jshint', 'tslint']);
@@ -175,10 +189,11 @@ module.exports = function (grunt) {
     grunt.registerTask('all',       ['typings', 'default']);
     grunt.registerTask('default',   ['browserify', 'uglify']);
     grunt.registerTask('npm-test',  ['typings', 'test']);
+    grunt.registerTask('docs',      ['typedoc']);
     grunt.registerTask('test',      ['browserify:debug', 'lint', 'karma:ci']);
     grunt.registerTask('fast-test', ['browserify:debug', 'karma:ci']);
     grunt.registerTask('rebuild',   ['clean', 'default']);
-    grunt.registerTask('publish',   ['clean', 'typings', 'browserify:dist', 'uglify:bundle']);
+    grunt.registerTask('publish',   ['clean', 'typings', 'browserify:dist', 'uglify:bundle', 'docs']);
     grunt.registerTask('debug-build', ['browserify:demo']);
     grunt.registerTask('debug-browser', ['http-server:demo']);
 

+ 15 - 0
bin/publish_docs.sh

@@ -0,0 +1,15 @@
+#!/bin/bash
+
+grunt docs
+git clone git@github.com:opensheetmusicdisplay/opensheetmusicdisplay.github.io.git
+cd opensheetmusicdisplay.github.io
+git status
+rsync -a ../build/docs/* ./
+git status
+git add *
+git commit -m "Pushed auto-generated class documentation for $TRAVIS_TAG"
+git tag -a $TRAVIS_TAG -m "Class documentation for $TRAVIS_TAG"
+git push origin master --follow-tags
+echo "Deployed class documentation for $TRAVIS_TAG successfully."
+cd ..
+rm -rf opensheetmusicdisplay.github.io

+ 6 - 4
package.json

@@ -7,7 +7,7 @@
   "scripts": {
     "test": "grunt npm-test",
     "postinstall": "typings install",
-    "prepublish": "tsc"
+    "prepublish": "tsc && grunt publish"
   },
   "repository": {
     "type": "git",
@@ -41,10 +41,12 @@
     "grunt-contrib-jshint": "^1.0.0",
     "grunt-contrib-uglify": "^2.0.0",
     "grunt-contrib-watch": "^1.0.0",
+    "grunt-http-server": "",
     "grunt-karma": "^2.0.0",
     "grunt-tslint": "^3.1.1",
+    "grunt-typedoc": "^0.2.4",
     "grunt-typings": "^0.1.5",
-    "grunt-http-server": "",
+    "http-server": "",
     "karma": "^1.1.1",
     "karma-base64-to-js-preprocessor": "0.0.1",
     "karma-chai": "^0.1.0",
@@ -58,8 +60,8 @@
     "phantomjs-prebuilt": "^2.1.8",
     "tsify": "^1.0.2",
     "tslint": "3.8.0",
+    "typedoc": "^0.4.4",
     "typescript": "^1.8.10",
-    "typings": "^1.3.1",
-    "http-server": ""
+    "typings": "^1.3.1"
   }
 }