diff --git a/README.md b/README.md index 871d0c6..3b62d03 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -# ng2-redux-router 1.3.3 +# ng2-redux-router 2.0.0 ### Bindings to connect @angular/router to ng2-redux Updated for Angular 2 final release. -This package uses the new v3 router for angular 2 `@angular/router@^3.0.0`. +This package uses the new v3 router for angular 2 `@angular/router@^3.1.2`. ### Setup @@ -26,54 +26,30 @@ This package uses the new v3 router for angular 2 `@angular/router@^3.0.0`. 3. Add the bindings to your root module. ```ts import { NgModule } from '@angular/core'; - import { AppComponent } from './app.component'; - import { NgRedux } from 'ng2-redux'; - import { NgReduxRouter } from 'ng2-redux-router'; + import { NgReduxModule, NgRedux } from 'ng2-redux'; + import { NgReduxRouterModule, NgReduxRouter } from 'ng2-redux-router'; import { RouterModule } from '@angular/router'; import { routes } from './routes'; @NgModule({ imports: [ RouterModule.forRoot(routes), + NgReduxModule.forRoot(), + NgReduxRouterModule // ...your imports ], - declarations: [ - AppComponent, - // ...your declarations - ], - providers: [ - NgRedux, - NgReduxRouter, - // ...your providers - ], - bootstrap: [ - AppComponent - ] + // Other stuff.. }) - export class AppModule {} -``` - -4. Initialize the bindings from your app component - ```ts - import { NgRedux } from 'ng2-redux'; - import { NgReduxRouter } from 'ng2-redux-router'; - - @Component({ - // ... - }) - @Routes([ - // ... - ]) - export class App { + export class AppModule { constructor( - private ngRedux: NgRedux, - private ngReduxRouter: NgReduxRouter + ngRedux: NgRedux, + ngReduxRouter: NgReduxRouter ) { ngRedux.configureStore(/* args */); ngReduxRouter.initialize(/* args */); } } - ``` +``` ### What if I use Immutable.js with my Redux store? diff --git a/examples/counter/containers/app.component.ts b/examples/counter/containers/app.component.ts index 3e7496d..e78fbb7 100644 --- a/examples/counter/containers/app.component.ts +++ b/examples/counter/containers/app.component.ts @@ -1,13 +1,5 @@ import { Component } from '@angular/core'; import { AsyncPipe } from '@angular/common'; -import { NgRedux, select } from 'ng2-redux'; - -import { RootState, enhancers } from '../store'; - -import { NgReduxRouter } from 'ng2-redux-router'; - -import reducer from '../reducers/index'; -const createLogger = require('redux-logger'); @Component({ selector: 'root', @@ -22,18 +14,6 @@ const createLogger = require('redux-logger'); ` }) export class AppComponent { - constructor( - private ngRedux: NgRedux, - private ngReduxRouter: NgReduxRouter - ) { - this.ngRedux.configureStore( - reducer, - { counter: 0 }, - [ createLogger() ], - enhancers - ); - ngReduxRouter.initialize(); - } } @Component({ diff --git a/examples/counter/containers/app.module.ts b/examples/counter/containers/app.module.ts index 90b438d..67f2f9d 100644 --- a/examples/counter/containers/app.module.ts +++ b/examples/counter/containers/app.module.ts @@ -1,18 +1,24 @@ import { NgModule } from '@angular/core'; import { BrowserModule } from '@angular/platform-browser'; import { routing, AuthGuard } from '../routes'; -import { NgReduxModule } from 'ng2-redux'; -import { NgReduxRouter } from 'ng2-redux-router'; +import { NgReduxModule, NgRedux } from 'ng2-redux'; +import { NgReduxRouterModule, NgReduxRouter } from 'ng2-redux-router'; import { Counter } from '../components/Counter'; import { CounterInfo } from '../components/CounterInfo'; import { AppComponent, FirstComponent, SecondComponent, ThirdComponent } from './app.component'; +import { RootState, enhancers } from '../store'; + +import reducer from '../reducers/index'; +const createLogger = require('redux-logger'); + @NgModule({ imports: [ BrowserModule, routing, - NgReduxModule + NgReduxModule.forRoot(), + NgReduxRouterModule ], declarations: [ AppComponent, @@ -23,7 +29,6 @@ import { AppComponent, FirstComponent, SecondComponent, ThirdComponent } from '. CounterInfo ], providers: [ - NgReduxRouter, AuthGuard ], bootstrap: [ @@ -31,4 +36,16 @@ import { AppComponent, FirstComponent, SecondComponent, ThirdComponent } from '. ] }) export class AppModule { + constructor( + ngRedux: NgRedux, + ngReduxRouter: NgReduxRouter + ) { + ngRedux.configureStore( + reducer, + { counter: 0 }, + [ createLogger() ], + enhancers + ); + ngReduxRouter.initialize(); + } } diff --git a/examples/counter/package.json b/examples/counter/package.json index 96b1ab5..0c31f95 100644 --- a/examples/counter/package.json +++ b/examples/counter/package.json @@ -24,30 +24,30 @@ }, "homepage": "https://github.com/wbuchwalter/ng2-redux#readme", "dependencies": { - "@angular/common": "^2.0.0", - "@angular/compiler": "^2.0.0", - "@angular/core": "^2.0.0", - "@angular/http": "^2.0.0", - "@angular/platform-browser": "^2.0.0", - "@angular/platform-browser-dynamic": "^2.0.0", - "@angular/compiler-cli": "^0.6.2", - "@angular/platform-server": "^2.0.0", - "@angular/router": "^3.0.0", + "@angular/common": "^2.1.2", + "@angular/compiler": "^2.1.2", + "@angular/core": "^2.1.2", + "@angular/http": "^2.1.2", + "@angular/platform-browser": "^2.1.2", + "@angular/platform-browser-dynamic": "^2.1.2", + "@angular/compiler-cli": "^2.1.2", + "@angular/platform-server": "^2.1.2", + "@angular/router": "^3.1.2", "core-js": "^2.4.0", - "ng2-redux": "^4.0.0-beta.1", - "ng2-redux-router": "^1.3.3", + "ng2-redux": "^4.1.0", + "ng2-redux-router": "^2.0.0", "redux": "^3.6.0", "redux-localstorage": "^0.4.0", - "redux-logger": "^2.6.1", + "redux-logger": "^2.7.4", "rxjs": "5.0.0-beta.12", - "zone.js": "^0.6.23" + "zone.js": "^0.6.26" }, "devDependencies": { - "@types/core-js": "^0.9.32", - "@types/node": "^6.0.38", + "@types/core-js": "^0.9.34", + "@types/node": "^6.0.46", "awesome-typescript-loader": "^2.2.4", - "typescript": "^2.0.2", - "webpack": "^1.9.11", - "webpack-dev-server": "^1.15.2" + "typescript": "^2.0.8", + "webpack": "^1.13.3", + "webpack-dev-server": "^1.16.2" } } diff --git a/package.json b/package.json index d4919cd..ff3062d 100644 --- a/package.json +++ b/package.json @@ -10,32 +10,33 @@ "url": "git+https://github.com/dagstuan/ng2-redux-router.git" }, "scripts": { - "build": "rimraf ./lib && npm run build:es6 && npm run build:es5 && npm run build:esm", - "build:es6": "ngc --p tsconfig.es6.json --diagnostics --pretty", - "build:esm": "ngc --p tsconfig.esm.json --diagnostics --pretty", - "build:es5": "ngc --p tsconfig.json --diagnostics --pretty" + "build": "rimraf ./lib && npm run build:es5 && npm run build:esm && npm run build:es6", + "postbuild": "rimraf \"src/**/*.ngfactory.ts\"", + "build:es6": "ngc -p tsconfig.es6.json && npm run postbuild", + "build:esm": "ngc -p tsconfig.esm.json && npm run postbuild", + "build:es5": "ngc -p tsconfig.json && npm run postbuild" }, "peerDependencies": { - "@angular/core": "^2.0.0", + "@angular/core": "^2.1.2", "@angular/router": "^3.0.0" }, "devDependencies": { - "@angular/common": "^2.0.0", - "@angular/compiler": "^2.0.0", - "@angular/compiler-cli": "^0.6.2", - "@angular/core": "^2.0.0", - "@angular/platform-browser": "^2.0.0", - "@angular/platform-browser-dynamic": "^2.0.0", - "@angular/platform-server": "^2.0.0", - "@angular/router": "^3.0.0", - "@types/core-js": "^0.9.32", - "@types/jasmine": "^2.2.33", - "ng2-redux": "^4.0.0-beta.1", + "@angular/common": "^2.1.2", + "@angular/compiler": "^2.1.2", + "@angular/compiler-cli": "^2.1.2", + "@angular/core": "^2.1.2", + "@angular/platform-browser": "^2.1.2", + "@angular/platform-browser-dynamic": "^2.1.2", + "@angular/platform-server": "^2.1.2", + "@angular/router": "^3.1.2", + "@types/core-js": "^0.9.34", + "@types/jasmine": "^2.5.37", + "ng2-redux": "^4.1.0", "redux": "^3.6.0", "rimraf": "^2.5.4", "rxjs": "5.0.0-beta.12", - "typescript": "^2.0.2", - "zone.js": "^0.6.23" + "typescript": "^2.0.8", + "zone.js": "^0.6.26" }, "author": "Dag Stuan", "license": "MIT" diff --git a/src/index.ts b/src/index.ts index 0f87bd1..1876c37 100644 --- a/src/index.ts +++ b/src/index.ts @@ -6,10 +6,9 @@ import { UPDATE_LOCATION } from './actions'; @NgModule({ providers: [ NgReduxRouter ] }) -class NgReduxRouterModule { } +export class NgReduxRouterModule { } export { - NgReduxRouterModule, NgReduxRouter, RouterAction, routerReducer, diff --git a/tsconfig.es6.json b/tsconfig.es6.json index 7baf2d4..1eec522 100644 --- a/tsconfig.es6.json +++ b/tsconfig.es6.json @@ -14,6 +14,7 @@ "types": [] }, "exclude": [ + "lib", "node_modules", "spec", "release", diff --git a/tsconfig.esm.json b/tsconfig.esm.json index 48a217f..a3e381a 100644 --- a/tsconfig.esm.json +++ b/tsconfig.esm.json @@ -11,9 +11,12 @@ "experimentalDecorators": true, "removeComments": false, "declaration": true, - "types": ["core-js"] + "types": [ + "core-js" + ] }, "exclude": [ + "lib", "node_modules", "spec", "release", diff --git a/tsconfig.json b/tsconfig.json index 00dcc3d..12bf3b6 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -16,6 +16,7 @@ ] }, "exclude": [ + "lib", "node_modules", "spec", "release",