From 9bbda321e220fcfd23594a3069280c9ccd8c7390 Mon Sep 17 00:00:00 2001 From: Jan Kuri Date: Thu, 16 Feb 2017 21:46:52 +0100 Subject: [PATCH] build(umd): export umd bundle --- index.metadata.json | 1 - index.ts | 24 ------------------ ng2-datepicker.metadata.json | 2 +- ng2-datepicker.ts | 25 ++++++++++++++++++- package.json | 9 +++++-- scripts/clean.sh | 2 +- src/app/app.module.ts | 2 +- .../ng2-datepicker.component.ts | 4 +-- tsconfig.build.json | 1 - 9 files changed, 36 insertions(+), 34 deletions(-) delete mode 100644 index.metadata.json delete mode 100644 index.ts diff --git a/index.metadata.json b/index.metadata.json deleted file mode 100644 index 860e7b7eb..000000000 --- a/index.metadata.json +++ /dev/null @@ -1 +0,0 @@ -[{"__symbolic":"module","version":3,"metadata":{"DatePickerModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./src/ng2-datepicker/ng2-datepicker.component","name":"DatePickerComponent"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule"},{"__symbolic":"reference","module":"ng2-slimscroll","name":"SlimScrollModule"}],"exports":[{"__symbolic":"reference","module":"./src/ng2-datepicker/ng2-datepicker.component","name":"DatePickerComponent"},{"__symbolic":"reference","module":"ng2-slimscroll","name":"SlimScrollModule"},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule"}]}]}]}},"exports":[{"from":"./src/ng2-datepicker/ng2-datepicker.component","export":["DatePickerOptions","DateModel"]}]},{"__symbolic":"module","version":1,"metadata":{"DatePickerModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./src/ng2-datepicker/ng2-datepicker.component","name":"DatePickerComponent"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule"},{"__symbolic":"reference","module":"ng2-slimscroll","name":"SlimScrollModule"}],"exports":[{"__symbolic":"reference","module":"./src/ng2-datepicker/ng2-datepicker.component","name":"DatePickerComponent"},{"__symbolic":"reference","module":"ng2-slimscroll","name":"SlimScrollModule"},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule"}]}]}]}},"exports":[{"from":"./src/ng2-datepicker/ng2-datepicker.component","export":["DatePickerOptions","DateModel"]}]}] \ No newline at end of file diff --git a/index.ts b/index.ts deleted file mode 100644 index 57f82dabf..000000000 --- a/index.ts +++ /dev/null @@ -1,24 +0,0 @@ -import { NgModule } from '@angular/core'; -import { CommonModule } from '@angular/common'; -import { FormsModule } from '@angular/forms'; -import { SlimScrollModule } from 'ng2-slimscroll'; -import { DatePickerComponent } from './src/ng2-datepicker/ng2-datepicker.component'; - -export { DatePickerOptions, DateModel } from './src/ng2-datepicker/ng2-datepicker.component'; - -@NgModule({ - declarations: [ - DatePickerComponent - ], - imports: [ - CommonModule, - FormsModule, - SlimScrollModule - ], - exports: [ - DatePickerComponent, - SlimScrollModule, - FormsModule - ] -}) -export class DatePickerModule { } diff --git a/ng2-datepicker.metadata.json b/ng2-datepicker.metadata.json index f9106f31a..860e7b7eb 100644 --- a/ng2-datepicker.metadata.json +++ b/ng2-datepicker.metadata.json @@ -1 +1 @@ -[{"__symbolic":"module","version":3,"metadata":{},"exports":[{"from":"./index"}]},{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./index"}]}] \ No newline at end of file +[{"__symbolic":"module","version":3,"metadata":{"DatePickerModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./src/ng2-datepicker/ng2-datepicker.component","name":"DatePickerComponent"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule"},{"__symbolic":"reference","module":"ng2-slimscroll","name":"SlimScrollModule"}],"exports":[{"__symbolic":"reference","module":"./src/ng2-datepicker/ng2-datepicker.component","name":"DatePickerComponent"},{"__symbolic":"reference","module":"ng2-slimscroll","name":"SlimScrollModule"},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule"}]}]}]}},"exports":[{"from":"./src/ng2-datepicker/ng2-datepicker.component","export":["DatePickerOptions","DateModel"]}]},{"__symbolic":"module","version":1,"metadata":{"DatePickerModule":{"__symbolic":"class","decorators":[{"__symbolic":"call","expression":{"__symbolic":"reference","module":"@angular/core","name":"NgModule"},"arguments":[{"declarations":[{"__symbolic":"reference","module":"./src/ng2-datepicker/ng2-datepicker.component","name":"DatePickerComponent"}],"imports":[{"__symbolic":"reference","module":"@angular/common","name":"CommonModule"},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule"},{"__symbolic":"reference","module":"ng2-slimscroll","name":"SlimScrollModule"}],"exports":[{"__symbolic":"reference","module":"./src/ng2-datepicker/ng2-datepicker.component","name":"DatePickerComponent"},{"__symbolic":"reference","module":"ng2-slimscroll","name":"SlimScrollModule"},{"__symbolic":"reference","module":"@angular/forms","name":"FormsModule"}]}]}]}},"exports":[{"from":"./src/ng2-datepicker/ng2-datepicker.component","export":["DatePickerOptions","DateModel"]}]}] \ No newline at end of file diff --git a/ng2-datepicker.ts b/ng2-datepicker.ts index ea465c2a3..57f82dabf 100644 --- a/ng2-datepicker.ts +++ b/ng2-datepicker.ts @@ -1 +1,24 @@ -export * from './index'; +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { FormsModule } from '@angular/forms'; +import { SlimScrollModule } from 'ng2-slimscroll'; +import { DatePickerComponent } from './src/ng2-datepicker/ng2-datepicker.component'; + +export { DatePickerOptions, DateModel } from './src/ng2-datepicker/ng2-datepicker.component'; + +@NgModule({ + declarations: [ + DatePickerComponent + ], + imports: [ + CommonModule, + FormsModule, + SlimScrollModule + ], + exports: [ + DatePickerComponent, + SlimScrollModule, + FormsModule + ] +}) +export class DatePickerModule { } diff --git a/package.json b/package.json index ff2d06f19..723bbe0de 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,10 @@ { "name": "ng2-datepicker", - "version": "1.6.1", + "version": "1.7.0", "description": "ng2-datepicker", + "main": "bundle/ng2-datepicker.umd.js", + "module": "ng2-datepicker.js", + "typings": "ng2-datepicker.d.ts", "scripts": { "serve": "node ./scripts/index.js --serve", "start": "npm run serve", @@ -13,7 +16,7 @@ "lint": "npm run tslint \"src/**/*.ts\"", "tslint": "tslint", "sass": "node-sass src/ng2-datepicker/ng2-datepicker.sass src/ng2-datepicker/ng2-datepicker.css", - "build": "npm run css && ./node_modules/.bin/ngc -p tsconfig.build.json", + "build": "npm run css && ./node_modules/.bin/ngc -p tsconfig.build.json && rollup -c", "prepublish": "npm run build", "css": "node-sass src/styles/ng2-datepicker.sass --output src/ng2-datepicker/ --output-style expanded" }, @@ -71,6 +74,8 @@ "glob": "^7.1.1", "jasmine": "^2.5.3", "jasmine-spec-reporter": "^3.2.0", + "jsdom": "^9.11.0", + "jsdom-global": "^2.1.1", "karma": "^1.4.1", "karma-chrome-launcher": "^2.0.0", "karma-jasmine": "^1.1.0", diff --git a/scripts/clean.sh b/scripts/clean.sh index 66072dc50..97bde0134 100755 --- a/scripts/clean.sh +++ b/scripts/clean.sh @@ -1,6 +1,6 @@ #!/bin/bash -find . -name "*.js" -type f -not -path "./node_modules/*" -not -path "./scripts/*" -delete +find . -name "*.js" -type f -not -path "./node_modules/*" -not -path "./scripts/*" -not -path "./rollup.config.js" -delete find . -name "*.js.map" -type f -not -path "./node_modules/*" -delete find . -name "*.d.ts" -type f -not -path "./node_modules/*" -delete find . -name "*.metadata.json" -type f -not -path "./node_modules/*" -delete diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 56b34b852..d447bdcc7 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -2,7 +2,7 @@ import { BrowserModule } from '@angular/platform-browser'; import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; import { AppComponent } from './app.component'; -import { DatePickerModule } from '../../'; +import { DatePickerModule } from '../../ng2-datepicker'; @NgModule({ declarations: [ diff --git a/src/ng2-datepicker/ng2-datepicker.component.ts b/src/ng2-datepicker/ng2-datepicker.component.ts index 71cbf4a2f..3f3cd2950 100644 --- a/src/ng2-datepicker/ng2-datepicker.component.ts +++ b/src/ng2-datepicker/ng2-datepicker.component.ts @@ -81,8 +81,8 @@ export const CALENDAR_VALUE_ACCESSOR: any = { @Component({ selector: 'ng2-datepicker', - templateUrl: 'ng2-datepicker.component.html', - styleUrls: ['ng2-datepicker.css'], + templateUrl: './ng2-datepicker.component.html', + styleUrls: ['./ng2-datepicker.css'], providers: [CALENDAR_VALUE_ACCESSOR] }) export class DatePickerComponent implements ControlValueAccessor, OnInit { diff --git a/tsconfig.build.json b/tsconfig.build.json index ae20c76a9..09d6c08ab 100644 --- a/tsconfig.build.json +++ b/tsconfig.build.json @@ -25,7 +25,6 @@ "dist" ], "files": [ - "index.ts", "ng2-datepicker.ts" ], "angularCompilerOptions": {