Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade immutable version to latest #69

Merged
merged 4 commits into from
Jan 22, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
# fallback to using the latest cache if no exact match is found
- v1-dependencies-

- run: yarn install
- run: yarn install --frozen-lockfile

- save_cache:
paths:
Expand Down
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
dist
coverage
packages/store/docs
1 change: 0 additions & 1 deletion .yarnrc

This file was deleted.

4 changes: 1 addition & 3 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ process.env.JEST_JUNIT_OUTPUT = './coverage/junit.xml';

module.exports = {
globals: {
'ts-jest': {
stringifyContentPathRegex: '\\.html$',
},
__TRANSFORM_HTML__: true,
},
transform: {
'^.+\\.(ts|js|html)$':
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"packages": ["packages/*"],
"version": "9.0.0",
"version": "10.0.0",
"npmClient": "yarn",
"useWorkspaces": true,
"ignore": "example-app",
Expand Down
74 changes: 36 additions & 38 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,43 +37,41 @@
"node": ">=8"
},
"devDependencies": {
"@angular/animations": "7.2.1",
"@angular/cli": "7.2.2",
"@angular/common": "7.2.1",
"@angular/compiler": "7.2.1",
"@angular/compiler-cli": "7.2.1",
"@angular/core": "7.2.1",
"@angular/forms": "7.2.1",
"@angular/platform-browser": "7.2.1",
"@angular/platform-browser-dynamic": "7.2.1",
"@angular/router": "7.2.1",
"@commitlint/cli": "7.0.0",
"@commitlint/config-conventional": "7.0.1",
"@commitlint/prompt-cli": "7.0.0",
"@types/jest": "23.1.6",
"@types/webpack-env": "1.13.6",
"babel-core": "6.26.3",
"babel-jest": "23.4.2",
"codelyzer": "4.5.0",
"husky": "1.1.3",
"immutable": "3.8.1",
"jest": "23.4.1",
"jest-junit": "5.1.0",
"jest-preset-angular": "6.0.0",
"jest-zone-patch": "0.0.8",
"lerna": "3.4.3",
"lint-staged": "7.2.0",
"ng-packagr": "4.5.0",
"npm-run-all": "4.1.3",
"prettier": "1.13.7",
"redux": "4.0.0",
"redux-logger": "2.10.2",
"rimraf": "2.6.2",
"rxjs": "6.3.3",
"tsickle": "0.34.0",
"tslib": "1.9.3",
"tslint": "5.11.0",
"typescript": "3.2.2",
"zone.js": "0.8.26"
"@angular/animations": "^7.0.0",
"@angular/common": "^7.0.0",
"@angular/compiler": "^7.0.0",
"@angular/compiler-cli": "^7.0.0",
"@angular/core": "^7.0.0",
"@angular/forms": "^7.0.0",
"@angular/platform-browser": "^7.0.0",
"@angular/platform-browser-dynamic": "^7.0.0",
"@angular/router": "^7.0.0",
"@babel/core": "^7.0.0-0",
"@babel/types": "^7.2.2",
"@commitlint/cli": "^7.3.2",
"@commitlint/config-conventional": "^7.3.1",
"@commitlint/prompt-cli": "^7.3.1",
"@types/jest": "^23.1.13",
"babel-core": "^7.0.0-0",
"babel-jest": "^23.0.0",
"codelyzer": "^4.5.0",
"husky": "^1.3.1",
"jest": "^23.6.0",
"jest-junit": "^6.0.1",
"jest-preset-angular": "^6.0.2",
"jest-zone-patch": "^0.0.10",
"lerna": "^3.10.6",
"lint-staged": "^8.1.0",
"ng-packagr": "^4.6.0",
"npm-run-all": "^4.1.3",
"prettier": "~1.15.3",
"redux": "^4.0.0",
"rimraf": "^2.6.2",
"rxjs": "^6.0.0",
"tsickle": "^0.34.0",
"tslib": "^1.9.0",
"tslint": "^5.12.1",
"typescript": "~3.2.0",
"zone.js": "~0.8.26"
}
}
25 changes: 12 additions & 13 deletions packages/example-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,21 @@
"node": ">=8"
},
"dependencies": {
"@angular-redux/form": "latest",
"@angular-redux/router": "latest",
"@angular-redux/store": "latest",
"@angular/common": "^7.2.0",
"@angular/compiler": "^7.2.0",
"@angular/core": "^7.2.0",
"@angular/forms": "^7.2.0",
"@angular/http": "^7.2.0",
"@angular/platform-browser": "^7.2.0",
"@angular/platform-browser-dynamic": "^7.2.0",
"@angular/router": "^7.2.0",
"@types/webpack-env": "1.13.6",
"@angular-redux/form": "10.0.0",
"@angular-redux/router": "10.0.0",
"@angular-redux/store": "10.0.0",
"@angular/common": "^7.2.1",
"@angular/compiler": "^7.2.1",
"@angular/core": "^7.2.1",
"@angular/forms": "^7.2.1",
"@angular/http": "^7.2.1",
"@angular/platform-browser": "^7.2.1",
"@angular/platform-browser-dynamic": "^7.2.1",
"@angular/router": "^7.2.1",
"core-js": "^2.6.2",
"flux-standard-action": "^2.0.3",
"ramda": "^0.23.0",
"redux": "^4.0.1",
"redux": "^4.0.0",
"redux-logger": "^3.0.1",
"redux-observable": "^1.0.0",
"rxjs": "^6.3.3",
Expand Down
16 changes: 7 additions & 9 deletions packages/form/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ For the simplest use-cases, the API is very straightforward. Your template
would look something like this:

```html
<form connect="myForm">
<input type="text" name="address" ngControl ngModel />
</form>
<form connect="myForm">
<input type="text" name="address" ngControl ngModel />
</form>
```

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

```html
<form [connect]="['personalInfo', 'myForm']">
...
</form>
<form [connect]="['personalInfo', 'myForm']">...</form>
```

Note that ImmutableJS integration is provided seamlessly. If `personalInfo` is an
Expand Down Expand Up @@ -207,9 +205,9 @@ that element from the Redux state.
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.

```html
<form connect="myForm" [formGroup]="loginForm">
<input type="text" name="address" formControlName="firstName" />
</form>
<form connect="myForm" [formGroup]="loginForm">
<input type="text" name="address" formControlName="firstName" />
</form>
```

#### Troubleshooting
Expand Down
19 changes: 4 additions & 15 deletions packages/form/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@angular-redux/form",
"version": "9.0.0",
"version": "10.0.0",
"description": "Build Angular 2+ forms with Redux",
"author": "Chris Bond",
"license": "MIT",
Expand All @@ -25,25 +25,14 @@
"node": ">=8"
},
"peerDependencies": {
"@angular-redux/store": "^9.0.0",
"@angular-redux/store": "^10.0.0",
"@angular/core": "^7.0.0",
"@angular/forms": "^7.0.0",
"redux": "^4.0.0",
"rxjs": "^6.0.0"
},
"dependencies": {
"immutable": "3.8.1"
"immutable": "^4.0.0-rc.12"
},
"devDependencies": {
"@angular-redux/store": "9.0.0"
},
"main": "dist/bundles/angular-redux-form.umd.js",
"module": "dist/fesm5/angular-redux-form.js",
"es2015": "dist/fesm2015/angular-redux-form.js",
"esm5": "dist/esm5/angular-redux-form.js",
"esm2015": "dist/esm2015/angular-redux-form.js",
"fesm5": "dist/fesm5/angular-redux-form.js",
"fesm2015": "dist/fesm2015/angular-redux-form.js",
"typings": "dist/angular-redux-form.d.ts",
"metadata": "dist/angular-redux-form.metadata.json"
"main": "src/index.ts"
}
6 changes: 3 additions & 3 deletions packages/form/src/form-reducer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Iterable } from 'immutable';
import { Collection } from 'immutable';

