diff --git a/.gitignore b/.gitignore index ee94d8e7..b566189e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ **/*.js.map **/*.d.ts +/docs + /aot *.metadata.json **/*.ngFactory.ts @@ -9,4 +11,6 @@ /npm-debug.log /node_modules -/typings \ No newline at end of file +/typings + +!gulpfile.js diff --git a/README.md b/README.md index 93c5d895..9869499a 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,10 @@ For demos please see [demos page](http://ng2-uploader.com). npm install ng2-uploader --save ``` +### API Docs + +[http://docs.ng2-uploader.com](http://docs.ng2-uploader.com) + ### Available parameters |Parameter | Example Value @@ -54,6 +58,7 @@ import { Ng2UploaderModule } from 'ng2-uploader'; }) // app.component.ts import { Component } from '@angular/core'; +import { Ng2UploaderOptions } from 'ng2-uploader'; @Component({ selector: 'demo-app', @@ -62,7 +67,7 @@ import { Component } from '@angular/core'; export class DemoApp { uploadFile: any; hasBaseDropZoneOver: boolean = false; - options: Object = { + options: Ng2UploaderOptions = { url: 'http://localhost:10050/upload' }; sizeLimit = 2000000; @@ -118,6 +123,7 @@ This example show how to use available options and progress. ```ts import { Component, OnInit, NgZone } from '@angular/core'; +import { Ng2UploaderOptions } from 'ng2-uploader'; @Component({ selector: 'app-component', @@ -125,7 +131,7 @@ import { Component, OnInit, NgZone } from '@angular/core'; }) export class AppDemoComponent implements OnInit { private zone: NgZone; - private options: Object; + private options: Ng2UploaderOptions; private progress: number = 0; private response: any = {}; diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 00000000..1b8dd1c8 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,25 @@ +const gulp = require('gulp'); +const typedoc = require('gulp-typedoc'); + +gulp.task('docs', () => { + return gulp.src([ + 'index.ts', + '!node_modules/**/*']) + .pipe(typedoc({ + name: 'ng2-uploader docs', + mode: 'file', + out: 'docs', + ignoreCompilerErrors: true, + experimentalDecorators: true, + emitDecoratorMetadata: true, + target: 'ES5', + moduleResolution: 'node', + preserveConstEnums: true, + stripInternal: true, + suppressExcessPropertyErrors: true, + suppressImplicitAnyIndexErrors: true, + module: 'commonjs', + ignoreCompilerErrors: true, + noLib: true + })); +}); diff --git a/package.json b/package.json index 127edfa0..1ff5afcb 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,8 @@ "clean": "./scripts/clean.sh", "dev": "tsc --watch", "build": "./node_modules/.bin/ngc -p tsconfig.json", - "prepublish": "npm run build" + "prepublish": "npm run build", + "docs": "gulp docs" }, "repository": { "type": "git", @@ -34,8 +35,11 @@ "@angular/platform-server": "^2.4.1", "@types/core-js": "^0.9.35", "@types/node": "^6.0.52", + "gulp": "^3.9.1", + "gulp-typedoc": "^2.0.1", "reflect-metadata": "^0.1.9", "rxjs": "5.0.1", + "typedoc": "^0.5.1", "typescript": "2.0.10", "zone.js": "^0.7.4" }