Skip to content

Commit 5366227

Browse files
authored
chore: release v0.1.0 (#274)
# Release - Update changelog - Bump major prerelease version # Build - Require RxJS ^7.2.0 peer dependency - Add global UMD ID to prevent dash usage - Add external UMD module ID for `@ngrx/component-store` - Decorate `Router` and `ActivatedRoute` dependencies with `Inject` to remove build warnings about unused imports
1 parent a6f664c commit 5366227

File tree

6 files changed

+143
-13
lines changed

6 files changed

+143
-13
lines changed

CHANGELOG.md

Lines changed: 124 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,133 @@
1-
# Changelog
1+
# Router Component Store changelog
22

3-
## 0.0.2
3+
## 0.1.0 (2022-10-20)
4+
5+
## Features
6+
7+
- Add `RouterStore`
8+
- Remove `LocalRouterStore`
9+
- Add `provideLocalRouterStore`
10+
- Remove `GlobalRouterStore`
11+
- Add `provideGlobalRouterStore`
12+
13+
## Bug fixes
14+
15+
- Fix [#272](https://github.com/ngworker/router-component-store/issues/272): Class constructor ComponentStore cannot be invoked without 'new'
16+
17+
## **BREAKING CHANGES**
18+
19+
### Require RxJS 7.2
20+
21+
We now require at least RxJS version 7.2 to import operators from the primary entry point of the `rxjs` package.
22+
23+
### LocalRouterStore is removed
24+
25+
`LocalRouterStore` is replaced by `RouterStore` and `provideLocalRouterStore`.
26+
27+
#### Migration
28+
29+
Use `provideLocalRouterStore()` as component-level provider and inject `RouterStore` instead of `LocalRouterStore`.
30+
31+
Before:
32+
33+
```typescript
34+
// hero-detail.component.ts
35+
// (...)
36+
import { LocalRouterStore } from '@ngworker/router-component-store';
37+
38+
@Component({
39+
// (...)
40+
providers: [LocalRouterStore],
41+
})
42+
export class HeroDetailComponent {
43+
heroId$: Observable<string> = this.routerStore.selectQueryParam('id');
44+
45+
constructor(private routerStore: LocalRouterStore) {}
46+
}
47+
```
48+
49+
After:
50+
51+
```typescript
52+
// hero-detail.component.ts
53+
// (...)
54+
import {
55+
provideLocalRouterStore,
56+
RouterStore,
57+
} from '@ngworker/router-component-store';
58+
59+
@Component({
60+
// (...)
61+
providers: [provideLocalRouterStore()],
62+
})
63+
export class HeroDetailComponent {
64+
heroId$: Observable<string> = this.routerStore.selectQueryParam('id');
65+
66+
constructor(private routerStore: RouterStore) {}
67+
}
68+
```
69+
70+
### GlobalRouterStore is removed
71+
72+
`GlobalRouterStore` is replaced by `RouterStore` and `provideGlobalRouterStore`.
73+
74+
#### Migration
75+
76+
Add `provideGlobalRouterStore()` to your root environment injector and inject `RouterStore` instead of `GlobalRouterStore`.
77+
78+
Before:
79+
80+
```typescript
81+
// hero.service.ts
82+
// (...)
83+
import { GlobalRouterStore } from '@ngworker/router-component-store';
84+
85+
@Injectable({
86+
providedIn: 'root',
87+
})
88+
export class HeroService {
89+
activeHeroId$: Observable<string> = this.routerStore.selectQueryParam('id');
90+
91+
constructor(private routerStore: GlobalRouterStore) {}
92+
}
93+
```
94+
95+
After:
96+
97+
```typescript
98+
// app.module.ts
99+
// (...)
100+
import { provideGlobalRouterStore } from '@ngworker/router-component-store';
101+
102+
@NgModule({
103+
// (...)
104+
providers: [provideGlobalRouterStore()],
105+
})
106+
export class AppModule {}
107+
```
108+
109+
```typescript
110+
// hero.service.ts
111+
// (...)
112+
import { RouterStore } from '@ngworker/router-component-store';
113+
114+
@Injectable({
115+
providedIn: 'root',
116+
})
117+
export class HeroService {
118+
activeHeroId$: Observable<string> = this.routerStore.selectQueryParam('id');
119+
120+
constructor(private routerStore: RouterStore) {}
121+
}
122+
```
123+
124+
## 0.0.2 (2021-11-20)
4125

5126
### Refactorings
6127

7128
- Encapsulate members inherited from `ComponentStore`
8129

9-
## 0.0.1
130+
## 0.0.1 (2021-11-20)
10131

11132
### Features
12133

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
# @ngworker/router-component-store
1+
# Router Component Store
22

3-
Angular Router-connecting NgRx component stores.
3+
[`@ngworker/router-component-store`](https://www.npmjs.com/package/@ngworker/router-component-store)
4+
5+
An Angular Router-connecting NgRx component store.
46

57
## Compatibility
68

packages/router-component-store/ng-package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22
"$schema": "../../node_modules/ng-packagr/ng-package.schema.json",
33
"dest": "../../dist/packages/router-component-store",
44
"lib": {
5-
"entryFile": "src/index.ts"
5+
"entryFile": "src/index.ts",
6+
"umdId": "ngworker.routerComponentStore",
7+
"umdModuleIds": {
8+
"@ngrx/component-store": "ngrx.componentStore"
9+
}
610
}
711
}

packages/router-component-store/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
22
"name": "@ngworker/router-component-store",
3-
"version": "0.0.2",
3+
"version": "0.1.0",
44
"description": "Angular Router-connecting NgRx component stores.",
55
"license": "MIT",
66
"peerDependencies": {
77
"@angular/core": "^12.2.0",
88
"@angular/router": "^12.2.0",
99
"@ngrx/component-store": "^12.0.0",
10-
"rxjs": "^7.0.0"
10+
"rxjs": "^7.2.0"
1111
},
1212
"dependencies": {
1313
"tslib": "^2.3.0"

packages/router-component-store/src/lib/global-router-store/global-router-store.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Injectable } from '@angular/core';
1+
import { Inject, Injectable } from '@angular/core';
22
import { Data, Params, Router } from '@angular/router';
33
import { ComponentStore } from '@ngrx/component-store';
44
import { map, Observable } from 'rxjs';
@@ -55,7 +55,10 @@ export class GlobalRouterStore
5555
(routerState) => routerState.url
5656
);
5757

58-
constructor(router: Router, serializer: MinimalRouterStateSerializer) {
58+
constructor(
59+
@Inject(Router) router: Router,
60+
serializer: MinimalRouterStateSerializer
61+
) {
5962
super({
6063
routerState: serializer.serialize(router.routerState.snapshot),
6164
});

packages/router-component-store/src/lib/local-router-store/local-router-store.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Injectable } from '@angular/core';
1+
import { Inject, Injectable } from '@angular/core';
22
import { ActivatedRoute, Data, Params, Router } from '@angular/router';
33
import { ComponentStore } from '@ngrx/component-store';
44
import { map, Observable } from 'rxjs';
@@ -46,8 +46,8 @@ export class LocalRouterStore
4646
);
4747

4848
constructor(
49-
route: ActivatedRoute,
50-
router: Router,
49+
@Inject(ActivatedRoute) route: ActivatedRoute,
50+
@Inject(Router) router: Router,
5151
serializer: MinimalRouterStateSerializer
5252
) {
5353
super({

0 commit comments

Comments
 (0)