Skip to content

Commit 2302dd8

Browse files
authored
Merge pull request #21 from jamesbs/upgrade
Update to latest versions of redux, redux-observable, rxjs
2 parents 192d447 + 8990dde commit 2302dd8

17 files changed

+3135
-1988
lines changed

.DS_Store

-6 KB
Binary file not shown.

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# misc
22
.vscode
3+
.DS_Store
34

45
# Logs
56
logs
@@ -32,7 +33,7 @@ build/Release
3233
# Dependency directories
3334
node_modules
3435
jspm_packages
35-
release
36+
release
3637

3738
# Optional npm cache directory
3839
.npm

.node-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
10.13.0

CHANGELOG.MD

Lines changed: 44 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,46 @@
11
# Change Log
22

3+
4+
# 2.0.0
5+
## BREAKING CHANGES
6+
* As of version 1, __redux-observable__ requires you to pass in the rootEpic through `epicMiddleware.run(rootEpic)` after creating a store. Now you'll need to pass in all epic classes to a separate `combineDecoratedEpics` call.
7+
8+
_Before_
9+
```ts
10+
import { createEpics } from 'redux-observable-decorator';
11+
12+
class NgModule{
13+
constructor(
14+
private store: NgRedux,
15+
private epicClass1: EpicClass1,
16+
private epicClass2: EpicClass2
17+
) {
18+
const epicMiddleware = createEpics(epicClass1, epicClass2, options);
19+
store.configureStore(reducer, state, [epicMiddleware]);
20+
}
21+
}
22+
```
23+
24+
_Now_
25+
```ts
26+
import { createEpicMiddleware } from 'redux-observable';
27+
import { combineDecoratedEpics } from 'redux-observable-decorator';
28+
29+
class NgModule{
30+
constructor(
31+
private store: NgRedux,
32+
private epicClass1: EpicClass1,
33+
private epicClass2: EpicClass2
34+
) {
35+
const epicMiddleware = createEpicMiddleware(options);
36+
store.configureStore(reducer, state, [epicMiddleware]);
37+
epicMiddleware.run(combineDecoratedEpics(epicClass1, epicClass2));
38+
}
39+
}
40+
```
41+
42+
* Update peer dependencies to redux 4, redux-observable 1 and rxjs 6
43+
344
# 1.2.0-0
445

546
* Update dependencies to support redux-observable 0.15+
@@ -20,14 +61,14 @@ class TestOne {
2061
.ofType('TEST_A_IN')
2162
.mapTo({ type: 'TEST_A_OUT', payload: deps.foo() });
2263
}
23-
64+
2465
const epicMiddleware = createEpics(epicOne, { dependencies: {
2566
foo: function() { return 'bar'; }
26-
}});
67+
}});
2768
```
2869
# 1.0.0
2970

30-
## Breaking Change
71+
## Breaking Change
3172

3273
* Change `createEpic` to take second generic argument to match new `EpicMiddleware<T,S>` interface. [#5](https://github.com/angular-redux/redux-observable-decorator/pull/5) closes [#6](https://github.com/angular-redux/redux-observable-decorator/issues/6)
3374
* Addresses breaking change in [redux-observable 0.13.0](https://github.com/redux-observable/redux-observable/blob/master/CHANGELOG.md#breaking-changes

README.md

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,65 @@
66

77
Decorators for Redux Observable
88

9-
When using Redux with Angular with ng-redux and redux-observable, it's common to create your epics as an injectable class, and when configuring the store - creating an epic middleware for each one, or using combineEpics:
9+
When using Redux with Angular with __angular-redux/store__ and __redux-observable__, it's common to create your epics as an injectable class, and when configuring the store - creating an epic middleware for each one, or using `combineEpics`:
1010

1111
```ts
1212
@Injectable()
1313
export class SomeEpics {
14-
epicOne = (action$) => action$.ofType('PING').mapTo({type: 'PONG'});
15-
epicTwo = (action$) => action$.ofType('ACTION_IN').mapTo({type: 'ACTION_OUT'});
14+
epicOne = (action$) => action$.ofType('PING').pipe(mapTo({type: 'PONG'}));
15+
epicTwo = (action$) => action$.ofType('ACTION_IN').pipe(mapTo({type: 'ACTION_OUT'}));
1616
}
1717

