Skip to content

Commit 41f1bc4

Browse files
author
James Salas
authored
Upgrade immutable version to latest (#69)
* feat: upgrade immutable, rework yarn versions, bump version, stop hoisting, change main on source package.json
1 parent de919c0 commit 41f1bc4

21 files changed

+489
-523
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
# fallback to using the latest cache if no exact match is found
3434
- v1-dependencies-
3535

36-
- run: yarn install
36+
- run: yarn install --frozen-lockfile
3737

3838
- save_cache:
3939
paths:

.prettierignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
dist
22
coverage
3+
packages/store/docs

.yarnrc

-1
This file was deleted.

jest.config.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@ process.env.JEST_JUNIT_OUTPUT = './coverage/junit.xml';
55

66
module.exports = {
77
globals: {
8-
'ts-jest': {
9-
stringifyContentPathRegex: '\\.html$',
10-
},
8+
__TRANSFORM_HTML__: true,
119
},
1210
transform: {
1311
'^.+\\.(ts|js|html)$':

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"packages": ["packages/*"],
3-
"version": "9.0.0",
3+
"version": "10.0.0",
44
"npmClient": "yarn",
55
"useWorkspaces": true,
66
"ignore": "example-app",

package.json

+36-38
Original file line numberDiff line numberDiff line change
@@ -37,43 +37,41 @@
3737
"node": ">=8"
3838
},
3939
"devDependencies": {
40-
"@angular/animations": "7.2.1",
41-
"@angular/cli": "7.2.2",
42-
"@angular/common": "7.2.1",
43-
"@angular/compiler": "7.2.1",
44-
"@angular/compiler-cli": "7.2.1",
45-
"@angular/core": "7.2.1",
46-
"@angular/forms": "7.2.1",
47-
"@angular/platform-browser": "7.2.1",
48-
"@angular/platform-browser-dynamic": "7.2.1",
49-
"@angular/router": "7.2.1",
50-
"@commitlint/cli": "7.0.0",
51-
"@commitlint/config-conventional": "7.0.1",
52-
"@commitlint/prompt-cli": "7.0.0",
53-
"@types/jest": "23.1.6",
54-
"@types/webpack-env": "1.13.6",
55-
"babel-core": "6.26.3",
56-
"babel-jest": "23.4.2",
57-
"codelyzer": "4.5.0",
58-
"husky": "1.1.3",
59-
"immutable": "3.8.1",
60-
"jest": "23.4.1",
61-
"jest-junit": "5.1.0",
62-
"jest-preset-angular": "6.0.0",
63-
"jest-zone-patch": "0.0.8",
64-
"lerna": "3.4.3",
65-
"lint-staged": "7.2.0",
66-
"ng-packagr": "4.5.0",
67-
"npm-run-all": "4.1.3",
68-
"prettier": "1.13.7",
69-
"redux": "4.0.0",
70-
"redux-logger": "2.10.2",
71-
"rimraf": "2.6.2",
72-
"rxjs": "6.3.3",
73-
"tsickle": "0.34.0",
74-
"tslib": "1.9.3",
75-
"tslint": "5.11.0",
76-
"typescript": "3.2.2",
77-
"zone.js": "0.8.26"
40+
"@angular/animations": "^7.0.0",
41+
"@angular/common": "^7.0.0",
42+
"@angular/compiler": "^7.0.0",
43+
"@angular/compiler-cli": "^7.0.0",
44+
"@angular/core": "^7.0.0",
45+
"@angular/forms": "^7.0.0",
46+
"@angular/platform-browser": "^7.0.0",
47+
"@angular/platform-browser-dynamic": "^7.0.0",
48+
"@angular/router": "^7.0.0",
49+
"@babel/core": "^7.0.0-0",
50+
"@babel/types": "^7.2.2",
51+
"@commitlint/cli": "^7.3.2",
52+
"@commitlint/config-conventional": "^7.3.1",
53+
"@commitlint/prompt-cli": "^7.3.1",
54+
"@types/jest": "^23.1.13",
55+
"babel-core": "^7.0.0-0",
56+
"babel-jest": "^23.0.0",
57+
"codelyzer": "^4.5.0",
58+
"husky": "^1.3.1",
59+
"jest": "^23.6.0",
60+
"jest-junit": "^6.0.1",
61+
"jest-preset-angular": "^6.0.2",
62+
"jest-zone-patch": "^0.0.10",
63+
"lerna": "^3.10.6",
64+
"lint-staged": "^8.1.0",
65+
"ng-packagr": "^4.6.0",
66+
"npm-run-all": "^4.1.3",
67+
"prettier": "~1.15.3",
68+
"redux": "^4.0.0",
69+
"rimraf": "^2.6.2",
70+
"rxjs": "^6.0.0",
71+
"tsickle": "^0.34.0",
72+
"tslib": "^1.9.0",
73+
"tslint": "^5.12.1",
74+
"typescript": "~3.2.0",
75+
"zone.js": "~0.8.26"
7876
}
7977
}

packages/example-app/package.json

+12-13
Original file line numberDiff line numberDiff line change
@@ -15,22 +15,21 @@
1515
"node": ">=8"
1616
},
1717
"dependencies": {
18-
"@angular-redux/form": "latest",
19-
"@angular-redux/router": "latest",
20-
"@angular-redux/store": "latest",
21-
"@angular/common": "^7.2.0",
22-
"@angular/compiler": "^7.2.0",
23-
"@angular/core": "^7.2.0",
24-
"@angular/forms": "^7.2.0",
25-
"@angular/http": "^7.2.0",
26-
"@angular/platform-browser": "^7.2.0",
27-
"@angular/platform-browser-dynamic": "^7.2.0",
28-
"@angular/router": "^7.2.0",
29-
"@types/webpack-env": "1.13.6",
18+
"@angular-redux/form": "10.0.0",
19+
"@angular-redux/router": "10.0.0",
20+
"@angular-redux/store": "10.0.0",
21+
"@angular/common": "^7.2.1",
22+
"@angular/compiler": "^7.2.1",
23+
"@angular/core": "^7.2.1",
24+
"@angular/forms": "^7.2.1",
25+
"@angular/http": "^7.2.1",
26+
"@angular/platform-browser": "^7.2.1",
27+
"@angular/platform-browser-dynamic": "^7.2.1",
28+
"@angular/router": "^7.2.1",
3029
"core-js": "^2.6.2",
3130
"flux-standard-action": "^2.0.3",
3231
"ramda": "^0.23.0",
33-
"redux": "^4.0.1",
32+
"redux": "^4.0.0",
3433
"redux-logger": "^3.0.1",
3534
"redux-observable": "^1.0.0",
3635
"rxjs": "^6.3.3",

packages/form/README.md

+7-9
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ For the simplest use-cases, the API is very straightforward. Your template
1919
would look something like this:
2020

2121
```html
22-
<form connect="myForm">
23-
<input type="text" name="address" ngControl ngModel />
24-
</form>
22+
<form connect="myForm">
23+
<input type="text" name="address" ngControl ngModel />
24+
</form>
2525
```
2626

2727
The important bit to note here is the `[connect]` directive. This is the only thing
@@ -42,9 +42,7 @@ Then I would supply `myForm` as the argument to `[connect]`. If myForm were nest
4242
deeper inside of the app state, you could do something like this:
4343

4444
```html
45-
<form [connect]="['personalInfo', 'myForm']">
46-
...
47-
</form>
45+
<form [connect]="['personalInfo', 'myForm']">...</form>
4846
```
4947

5048
Note that ImmutableJS integration is provided seamlessly. If `personalInfo` is an
@@ -207,9 +205,9 @@ that element from the Redux state.
207205
The value in "connect" attribute is the value that will show up in the Redux store. The formGroup value is the name of the object in your code that represents the form group.
208206

209207
```html
210-
<form connect="myForm" [formGroup]="loginForm">
211-
<input type="text" name="address" formControlName="firstName" />
212-
</form>
208+
<form connect="myForm" [formGroup]="loginForm">
209+
<input type="text" name="address" formControlName="firstName" />
210+
</form>
213211
```
214212

215213
#### Troubleshooting

packages/form/package.json

+4-15
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angular-redux/form",
3-
"version": "9.0.0",
3+
"version": "10.0.0",
44
"description": "Build Angular 2+ forms with Redux",
55
"author": "Chris Bond",
66
"license": "MIT",
@@ -25,25 +25,14 @@
2525
"node": ">=8"
2626
},
2727
"peerDependencies": {
28-
"@angular-redux/store": "^9.0.0",
28+
"@angular-redux/store": "^10.0.0",
2929
"@angular/core": "^7.0.0",
3030
"@angular/forms": "^7.0.0",
3131
"redux": "^4.0.0",
3232
"rxjs": "^6.0.0"
3333
},
3434
"dependencies": {
35-
"immutable": "3.8.1"
35+
"immutable": "^4.0.0-rc.12"
3636
},
37-
"devDependencies": {
38-
"@angular-redux/store": "9.0.0"
39-
},
40-
"main": "dist/bundles/angular-redux-form.umd.js",
41-
"module": "dist/fesm5/angular-redux-form.js",
42-
"es2015": "dist/fesm2015/angular-redux-form.js",
43-
"esm5": "dist/esm5/angular-redux-form.js",
44-
"esm2015": "dist/esm2015/angular-redux-form.js",
45-
"fesm5": "dist/fesm5/angular-redux-form.js",
46-
"fesm2015": "dist/fesm2015/angular-redux-form.js",
47-
"typings": "dist/angular-redux-form.d.ts",
48-
"metadata": "dist/angular-redux-form.metadata.json"
37+
"main": "src/index.ts"
4938
}

