Skip to content

Commit 9ad4482

Browse files
Evan Schultzsmithad15
authored andcommitted
v7 release - Angular v5 Support (#24)
* v7 release - Angular v5 Support * Update to Angular 5 compiler * Update RxJS, change to use let-able operators * Requires @angular-redux/store 7+ **Breaking Change** * NgReduxRouterModule now needs to be imported with `.forRoot` **before** ```ts @NgModule({ declarations: [AppComponent], imports: [ RouterModule.forRoot(appRoutes), /* .... */ NgReduxRouterModule ], bootstrap: [AppComponent] }) export class AppModule {} ``` **after** ```ts @NgModule({ declarations: [AppComponent], imports: [ RouterModule.forRoot(appRoutes), /* .... */ NgReduxRouterModule.forRoot() ], bootstrap: [AppComponent] }) export class AppModule {} ````
1 parent e21fe30 commit 9ad4482

File tree

8 files changed

+999
-145
lines changed

8 files changed

+999
-145
lines changed

packages/router/CHANGELOG.md

Lines changed: 50 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
# 7.0.0 - Angular 5+ only support
2+
3+
* Update to Angular 5 compiler
4+
* Update RxJS, change to use let-able operators
5+
* Requires @angular-redux/store 7+
6+
7+
** Breaking Change **
8+
9+
* NgReduxRouterModule now needs to be imported with `.forRoot`
10+
11+
**before**
12+
13+
```ts
14+
@NgModule({
15+
declarations: [AppComponent],
16+
imports: [
17+
RouterModule.forRoot(appRoutes),
18+
/* .... */
19+
NgReduxRouterModule
20+
],
21+
bootstrap: [AppComponent]
22+
})
23+
export class AppModule {}
24+
```
25+
26+
**after**
27+
28+
```ts
29+
@NgModule({
30+
declarations: [AppComponent],
31+
imports: [
32+
RouterModule.forRoot(appRoutes),
33+
/* .... */
34+
NgReduxRouterModule.forRoot()
35+
],
36+
bootstrap: [AppComponent]
37+
})
38+
export class AppModule {}
39+
```
40+
141
# 6.4.0 - Angular 5 Support
242

343
Added support for Angular 5.
@@ -28,22 +68,23 @@ support will be removed in the next major version.
2868

2969
# 6.0.0 - The big-rename.
3070

31-
Due to the impending release of Angular4, the name 'ng2-redux' no longer makes
32-
a ton of sense. The Angular folks have moved to a model where all versions are
71+
Due to the impending release of Angular4, the name 'ng2-redux' no longer makes a
72+
ton of sense. The Angular folks have moved to a model where all versions are
3373
just called 'Angular', and we should match that.
3474

3575
After discussion with the other maintainers, we decided that since we have to
3676
rename things anyway, this is a good opportunity to collect ng2-redux and its
37-
related libraries into a set of scoped packages. This will allow us to grow
38-
the feature set in a coherent but decoupled way.
77+
related libraries into a set of scoped packages. This will allow us to grow the
78+
feature set in a coherent but decoupled way.
3979

4080
As of v6, the following packages are deprecated:
4181

4282
* ng2-redux
4383
* ng2-redux-router
4484
* ng2-redux-form
4585

46-
Those packages will still be available on npm for as long as they are being used.
86+
Those packages will still be available on npm for as long as they are being
87+
used.
4788

4889
However we have published the same code under a new package naming scheme:
4990

@@ -52,13 +93,14 @@ However we have published the same code under a new package naming scheme:
5293
* @angular-redux/form (formerly ng2-redux-form).
5394

5495
We have also decided that it's easier to reason about things if these packages
55-
align at least on major versions. So everything has at this point been bumped
56-
to 6.0.0.
96+
align at least on major versions. So everything has at this point been bumped to
97+
6.0.0.
5798

5899
# Breaking changes
59100

60101
Apart from the rename, the following API changes are noted:
61102

62103
* @angular-redux/store: none.
63104
* @angular-redux/router: none.
64-
* @angular-redux/form: `NgReduxForms` renamed to `NgReduxFormModule` for consistency.
105+
* @angular-redux/form: `NgReduxForms` renamed to `NgReduxFormModule` for
106+
consistency.

packages/router/package.json

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"name": "@angular-redux/router",
3-
"version": "6.4.1",
3+
"version": "7.0.0-2",
44
"description": "Keep your Angular 2+ router state in Redux.",
5-
"main": "./lib/es5/index.js",
6-
"module": "./lib/esm/index.js",
7-
"typings": "./lib/es5/index.d.ts",
5+
"main": "./lib/es5/src/index.js",
6+
"module": "./lib/esm/src/index.js",
7+
"typings": "./lib/es5/src/index.d.ts",
88
"repository": {
99
"type": "git",
1010
"url": "git+https://github.com/angular-redux/router.git"
@@ -18,25 +18,25 @@
1818
"build:es5": "ngc -p tsconfig.json && npm run postbuild"
1919
},
2020
"peerDependencies": {
21-
"@angular/core": "^2.1.2 || ^4.0.0 || ^5.0.0",
22-
"@angular/router": "^3.0.0 || ^4.0.0 || ^5.0.0"
21+
"@angular/core": "^5.0.0",
22+
"@angular/router": "^5.0.0"
2323
},
2424
"devDependencies": {
25-
"@angular-redux/store": "^6.3.0",
26-
"@angular/common": "^4.0.0",
27-
"@angular/compiler": "^4.0.0",
28-
"@angular/compiler-cli": "^4.0.0",
29-
"@angular/core": "^4.0.0",
30-
"@angular/platform-browser": "^4.0.0",
31-
"@angular/platform-browser-dynamic": "^4.0.0",
32-
"@angular/router": "^4.0.0",
25+
"@angular-redux/store": "^7.0.0",
26+
"@angular/common": "^5.0.0",
27+
"@angular/compiler": "^5.0.0",
28+
"@angular/compiler-cli": "^5.0.0",
29+
"@angular/core": "^5.0.0",
30+
"@angular/platform-browser": "^5.0.0",
31+
"@angular/platform-browser-dynamic": "^5.0.0",
32+
"@angular/router": "^5.0.0",
3333
"@types/core-js": "^0.9.39",
3434
"@types/jasmine": "^2.5.37",
3535
"redux": "^3.6.0",
3636
"rimraf": "^2.5.4",
37-
"rxjs": "^5.0.1",
38-
"typescript": "^2.4.1",
39-
"zone.js": "^0.8.4"
37+
"rxjs": "^5.5.2",
38+
"typescript": "2.4.2",
39+
"zone.js": "^0.8.18"
4040
},
4141
"author": "Dag Stuan",
4242
"license": "MIT"

packages/router/src/index.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
1+
import { ModuleWithProviders } from '@angular/core';
12
import { NgModule } from '@angular/core';
23
import { NgReduxRouter } from './router';
34
import { RouterAction, routerReducer } from './reducer';
45
import { UPDATE_LOCATION } from './actions';
56

6-
@NgModule({
7-
providers: [ NgReduxRouter ]
8-
})
9-
export class NgReduxRouterModule { }
7+
@NgModule()
8+
export class NgReduxRouterModule {
9+
static forRoot(): ModuleWithProviders {
10+
return {
11+
ngModule: NgReduxRouterModule,
12+
providers: [NgReduxRouter]
13+
};
14+
}
15+
}
1016

11-
export {
12-
NgReduxRouter,
13-
RouterAction,
14-
routerReducer,
15-
UPDATE_LOCATION
16-
};
17+
export { NgReduxRouter, RouterAction, routerReducer, UPDATE_LOCATION };

packages/router/src/router.ts

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
import 'rxjs/add/operator/filter';
2-
import 'rxjs/add/operator/map';
3-
import 'rxjs/add/operator/distinctUntilChanged';
1+
import { map } from 'rxjs/operators/map';
2+
import { filter } from 'rxjs/operators/filter';
3+
import { distinctUntilChanged } from 'rxjs/operators/distinctUntilChanged';
44
import { Injectable, ApplicationRef } from '@angular/core';
55
import { Location } from '@angular/common';
66
import {
@@ -87,10 +87,11 @@ export class NgReduxRouter {
8787
}
8888

8989
private getDefaultUrlStateObservable() {
90-
return this.router.events
91-
.filter(event => event instanceof NavigationEnd)
92-
.map(event => this.location.path())
93-
.distinctUntilChanged();
90+
return this.router.events.pipe(
91+
filter(event => event instanceof NavigationEnd),
92+
map(event => this.location.path()),
93+
distinctUntilChanged()
94+
);
9495
}
9596

9697
private getLocationFromStore(useInitial: boolean = false) {
@@ -148,7 +149,7 @@ export class NgReduxRouter {
148149

149150
this.reduxSubscription = this.ngRedux
150151
.select(state => this.selectLocationFromState(state))
151-
.distinctUntilChanged()
152+
.pipe(distinctUntilChanged())
152153
.subscribe(handleLocationChange);
153154
}
154155
}

packages/router/tsconfig.es6.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
"experimentalDecorators": true,
1212
"removeComments": false,
1313
"declaration": true,
14-
"lib" : ["es2015", "es2015.iterable", "dom"],
14+
"lib": ["es2015", "es2015.iterable", "dom"],
1515
"skipLibCheck": true
1616
},
17-
"exclude": [
18-
"lib",
19-
"node_modules",
20-
"spec",
21-
"release",
22-
"examples"
23-
]
17+
"exclude": ["lib", "node_modules", "spec", "release", "examples"],
18+
"angularCompilerOptions": {
19+
"generateCodeForLibraries": false,
20+
"strictMetadataEmit": true,
21+
"genDir": ".compiled",
22+
"annotationsAs": "decorators"
23+
}
2424
}

packages/router/tsconfig.esm.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111
"experimentalDecorators": true,
1212
"removeComments": false,
1313
"declaration": true,
14-
"lib" : ["es2015", "es2015.iterable", "dom"],
14+
"lib": ["es2015", "es2015.iterable", "dom"],
1515
"skipLibCheck": true
1616
},
17-
"exclude": [
18-
"lib",
19-
"node_modules",
20-
"spec",
21-
"release",
22-
"examples"
23-
]
17+
"exclude": ["lib", "node_modules", "spec", "release", "examples"],
18+
"angularCompilerOptions": {
19+
"generateCodeForLibraries": false,
20+
"strictMetadataEmit": true,
21+
"genDir": ".compiled",
22+
"annotationsAs": "decorators"
23+
}
2424
}

packages/router/tsconfig.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@
1111
"experimentalDecorators": true,
1212
"removeComments": false,
1313
"declaration": true,
14-
"lib" : ["es2015", "es2015.iterable", "dom"],
14+
"lib": ["es2015", "es2015.iterable", "dom"],
1515
"strict": true,
1616
"skipLibCheck": true
1717
},
18-
"exclude": [
19-
"lib",
20-
"node_modules",
21-
"spec",
22-
"release",
23-
"examples"
24-
]
18+
"exclude": ["lib", "node_modules", "spec", "release", "examples"],
19+
"angularCompilerOptions": {
20+
"generateCodeForLibraries": true,
21+
"strictMetadataEmit": true,
22+
"genDir": ".compiled",
23+
"annotationsAs": "decorators"
24+
}
2525
}

0 commit comments

Comments
 (0)