import { Action } from 'redux';

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

export const defaultFormReducer = <RootState>(
initialState?: RootState | Iterable.Keyed<string, any>,
initialState?: RootState | Collection.Keyed<string, any>,
) => {
const reducer = (
state: RootState | Iterable.Keyed<string, any> | undefined = initialState,
state: RootState | Collection.Keyed<string, any> | undefined = initialState,
action: Action & { payload?: any },
) => {
switch (action.type) {
Expand Down
10 changes: 5 additions & 5 deletions packages/form/src/state.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Iterable, Map as ImmutableMap } from 'immutable';
import { isCollection, Map as ImmutableMap } from 'immutable';

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

Expand Down Expand Up @@ -31,7 +31,7 @@ export abstract class State {
for (const k of path) {
const parent = deepValue;

if (Iterable.isIterable(deepValue)) {
if (isCollection(deepValue)) {
const m = (deepValue as any) as ImmutableMap<string, any>;
if (typeof m.get === 'function') {
deepValue = m.get(k);
Expand Down Expand Up @@ -116,8 +116,8 @@ export abstract class State {
return typeof stateKey === 'number'
? new Array()
: Array.isArray(stateKey)
? ImmutableMap()
: new Object();
? ImmutableMap()
: new Object();
};

return parentOperations.update(
Expand Down Expand Up @@ -161,7 +161,7 @@ export abstract class State {
return operations;
};

if (Iterable.isIterable(object)) {
if (isCollection(object)) {
return metaOperations(
// Replace
(parent: any, key: number | string, value: K) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/form/src/tests.utilities.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { flushMicrotasks } from '@angular/core/testing';

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

for (const i of Object.keys(state)) {
newState[i] = Iterable.isIterable(state[i]) ? state[i].toJS() : state[i];
newState[i] = isCollection(state[i]) ? state[i].toJS() : state[i];
}

return newState;
Expand Down
17 changes: 3 additions & 14 deletions packages/router/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@angular-redux/router",
"version": "9.0.0",
"version": "10.0.0",
"description": "Keep your Angular 2+ router state in Redux.",
"author": "Dag Stuan",
"license": "MIT",
Expand All @@ -26,23 +26,12 @@
"node": ">=8"
},
"peerDependencies": {
"@angular-redux/store": "^9.0.0",
"@angular-redux/store": "^10.0.0",
"@angular/common": "^7.0.0",
"@angular/core": "^7.0.0",
"@angular/router": "^7.0.0",
"redux": "^4.0.0",
"rxjs": "^6.0.0"
},
"devDependencies": {
"@angular-redux/store": "9.0.0"
},
"main": "dist/bundles/angular-redux-router.umd.js",
"module": "dist/fesm5/angular-redux-router.js",
"es2015": "dist/fesm2015/angular-redux-router.js",
"esm5": "dist/esm5/angular-redux-router.js",
"esm2015": "dist/esm2015/angular-redux-router.js",
"fesm5": "dist/fesm5/angular-redux-router.js",
"fesm2015": "dist/fesm2015/angular-redux-router.js",
"typings": "dist/angular-redux-router.d.ts",
"metadata": "dist/angular-redux-router.metadata.json"
"main": "src/index.ts"
}
16 changes: 8 additions & 8 deletions packages/store/articles/action-creator-service.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,14 @@ import { RandomNumberService } from '../services/random-number';
selector: 'counter',
providers: [CounterActions, RandomNumberService],
template: `
<p>
Clicked: {{ counter$ | async }} times
<button (click)="actions.increment()">+</button>
<button (click)="actions.decrement()">-</button>
<button (click)="actions.incrementIfOdd()">Increment if odd</button>
<button (click)="actions.incrementAsync(2222)">Increment async</button>
<button (click)="actions.randomize()">Set to random number</button>
</p>
<p>
Clicked: {{ counter$ | async }} times
<button (click)="actions.increment()">+</button>
<button (click)="actions.decrement()">-</button>
<button (click)="actions.incrementIfOdd()">Increment if odd</button>
<button (click)="actions.incrementAsync(2222)">Increment async</button>
<button (click)="actions.randomize()">Set to random number</button>
</p>
`,
})
export class Counter {
Expand Down
13 changes: 6 additions & 7 deletions packages/store/articles/fractal-store.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ export const userComponentReducer = (state, action) =>
@Component({
selector: 'user',
template: `
<p>name: {{ name$ |async }}</p>
<p>name: {{ name$ | async }}</p>
<p>occupation: {{ occupation$ | async }}</p>
<p>lines of code: {{ loc$ | async }}</p>
   <button (click)=addCode(100)>Add 100 lines of code</button>
<button (click)="addCode(100)">Add 100 lines of code</button>
`,
})
export class UserComponent implements NgOnInit {
Expand Down Expand Up @@ -87,8 +87,7 @@ export class UserComponent implements NgOnInit {
```

```html
<user [userId]='alice'></user>
<user [userId]='bob'></user>
<user [userId]="alice"></user> <user [userId]="bob"></user>
```

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

## What about @select, @select$, @dispatch?
## What about @select, @select\$, @dispatch?

As of 6.5.0, the decorator interface has been expanded to support fractal
stores as well.
Expand All @@ -125,10 +124,10 @@ export const defaultToZero = (obs$: Observable<number>) =>
@Component({
selector: 'user',
template: `
<p>name: {{ name$ |async }}</p>
<p>name: {{ name$ | async }}</p>
<p>occupation: {{ occupation$ | async }}</p>
<p>lines of code: {{ loc$ | async }}</p>
   <button (click)=addCode(100)>Add 100 lines of code</button>
<button (click)="addCode(100)">Add 100 lines of code</button>
`,
})
@WithSubStore({
Expand Down
Loading