packages/form/src/form-reducer.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Iterable } from 'immutable';
1+
import { Collection } from 'immutable';
22

33
import { Action } from 'redux';
44

@@ -7,10 +7,10 @@ import { FORM_CHANGED } from './form-store';
77
import { State } from './state';
88

99
export const defaultFormReducer = <RootState>(
10-
initialState?: RootState | Iterable.Keyed<string, any>,
10+
initialState?: RootState | Collection.Keyed<string, any>,
1111
) => {
1212
const reducer = (
13-
state: RootState | Iterable.Keyed<string, any> | undefined = initialState,
13+
state: RootState | Collection.Keyed<string, any> | undefined = initialState,
1414
action: Action & { payload?: any },
1515
) => {
1616
switch (action.type) {

packages/form/src/state.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Iterable, Map as ImmutableMap } from 'immutable';
1+
import { isCollection, Map as ImmutableMap } from 'immutable';
22

33
import { FormException } from './form-exception';
44

@@ -31,7 +31,7 @@ export abstract class State {
3131
for (const k of path) {
3232
const parent = deepValue;
3333

34-
if (Iterable.isIterable(deepValue)) {
34+
if (isCollection(deepValue)) {
3535
const m = (deepValue as any) as ImmutableMap<string, any>;
3636
if (typeof m.get === 'function') {
3737
deepValue = m.get(k);
@@ -116,8 +116,8 @@ export abstract class State {
116116
return typeof stateKey === 'number'
117117
? new Array()
118118
: Array.isArray(stateKey)
119-
? ImmutableMap()
120-
: new Object();
119+
? ImmutableMap()
120+
: new Object();
121121
};
122122

123123
return parentOperations.update(
@@ -161,7 +161,7 @@ export abstract class State {
161161
return operations;
162162
};
163163

164-
if (Iterable.isIterable(object)) {
164+
if (isCollection(object)) {
165165
return metaOperations(
166166
// Replace
167167
(parent: any, key: number | string, value: K) => {

packages/form/src/tests.utilities.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { flushMicrotasks } from '@angular/core/testing';
22

3-
import { Iterable } from 'immutable';
3+
import { isCollection } from 'immutable';
44
import { Middleware } from 'redux';
55
// redux-logger is a dev dependency in the workspace
66
// tslint:disable-next-line:no-implicit-dependencies
@@ -14,7 +14,7 @@ export const logger: Middleware = createLogger({
1414
const newState: any = new Object();
1515

1616
for (const i of Object.keys(state)) {
17-
newState[i] = Iterable.isIterable(state[i]) ? state[i].toJS() : state[i];
17+
newState[i] = isCollection(state[i]) ? state[i].toJS() : state[i];
1818
}
1919

2020
return newState;

packages/router/package.json

+3-14
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@angular-redux/router",
3-
"version": "9.0.0",
3+
"version": "10.0.0",
44
"description": "Keep your Angular 2+ router state in Redux.",
55
"author": "Dag Stuan",
66
"license": "MIT",
@@ -26,23 +26,12 @@
2626
"node": ">=8"
2727
},
2828
"peerDependencies": {
29-
"@angular-redux/store": "^9.0.0",
29+
"@angular-redux/store": "^10.0.0",
3030
"@angular/common": "^7.0.0",
3131
"@angular/core": "^7.0.0",
3232
"@angular/router": "^7.0.0",
3333
"redux": "^4.0.0",
3434
"rxjs": "^6.0.0"
3535
},
36-
"devDependencies": {
37-
"@angular-redux/store": "9.0.0"
38-
},
39-
"main": "dist/bundles/angular-redux-router.umd.js",
40-
"module": "dist/fesm5/angular-redux-router.js",
41-
"es2015": "dist/fesm2015/angular-redux-router.js",
42-
"esm5": "dist/esm5/angular-redux-router.js",
43-
"esm2015": "dist/esm2015/angular-redux-router.js",
44-
"fesm5": "dist/fesm5/angular-redux-router.js",
45-
"fesm2015": "dist/fesm2015/angular-redux-router.js",
46-
"typings": "dist/angular-redux-router.d.ts",
47-
"metadata": "dist/angular-redux-router.metadata.json"
36+
"main": "src/index.ts"
4837
}

packages/store/articles/action-creator-service.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -77,14 +77,14 @@ import { RandomNumberService } from '../services/random-number';
7777
selector: 'counter',
7878
providers: [CounterActions, RandomNumberService],
7979
template: `
80-
<p>
81-
Clicked: {{ counter$ | async }} times
82-
<button (click)="actions.increment()">+</button>
83-
<button (click)="actions.decrement()">-</button>
84-
<button (click)="actions.incrementIfOdd()">Increment if odd</button>
85-
<button (click)="actions.incrementAsync(2222)">Increment async</button>
86-
<button (click)="actions.randomize()">Set to random number</button>
87-
</p>
80+
<p>
81+
Clicked: {{ counter$ | async }} times
82+
<button (click)="actions.increment()">+</button>
83+
<button (click)="actions.decrement()">-</button>
84+
<button (click)="actions.incrementIfOdd()">Increment if odd</button>
85+
<button (click)="actions.incrementAsync(2222)">Increment async</button>
86+
<button (click)="actions.randomize()">Set to random number</button>
87+
</p>
8888
`,
8989
})
9090
export class Counter {

packages/store/articles/fractal-store.md

+6-7
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ export const userComponentReducer = (state, action) =>
4646
@Component({
4747
selector: 'user',
4848
template: `
49-
<p>name: {{ name$ |async }}</p>
49+
<p>name: {{ name$ | async }}</p>
5050
<p>occupation: {{ occupation$ | async }}</p>
5151
<p>lines of code: {{ loc$ | async }}</p>
52-
   <button (click)=addCode(100)>Add 100 lines of code</button>
52+
<button (click)="addCode(100)">Add 100 lines of code</button>
5353
`,
5454
})
5555
export class UserComponent implements NgOnInit {
@@ -87,8 +87,7 @@ export class UserComponent implements NgOnInit {
8787
```
8888

8989
```html
90-
<user [userId]='alice'></user>
91-
<user [userId]='bob'></user>
90+
<user [userId]="alice"></user> <user [userId]="bob"></user>
9291
```
9392

9493
This way, we use the same type of component for both Alice and Bob, but
@@ -98,7 +97,7 @@ store state.
9897
You can even nest fractal stores by calling `configureSubStore` on an
9998
existing subStore.
10099

101-
## What about @select, @select$, @dispatch?
100+
## What about @select, @select\$, @dispatch?
102101

103102
As of 6.5.0, the decorator interface has been expanded to support fractal
104103
stores as well.
@@ -125,10 +124,10 @@ export const defaultToZero = (obs$: Observable<number>) =>
125124
@Component({
126125
selector: 'user',
127126
template: `
128-
<p>name: {{ name$ |async }}</p>
127+
<p>name: {{ name$ | async }}</p>
129128
<p>occupation: {{ occupation$ | async }}</p>
130129
<p>lines of code: {{ loc$ | async }}</p>
131-
   <button (click)=addCode(100)>Add 100 lines of code</button>
130+
<button (click)="addCode(100)">Add 100 lines of code</button>
132131
`,
133132
})
134133
@WithSubStore({

0 commit comments

Comments
 (0)