From a2f774a0be16d63210929862078c3f4c276ff06b Mon Sep 17 00:00:00 2001 From: buchslava Date: Thu, 15 Oct 2015 19:25:47 +0300 Subject: [PATCH] Updated: angular2 0.42.0 integration --- components/file-upload/file-item.ts | 1 - components/file-upload/file-select.ts | 2 - components/module.ts | 5 -- demo/components/file-upload/simple-demo.ts | 5 +- es6-object.d.ts | 26 +++++++++ gulpfile.js | 29 ---------- package.json | 61 ++++++++++------------ tsconfig.json | 13 ++--- tsd.d.ts | 3 +- 9 files changed, 61 insertions(+), 84 deletions(-) delete mode 100644 components/module.ts create mode 100644 es6-object.d.ts diff --git a/components/file-upload/file-item.ts b/components/file-upload/file-item.ts index 4ac9b93..04a67e2 100644 --- a/components/file-upload/file-item.ts +++ b/components/file-upload/file-item.ts @@ -1,6 +1,5 @@ import {FileLikeObject} from './file-like-object'; import {FileUploader} from './file-uploader'; -import Form = ng.Form; export class FileItem { public file:FileLikeObject; diff --git a/components/file-upload/file-select.ts b/components/file-upload/file-select.ts index cba1b65..ab368a6 100644 --- a/components/file-upload/file-select.ts +++ b/components/file-upload/file-select.ts @@ -1,5 +1,3 @@ -/// - import { Component, View, OnInit, OnDestroy, OnChanges, Directive, EventEmitter, ElementRef, Renderer, diff --git a/components/module.ts b/components/module.ts deleted file mode 100644 index 23fd0d6..0000000 --- a/components/module.ts +++ /dev/null @@ -1,5 +0,0 @@ -/// - -declare module 'ng2-file-upload' { - export = require('index'); -} diff --git a/demo/components/file-upload/simple-demo.ts b/demo/components/file-upload/simple-demo.ts index 1e9a58c..efaa3be 100644 --- a/demo/components/file-upload/simple-demo.ts +++ b/demo/components/file-upload/simple-demo.ts @@ -11,6 +11,9 @@ import {FileUploader} from '../../../components/file-upload/file-uploader'; // webpack html imports let template = require('./simple-demo.html'); +// const URL = '/api/'; +const URL = 'https://evening-anchorage-3159.herokuapp.com/api/'; + @Component({ selector: 'simple-demo' }) @@ -19,7 +22,7 @@ let template = require('./simple-demo.html'); directives: [FileSelect, FileDrop, NgClass, NgStyle, CORE_DIRECTIVES, FORM_DIRECTIVES] }) export class SimpleDemo { - private uploader:FileUploader = new FileUploader({url: '/api/'}); + private uploader:FileUploader = new FileUploader({url: URL}); private hasBaseDropZoneOver:boolean = false; private hasAnotherDropZoneOver:boolean = false; diff --git a/es6-object.d.ts b/es6-object.d.ts new file mode 100644 index 0000000..bede479 --- /dev/null +++ b/es6-object.d.ts @@ -0,0 +1,26 @@ +interface ObjectConstructor { + /** + * Copy the values of all of the enumerable own properties from one or more source objects to a + * target object. Returns the target object. + * @param target The target object to copy to. + * @param sources One or more source objects to copy properties from. + */ + assign(target: any, ...sources: any[]): any; + + /** + * Returns true if the values are the same value, false otherwise. + * @param value1 The first value. + * @param value2 The second value. + */ + is(value1: any, value2: any): boolean; + + /** + * Sets the prototype of a specified object o to object proto or null. Returns the object o. + * @param o The object to change its prototype. + * @param proto The value of the new prototype or null. + * @remarks Requires `__proto__` support. + */ + setPrototypeOf(o: any, proto: any): any; +} + +declare function require(path:string): any; diff --git a/gulpfile.js b/gulpfile.js index 6078516..4684cee 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -17,41 +17,12 @@ gulp.paths = { require('require-dir')('./gulp-tasks'); -var typescript = require('gulp-tsc'); -var options = require('./tsconfig.json').compilerOptions; -options.emitError = false; - -var o = { - target: 'es5', - module: 'commonjs', - outDir: 'dist', - sourceRoot: 'dist', - mapRoot: 'dist', - keepTree: true, - declaration: true, - noEmitOnError: true, - emitError: false, - sourceMap: true, - removeComments: true, - noResolve: false, - suppressImplicitAnyIndexErrors: true, - safe: false, - emitDecoratorMetadata: true, - experimentalDecorators: true -}; - var clean = require('gulp-clean'); gulp.task('clean', function () { return gulp.src('dist', {read: false}) .pipe(clean()); }); -gulp.task('compile', ['clean'], function () { - gulp.src(['components/**/*.ts']) - .pipe(typescript(o)) - .pipe(gulp.dest(options.outDir)); -}); - gulp.task('default', function () { gulp.start('lint'); }); diff --git a/package.json b/package.json index 5790aca..59c6402 100644 --- a/package.json +++ b/package.json @@ -1,27 +1,20 @@ { "name": "ng2-file-upload", - "version": "0.40.0", + "version": "0.42.0", "description": "angular2 file upload directives", "scripts": { "deploy": "NODE_ENV=production webpack -p --progress --color --optimize-minimize --optimize-dedupe --optimize-occurence-order", - "prepublish": "gulp compile", + "prepublish": "gulp clean && tsc", "prestart": "npm install", "server": "webpack-dev-server --hot --inline --colors --display-error-details --display-cached", "start": "npm run server", "test": "gulp lint" }, "main": "dist/index.js", - "typescript": { - "definition": [ - "dist/module.d.ts", - "typings/es6-object.d.ts" - ] - }, + "typings": "dist/index.d.ts", "files": [ "dist", - "components", - "typings", - "tsd.d.ts" + "components" ], "keywords": [ "angular2", @@ -40,36 +33,36 @@ }, "homepage": "https://github.com/valor-software/ng2-file-upload#readme", "dependencies": { - "angular2": "^2.0.0-alpha.40", + "angular2": "^2.0.0-alpha.42", "ng2-bootstrap": "^0.40.0", "reflect-metadata": "0.1.2", "ts-loader": "0.5.6", "zone.js": "0.5.8" }, "devDependencies": { - "bootstrap": "^3.3.5", - "clean-webpack-plugin": "^0.1.3", - "compression-webpack-plugin": "^0.2.0", - "eslint": "^1.1.0", - "exports-loader": "^0.6.2", - "file-loader": "^0.8.4", - "gulp": "^3.9.0", - "gulp-clean": "^0.3.1", - "gulp-eslint": "^1.0.0", - "gulp-size": "^2.0.0", - "gulp-tsc": "^1.1.1", - "gulp-tslint": "^3.1.2", - "html-loader": "^0.3.0", - "markdown-loader": "^0.1.7", - "marked": "^0.3.5", - "moment": "^2.10.6", - "pre-commit": "^1.1.1", + "bootstrap": "3.3.5", + "clean-webpack-plugin": "0.1.3", + "compression-webpack-plugin": "0.2.0", + "eslint": "1.6.0", + "exports-loader": "0.6.2", + "file-loader": "0.8.4", + "gulp": "3.9.0", + "gulp-clean": "0.3.1", + "gulp-eslint": "1.0.0", + "gulp-size": "2.0.0", + "gulp-tsc": "1.1.1", + "gulp-tslint": "3.3.1", + "html-loader": "0.3.0", + "markdown-loader": "0.1.7", + "marked": "0.3.5", + "moment": "2.10.6", + "pre-commit": "1.1.1", "prismjs": "valorkin/prism", "prismjs-loader": "0.0.2", - "raw-loader": "^0.5.1", - "require-dir": "^0.3.0", - "typescript": "^1.6.2", - "webpack": "^1.12.2", - "webpack-dev-server": "^1.12.0" + "raw-loader": "0.5.1", + "require-dir": "0.3.0", + "typescript": "1.6.2", + "webpack": "1.12.2", + "webpack-dev-server": "1.12.0" } } diff --git a/tsconfig.json b/tsconfig.json index 867d345..a8576ed 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,17 +14,10 @@ "noEmitOnError": false, "noImplicitAny": false }, - "filesGlob": [ - "!./node_modules/**/*.ts" + "exclude": [ + "node_modules" ], "files": [ - "./tsd.d.ts", - "./components/file-upload/file-select.ts", - "./components/file-upload/file-item.ts", - "./components/file-upload/file-like-object.ts", - "./components/file-upload/file-drop.ts", - "./components/file-upload/file-uploader.ts", - "./components/index.ts", - "./components/module.ts" + "./components/index.ts" ] } diff --git a/tsd.d.ts b/tsd.d.ts index 8754f73..8c3121c 100644 --- a/tsd.d.ts +++ b/tsd.d.ts @@ -1,2 +1 @@ -/// -/// +///