1818
@NgModule({
1919

2020
})
2121
export class AppModule {
22-
constructor(ngRedux:NgRedux, someEpics:SomeEpics) {
22+
constructor(ngRedux: NgRedux, someEpics: SomeEpics) {
2323
let epics = combineEpics(
2424
someEpics.epicOne,
2525
someEpics.epicTwo
26-
)
27-
28-
ngRedux.configureStore(reducer,[createEpicMidleware(epics)])
29-
30-
// or
26+
);
27+
let epicMiddleware = createEpicMidleware();
28+
29+
ngRedux.configureStore(reducer,[epicMiddleware]);
30+
epicMiddleware.run(epics);
31+
32+
// or
3133

3234
let epicOne = createMiddleware(someEpics.epicOne);
33-
let epicTwo = createMiddleware(someEpics.epicOne);
35+
let epicTwo = createMiddleware(someEpics.epicTwo);
3436

35-
ngRedux.configureStore(reducer,[epicOne, epicTwo)])
37+
ngRedux.configureStore(reducer,[epicOne, epicTwo]);
3638
}
3739
}
3840
```
3941

4042
This decorator is intended to make it easier to mark which properties / methods in a class are Epics to simplify creating the epic middleware for your application.
4143

4244
```ts
43-
import { Epic } from 'redux-observable-decorator'
45+
import { Epic } from 'redux-observable-decorator';
46+
4447
@Injectable()
4548
export class SomeEpics {
46-
@Epic() epicOne = (action$) => action$.ofType('PING').mapTo({type: 'PONG'});
47-
@Epic() epicTwo = (action$) => action$.ofType('ACTION_IN').mapTo({type: 'ACTION_OUT'});
49+
@Epic() epicOne = (action$) => action$.ofType('PING').pipe(mapTo({type: 'PONG'}));
50+
@Epic() epicTwo = (action$) => action$.ofType('ACTION_IN').pipe(mapTo({type: 'ACTION_OUT'}));
4851
}
4952
```
5053

5154
```ts
52-
import { createEpics } from 'redux-observable-decorator';
55+
import { combineDecoratedEpics } from 'redux-observable-decorator';
56+
import { createEpicMiddleware } from 'redux-observable';
57+
5358
@NgModule({
5459

5560
})
5661
export class AppModule {
5762
constructor(ngRedux:NgRedux, someEpics:SomeEpics) {
58-
let epics = createEpics(someEpics)
59-
60-
ngRedux.confgureStore(reducer,[epics])
61-
63+
let epics = combineDecoratedEpics(someEpics);
64+
const epicMiddleware = createEpicMiddleware();
65+
66+
ngRedux.configureStore(reducer,[epicMiddleware]);
67+
epicMiddleware.run(epics);
6268
}
6369
}
6470
```
@@ -67,25 +73,26 @@ This can be used with vanilla redux also - as seen in the unit tests...
6773

6874
```ts
6975
class Test {
70-
@Epic() epic = (action$) => action$.ofType('TEST_IN').mapTo({ type: 'TEST_OUT' });
76+
@Epic() epic = (action$) => action$.ofType('TEST_IN').pipe(mapTo({ type: 'TEST_OUT' }));
7177
}
7278

