Comparing version 0.19.9 to 0.19.10
{ | ||
"default": "mariusandra/kea-example" | ||
"default": "keajs/kea-example" | ||
} |
@@ -9,3 +9,9 @@ # Change Log | ||
## Uncommitted | ||
### 0.19-0 | ||
## 0.19.9 - 2017-07-24 | ||
This was a big release. A lot of code changed and we now have many deprecations which should be removed in the next releases to make the bundle smaller. | ||
Before upgrading to any newer version (0.20, etc), make sure your code works fine with 0.19. | ||
### Changed | ||
- Deprecated: `run` and `cancelled` replaced with `start` and `stop` in Saga classes | ||
@@ -15,2 +21,4 @@ - Added inline kea | ||
- Use `this.actions` instead of `this.props.actions` in components | ||
- Deprecated the old Logic and Saga classes in favor of the unified `kea({})` version. No warnings yet. | ||
- Added tests for the `kea({})` version. | ||
@@ -23,12 +31,12 @@ ## 0.18.0 - 2017-05-20 | ||
### Changed | ||
- [PR4](https://github.com/mariusandra/kea/pull/4). Add action.meta to reducer mapping. | ||
- [PR4](https://github.com/mariusandra/kea/pull/4). Upgrade takeEvery, takeLatest usage for redux-saga >= 0.14 compatibility. | ||
- [PR4](https://github.com/keajs/kea/pull/4). Add action.meta to reducer mapping. | ||
- [PR4](https://github.com/keajs/kea/pull/4). Upgrade takeEvery, takeLatest usage for redux-saga >= 0.14 compatibility. | ||
## 0.17.0 - 2017-01-13 | ||
### Changed | ||
- [BREAKING] The propType is now the 3rd element in the selector array. [See here how to refactor.](https://github.com/mariusandra/kea-example/commit/5df64d6c2dc3674964cc987804a8535678078103#diff-44518ef03bc2b98deccc270f728518c3) | ||
- [BREAKING] The propType is now the 3rd element in the selector array. [See here how to refactor.](https://github.com/keajs/kea-example/commit/5df64d6c2dc3674964cc987804a8535678078103#diff-44518ef03bc2b98deccc270f728518c3) | ||
## 0.16.0 - 2017-01-13 | ||
### Changed | ||
- Added `@connect` and `@initLogic` decorators. Reverse the steps [here](https://github.com/mariusandra/kea/blob/master/docs/no-decorators.md) to upgrade. | ||
- Added `@connect` and `@initLogic` decorators. Reverse the steps [here](https://github.com/keajs/kea/blob/master/docs/no-decorators.md) to upgrade. | ||
@@ -47,3 +55,3 @@ ## 0.15.4 - 2016-12-12 | ||
### Changed | ||
- Deprecated `addSelector` in favor of the new easier to read format. [See here](https://github.com/mariusandra/kea-example/commit/241d30faf8dd6d631d5d891ae3ebc3adc1c3fac3) for an example. | ||
- Deprecated `addSelector` in favor of the new easier to read format. [See here](https://github.com/keajs/kea-example/commit/241d30faf8dd6d631d5d891ae3ebc3adc1c3fac3) for an example. | ||
@@ -64,5 +72,5 @@ ## 0.13.0 - 2016-12-05 | ||
- [BREAKING] Removed dependency on redux-act | ||
- [BREAKING] Changed format for Logic actions. Now you don't need to run the redux-act createAction() anymore and no description is needed. See the example in README.md or [this commit](https://github.com/mariusandra/kea/commit/b2b9f9037af2d1ab5beba139fdb9b8cb210f98fa) for the new format. | ||
- [BREAKING] Changed format for Logic actions. Now you don't need to run the redux-act createAction() anymore and no description is needed. See the example in README.md or [this commit](https://github.com/keajs/kea/commit/b2b9f9037af2d1ab5beba139fdb9b8cb210f98fa) for the new format. | ||
- Removed deprecated createLogic() function | ||
- Exposed functions `createAction`, `createActions`, `createReducer` | ||
- Changed format of `type` to be more readable |
@@ -31,2 +31,12 @@ 'use strict'; | ||
function warnIfUndefinedActionCreator(object, property) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (object.reducer.undefined !== undefined) { | ||
console.warn('A reducer with the property "' + property + '" is waiting for an action where its key is not defined.'); | ||
} | ||
} | ||
return object; | ||
} | ||
// create reducer function from such an object { [action]: (state, payload) => state } | ||
@@ -111,7 +121,7 @@ function createReducer(mapping, defaultValue) { | ||
// s = [ value, type, options, reducer ] | ||
reducers[keys[i]] = Object.assign({ | ||
reducers[keys[i]] = warnIfUndefinedActionCreator(Object.assign({ | ||
value: s[0], | ||
type: s[1], // proptype | ||
reducer: s[3] || s[2] | ||
}, s[3] ? s[2] : {}); | ||
}, s[3] ? s[2] : {}), keys[i]); | ||
} | ||
@@ -118,0 +128,0 @@ } |
{ | ||
"name": "kea", | ||
"version": "0.19.9", | ||
"version": "0.19.10", | ||
"description": "Smart front-end architecture", | ||
@@ -11,8 +11,8 @@ "author": "Marius Andra", | ||
"type": "git", | ||
"url": "git+https://github.com/mariusandra/kea.git" | ||
"url": "git+https://github.com/keajs/kea.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/mariusandra/kea/issues" | ||
"url": "https://github.com/keajs/kea/issues" | ||
}, | ||
"homepage": "https://github.com/mariusandra/kea#readme", | ||
"homepage": "https://github.com/keajs/kea#readme", | ||
"bin": { | ||
@@ -19,0 +19,0 @@ "kea": "lib/cli/kea.js", |
@@ -10,9 +10,11 @@  | ||
Open the [documentation](https://kea.js.org/) (AKA demo app) and [view its source on GitHub](https://github.com/mariusandra/kea-example). | ||
Open the [documentation](https://kea.js.org/) (AKA demo app) and [view its source on GitHub](https://github.com/keajs/kea-website). | ||
In the documentation you will find [**several examples with source**](https://kea.js.org/). Check it out! | ||
No, really, [check out the docs](https://kea.js.org/)! | ||
# The basics | ||
You create and connect kea logic stores to your components like this: | ||
You create and connect kea **logic stores** to your components like this: | ||
@@ -65,3 +67,3 @@ ```jsx | ||
Inline kea also supports Sagas. They will be started and terminated together with your component! Each instance of your component runs its own sagas! | ||
Kea logic stores also supports Sagas. They will be started and terminated together with your component! Each instance of your component runs its own sagas! | ||
@@ -183,3 +185,3 @@ ```jsx | ||
If you only wish to import some properties and actions from your logic stores, use the `@connect` decorator or add `connect: { props: [], actions: [] }` inside `@kea({})`, like so: | ||
If you only wish to import some properties and actions from your logic stores, use the `@connect` decorator or add `connect: { props: [], actions: [] }` inside `@kea({})`, like so: | ||
@@ -225,4 +227,5 @@ ```jsx | ||
const reducers = combineReducers({ | ||
routing: routerReducer, | ||
scenes: keaReducer('scenes') // add this | ||
scenes: keaReducer('scenes'), // add this | ||
// other reducers | ||
// e.g. routing: routerReducer, | ||
}) | ||
@@ -233,3 +236,4 @@ | ||
applyMiddleware(sagaMiddleware), | ||
applyMiddleware(routerMiddleware(browserHistory)) | ||
// other middleware | ||
// e.g. applyMiddleware(routerMiddleware(browserHistory)) | ||
)(createStore) | ||
@@ -265,2 +269,4 @@ | ||
homepageLogic.selectors === { name: (state) => state.scenes.homepage.index.name, capitalizedName: ... } | ||
homepageLogic.saga === function * () { ... } | ||
``` | ||
@@ -270,6 +276,6 @@ | ||
Inline this inside `kea({})` or use the separate `createSaga({})` helper to create sagas: | ||
You may also create sagas and connect other actions using `kea({})`: | ||
```js | ||
import { createSaga } from 'kea' | ||
import { kea } from 'kea' | ||
@@ -279,3 +285,3 @@ import sceneLogic from '~/scenes/homepage/logic' | ||
export default createSaga({ | ||
export default kea({ | ||
// pull in actions from logic stores | ||
@@ -294,6 +300,6 @@ actions: () => ([ | ||
// bind some actions to worker functions | ||
takeEvery: ({ actions }) => ({ | ||
[actions.updateName]: this.nameLogger, | ||
[actions.increaseAge]: this.ageLogger, | ||
[actions.decreaseAge]: this.ageLogger | ||
takeEvery: ({ actions, workers }) => ({ | ||
[actions.updateName]: workers.nameLogger, | ||
[actions.increaseAge]: workers.ageLogger, | ||
[actions.decreaseAge]: workers.ageLogger | ||
}), | ||
@@ -332,12 +338,14 @@ // also available: takeLatest | ||
// on every updateName | ||
nameLogger: function * (action) { | ||
const { name } = action.payload | ||
console.log(`The name changed to: ${name}!`) | ||
}, | ||
workers: { | ||
// on every updateName | ||
nameLogger: function * (action) { | ||
const { name } = action.payload | ||
console.log(`The name changed to: ${name}!`) | ||
}, | ||
// on every increaseAge, decreaseAge | ||
ageLogger: function * (action) { | ||
const age = yield sceneLogic.get('age') | ||
console.log(`The age changed to: ${age}!`) | ||
// on every increaseAge, decreaseAge | ||
ageLogger: function * (action) { | ||
const age = yield sceneLogic.get('age') | ||
console.log(`The age changed to: ${age}!`) | ||
} | ||
} | ||
@@ -352,5 +360,5 @@ }) | ||
You can use all the logic store reducers and sagas individually in your existing application. | ||
You can use all of the above individually in your existing application. | ||
If, however, you favor convenience, you may combine them into scenes. | ||
If you wish, you may combine them into scenes. | ||
@@ -383,6 +391,6 @@ Scenes are defined in `scene.js` files like so: | ||
homepageScene.saga === function * () { ... } // start the scene sagas in parallel | ||
homepageScene.saga === function * () { ... } // start all the scene sagas in parallel | ||
``` | ||
or plug it into the kea-logic routing helpers. | ||
or plug it into the kea routing helpers. | ||
@@ -473,3 +481,3 @@ # Routing | ||
Open the [demo app](http://example.kea.rocks/) and [browse its code](https://github.com/mariusandra/kea-example). | ||
Open the [docs](http://kea.js.org/) and [browse its code](https://github.com/keajs/kea-website). | ||
@@ -476,0 +484,0 @@ To run the same example app on your machine, just type these commands: |
@@ -18,2 +18,12 @@ import { combineReducers } from 'redux' | ||
function warnIfUndefinedActionCreator (object, property) { | ||
if (process.env.NODE_ENV !== 'production') { | ||
if (object.reducer.undefined !== undefined) { | ||
console.warn(`A reducer with the property "${property}" is waiting for an action where its key is not defined.`) | ||
} | ||
} | ||
return object | ||
} | ||
// create reducer function from such an object { [action]: (state, payload) => state } | ||
@@ -89,7 +99,7 @@ export function createReducer (mapping, defaultValue) { | ||
// s = [ value, type, options, reducer ] | ||
reducers[keys[i]] = Object.assign({ | ||
reducers[keys[i]] = warnIfUndefinedActionCreator(Object.assign({ | ||
value: s[0], | ||
type: s[1], // proptype | ||
reducer: s[3] || s[2] | ||
}, s[3] ? s[2] : {}) | ||
}, s[3] ? s[2] : {}), keys[i]) | ||
} | ||
@@ -96,0 +106,0 @@ } |
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
313245
7819
492
6