Skip to content

Commit

Permalink
upgrade dependencies, upgrade to rxjs5
Browse files Browse the repository at this point in the history
  • Loading branch information
bcherny committed Apr 1, 2018
1 parent 357c13b commit 85ee792
Show file tree
Hide file tree
Showing 7 changed files with 3,562 additions and 3,620 deletions.
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
"typescript.tsdk": "node_modules/typescript/lib",
"cSpell.words": [
"undux"
]
}
16 changes: 13 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,24 @@

> Dead simple state management for React
## Install
## Install (with RxJS v5 - recommended)

```sh
# Using Yarn:
yarn add undux
yarn add undux rxjs

# Or, using NPM:
npm install undux --save
npm install undux rxjs --save
```

## Install (with RxJS v4)

```sh
# Using Yarn:
yarn add undux@^3.2.1

# Or, using NPM:
npm install undux@^3.2.1 --save
```

## Design Goals
Expand Down
24 changes: 13 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "undux",
"version": "3.2.1",
"version": "4.0.0",
"description": "Dead simple state management for React",
"main": "dist/src/index.js",
"typings": "dist/src/index.d.ts",
Expand All @@ -18,34 +18,36 @@
"build": "npm run clean && npm run lint && tsc -d && cp src/index.js.flow dist/src/index.js.flow && flow check test/test.flow.js",
"clean": "shx rm -rf dist",
"format": "prettier --write src/**/* test/**/*",
"lint": "tslint src/**/*",
"lint": "tslint -p tsconfig.json src/**/*",
"prepublishOnly": "npm run build",
"pretest": "npm run build",
"tdd": "concurrently -k \"tsc -w\" \"ava -w\"",
"test": "ava && flow check"
},
"dependencies": {
"typed-rx-emitter": "^0.3.1"
"typed-rx-emitter": "1.0.0"
},
"devDependencies": {
"@types/jsdom": "^11.0.4",
"@types/react": "^16.0.40",
"@types/react": "^16.1.0",
"@types/react-dom": "^16.0.4",
"ava": "^0.25.0",
"concurrently": "^3.5.1",
"flow-bin": "^0.66.0",
"flow-bin": "^0.69.0",
"immutable": "^3.8.2",
"jsdom": "^11.6.2",
"jsdom": "^11.7.0",
"prettier": "^1.11.1",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"react": "^16.3.0",
"react-dom": "^16.3.0",
"rxjs": "^5.5.8",
"shx": "^0.2.2",
"tslint": "^5.9.1",
"tslint-react": "^3.4.0",
"typescript": "^2.7.2"
"tslint-react": "^3.5.1",
"typescript": "^2.8.1"
},
"peerDependencies": {
"react": "^16.0.0"
"react": ">=16.0.0",
"rxjs": ">=5.0.0"
},
"keywords": [
"redux",
Expand Down
7 changes: 4 additions & 3 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as RxJS from 'rxjs'
import { Emitter } from 'typed-rx-emitter'

export type Undux<Actions extends object> = {
Expand All @@ -23,10 +24,10 @@ export class Store<Actions extends object> extends Emitter<Actions> {
})
}
}
before<K extends keyof Actions>(key: K) {
before<K extends keyof Actions>(key: K): RxJS.Observable<Undux<Actions>[K]> {
return this.befores.on(key)
}
beforeAll<K extends keyof Actions>() {
beforeAll<K extends keyof Actions>(): RxJS.Observable<Undux<Actions>[keyof Actions]> {
return this.befores.all()
}
get<K extends keyof Actions>(key: K) {
Expand All @@ -45,4 +46,4 @@ export function createStore<Actions extends object>(initialState: Actions) {
export type Plugin = <Actions extends object>(store: Store<Actions>) => Store<Actions>

export * from './plugins/logger'
export * from './react'
export * from './react'
6 changes: 3 additions & 3 deletions src/react.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react'
import { ComponentClass } from 'react'
import { IDisposable } from 'rx'
import { Subscription } from 'rxjs'
import { Store } from './'
import { equals, getDisplayName } from './utils'

Expand All @@ -16,7 +16,7 @@ export function connect<Actions extends object>(store: Store<Actions>) {
Component: React.ComponentType<PropsWithStore>
): React.ComponentClass<Omit<PropsWithStore, 'store'>> {

let state: IDisposable[][]
let state: Subscription[][]

let Class: ComponentClass<Omit<PropsWithStore, 'store'>> = class extends React.Component<Omit<PropsWithStore, 'store'>> {
componentDidMount() {
Expand All @@ -38,7 +38,7 @@ export function connect<Actions extends object>(store: Store<Actions>) {
})
}
componentWillUnmount() {
state.forEach(_ => _.forEach(_ => _.dispose()))
state.forEach(_ => _.forEach(_ => _.unsubscribe()))
}
render() {
return <Component {...this.props} store={store} />
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"newLine": "LF",
"outDir": "dist",
"preserveConstEnums": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"target": "es5"
Expand Down
Loading

0 comments on commit 85ee792

Please sign in to comment.