7379
const reducer = (state = [], action) => state.concat(action);
7480
const epics = new Test();
75-
const epicMiddleware = createEpics(epics);
81+
const epicMiddleware = createEpicMiddleware(epics);
7682
const store = createStore(reducer, applyMiddleware(epicMiddleware));
83+
epicMiddleware.run(combineDecoratedEpics(epics));
7784
```
7885

7986
# Inspiration
8087

8188
The `@Effect` decorator from [ngrx/effects](https://github.com/ngrx/effects)
8289

83-
# Todo
90+
# Todo
8491

8592
* [ ] Better docs
8693
* [ ] Publish on NPM
8794
* [ ] Improve tests
88-
* [ ] Get test coverage working
89-
* [ ] Some Anglar 2 / integration tests
95+
* [ ] Get test coverage working
96+
* [ ] Some Anglar 2 / integration tests
9097
* [ ] Example App
9198
* [ ] Strategy for lazy loading epics (to support code-splitting)?

karma.conf.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ module.exports = function (karma) {
4242
singleRun: false,
4343
webpackServer: { noInfo: false },
4444
webpack: {
45+
mode: 'development',
4546
devtool: 'inline-source-map',
4647
resolve: {
4748
extensions: ['.ts', '.js']
@@ -57,7 +58,7 @@ module.exports = function (karma) {
5758
]
5859
},
5960
{
60-
test: /\.ts?$/,
61+
test: /\.ts$/,
6162
exclude: /(node_modules)/,
6263
loader: 'ts-loader'
6364
},
@@ -79,8 +80,8 @@ module.exports = function (karma) {
7980
failOnHint: false,
8081
resourcePath: 'src'
8182
}
82-
})
83+
}),
8384
]
8485
}
8586
});
86-
};
87+
};

package.json

Lines changed: 21 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "redux-observable-decorator",
3-
"version": "1.2.0-0",
3+
"version": "2.0.0",
44
"description": "Decorators for Redux Observable",
55
"main": "./release/index.js",
66
"files": [
@@ -9,12 +9,11 @@
99
"typings": "./release/index.d.ts",
1010
"scripts": {
1111
"test": "karma start --single-run",
12+
"prepare": "npm run build",
1213
"build": "npm run build:js",
13-
"build:js": "ngc -p tsconfig.dist.json",
14+
"build:js": "tsc --build tsconfig.dist.json",
1415
"prebuild": "npm run test && npm run clean:pre",
15-
"postbuild": "npm run clean:post",
1616
"clean:pre": "rimraf release",
17-
"clean:post": "rimraf **/*.ngsummary.json",
1817
"postversion": "npm run build"
1918
},
2019
"repository": "git+https://github.com/angular-redux/redux-observable-decorator.git",
@@ -25,42 +24,33 @@
2524
},
2625
"homepage": "https://github.com/angular-redux/redux-observable-decorator#readme",
2726
"peerDependencies": {
28-
"redux": "3.*",
29-
"redux-observable": "^0.13.0 || ^0.14.0 || ^0.15.0 || ^0.16.0"
27+
"redux-observable": "^1.0.0"
3028
},
3129
"devDependencies": {
32-
"@angular/common": "4.0.0",
33-
"@angular/compiler": "4.0.0",
34-
"@angular/compiler-cli": "4.0.0",
35-
"@angular/core": "4.0.0",
36-
"@angular/platform-browser": "4.0.0",
37-
"@angular/platform-browser-dynamic": "4.0.0",
38-
"@angular/platform-server": "4.0.0",
30+
"@types/core-js": "^2.5.0",
3931
"@types/jasmine": "^2.5.38",
4032
"@types/node": "^6.0.52",
41-
"awesome-typescript-loader": "^3.0.0-beta.17",
42-
"core-js": "^2.4.1",
33+
"@types/webpack-env": "^1.13.6",
34+
"core-js": "^2.6.1",
4335
"istanbul-instrumenter-loader": "^1.1.0",
4436
"jasmine-core": "^2.5.2",
45-
"karma": "^1.4.1",
46-
"karma-chrome-launcher": "^2.0.0",
47-
"karma-coverage": "^1.1.1",
48-
"karma-jasmine": "^1.1.0",
49-
"karma-mocha-reporter": "^2.2.1",
37+
"karma": "^3.1.4",
38+
"karma-chrome-launcher": "^2.2.0",
39+
"karma-coverage": "^1.1.2",
40+
"karma-jasmine": "^2.0.1",
41+
"karma-mocha-reporter": "^2.2.5",
5042
"karma-sourcemap-loader": "^0.3.7",
51-
"karma-typescript-preprocessor": "^0.3.1",
52-
"karma-webpack": "^2.0.2",
53-
"redux": "^3.6.0",
54-
"redux-observable": "^0.16.0",
43+
"karma-webpack": "^4.0.0-rc.5",
44+
"redux": "^4.0.1",
45+
"redux-observable": "^1.0.0",
5546
"reflect-metadata": "^0.1.8",
5647
"rimraf": "^2.5.4",
57-
"rxjs": "^5.0.1",
58-
"ts-loader": "^2.2.7",
48+
"rxjs": "^6.3.3",
49+
"ts-loader": "^5.3.2",
5950
"tslint": "^4.1.1",
60-
"tslint-loader": "^3.3.0",
61-
"typescript": "^2.4.0",
62-
"uglifyjs": "^2.4.10",
63-
"webpack": "^2.2.1",
64-
"zone.js": "^0.8.4"
51+
"tslint-loader": "^3.5.4",
52+
"typescript": "^3.2.2",
53+
"webpack": "^4.28.3",
54+
"zone.js": "^0.8.26"
6555
}
6656
}

0 commit comments

Comments
 (0)