redux-fluent
Advanced tools
Comparing version 0.4.0 to 0.5.1
12
index.js
@@ -1,7 +0,7 @@ | ||
'use strict'; | ||
// eslint-disable-next-line spaced-comment | ||
/// <reference path="./dist/index.d.ts" /> | ||
if (process.env.NODE_ENV === 'production') { | ||
module.exports = require('./build/redux-fluent.production.js'); | ||
} else { | ||
module.exports = require('./build/redux-fluent.development.js'); | ||
} | ||
// eslint-disable-next-line import/no-dynamic-require | ||
module.exports = require( | ||
`./dist/redux-fluent.${process.env.NODE_ENV === 'production' ? 'production' : 'development'}.js`, | ||
); |
116
package.json
{ | ||
"name": "redux-fluent", | ||
"license": "ISC", | ||
"version": "0.4.0", | ||
"homepage": "https://github.com/Code-Y/redux-fluent#readme", | ||
"description": "Tiny and eloquent way to manage a redux-like state manager", | ||
"author": "Code-Y (https://github.com/Code-Y)", | ||
"contributors": [ | ||
"Luca Pau <luca.pau82@gmail.com> (https://github.com/Lughino)", | ||
"Giuseppe Mandato <gius.mand.developer@gmail.com> (https://github.com/hitmands)" | ||
"license": "MIT", | ||
"version": "0.5.1", | ||
"homepage": "https://github.com/hitmands/redux-fluent#readme", | ||
"description": "Enjoy Redux - Less Scaffolding / More Functional", | ||
"author": "Giuseppe Mandato (https://github.com/hitmands)", | ||
"sideEffects": false, | ||
"main": "index.js", | ||
"types": "dist/redux-fluent.d.ts", | ||
"files": [ | ||
"/dist", | ||
"node_modules", | ||
"CHANGELOG.md", | ||
"LICENSE", | ||
"index.js" | ||
], | ||
"keywords": [ | ||
"redux", | ||
"ngrx-store", | ||
"typescript", | ||
"state-management" | ||
], | ||
"main": "index.js", | ||
"scripts": { | ||
"lint": "eslint *.js src/**/*.ts", | ||
"build": "webpack --config webpack.config.js", | ||
"test": "jest --coverage", | ||
"build": "npm run webpack -- --env.name production", | ||
"webpack": "webpack --config webpack.config.js", | ||
"cz": "git-cz" | ||
"release": "standard-version -m \"chore(release): %s [skip ci]\"" | ||
}, | ||
"husky": { | ||
"hooks": { | ||
"commit-msg": "commitlint -E HUSKY_GIT_PARAMS" | ||
} | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/Code-Y/redux-fluent.git" | ||
"url": "git+https://github.com/hitmands/redux-fluent.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/Code-Y/redux-fluent/issues" | ||
"url": "https://github.com/hitmands/redux-fluent/issues" | ||
}, | ||
"devDependencies": { | ||
"@types/jest": "^21.1.9", | ||
"codeclimate-test-reporter": "^0.5.0", | ||
"commitizen": "^2.9.6", | ||
"cz-conventional-changelog": "^2.1.0", | ||
"jest": "^21.2.1", | ||
"ts-jest": "^21.2.4", | ||
"ts-loader": "^3.2.0", | ||
"tslint": "^5.8.0", | ||
"tslint-config-airbnb": "^5.4.2", | ||
"tslint-loader": "^3.5.3", | ||
"typescript": "^2.6.2", | ||
"webpack": "^3.10.0" | ||
"contributors": [], | ||
"keywords": [ | ||
"redux", | ||
"ngrx-store", | ||
"state-management", | ||
"typings" | ||
], | ||
"publishConfig": { | ||
"access": "public" | ||
}, | ||
"jest": { | ||
"transform": { | ||
"^.+\\.tsx?$": "<rootDir>/node_modules/ts-jest/preprocessor.js" | ||
}, | ||
"testRegex": "(/__tests__/.*|(\\.|/)(test|spec))\\.(jsx?|tsx?)$", | ||
"moduleFileExtensions": [ | ||
"ts", | ||
"tsx", | ||
"js", | ||
"jsx", | ||
"json" | ||
] | ||
"peerDependencies": { | ||
"flux-standard-action": "^2.0.3", | ||
"redux": "^4.0.1" | ||
}, | ||
"private": false, | ||
"publishConfig": { | ||
"access": "public" | ||
"devDependencies": { | ||
"@commitlint/cli": "^7.5.2", | ||
"@commitlint/config-conventional": "^7.5.0", | ||
"@commitlint/travis-cli": "^7.5.2", | ||
"@types/chai": "^4.1.6", | ||
"@types/jest": "^23.3.2", | ||
"@types/node": "^10.12.0", | ||
"@types/ramda": "^0.25.39", | ||
"@types/sinon": "^5.0.2", | ||
"@types/sinon-chai": "^3.2.0", | ||
"@typescript-eslint/eslint-plugin": "^1.4.2", | ||
"@typescript-eslint/parser": "^1.4.2", | ||
"awesome-typescript-loader": "^5.2.1", | ||
"chai": "^4.1.2", | ||
"eslint": "^5.14.1", | ||
"eslint-config-airbnb-base": "^13.1.0", | ||
"eslint-loader": "^2.1.1", | ||
"eslint-plugin-chai-friendly": "^0.4.1", | ||
"eslint-plugin-import": "^2.14.0", | ||
"eslint-plugin-jest": "^21.22.1", | ||
"flux-standard-action": "^2.0.3", | ||
"husky": "^1.3.1", | ||
"jest": "^23.6.0", | ||
"ramda": "^0.25.0", | ||
"redux": "^4.0.1", | ||
"sinon": "^6.3.4", | ||
"sinon-chai": "^3.2.0", | ||
"standard-version": "^5.0.1", | ||
"ts-jest": "^23.10.4", | ||
"typescript": "^3.1.3", | ||
"webpack": "^4.19.1", | ||
"webpack-cli": "^3.1.0" | ||
} | ||
} |
@@ -1,6 +0,71 @@ | ||
# redux-fluent | ||
[![Build Status](https://travis-ci.org/Code-Y/redux-fluent.svg?branch=master)](https://travis-ci.org/Code-Y/redux-fluent) | ||
[![Code Climate](https://codeclimate.com/github/Code-Y/redux-fluent/badges/gpa.svg)](https://codeclimate.com/github/Code-Y/redux-fluent) | ||
[![Test Coverage](https://api.codeclimate.com/v1/badges/02e8b0d9ba383c19ae50/test_coverage)](https://codeclimate.com/github/Code-Y/redux-fluent/test_coverage) | ||
# <a href='https://github.com/hitmands/redux-fluent'><img src='https://raw.githubusercontent.com/hitmands/redux-fluent/master/redux-fluent-logo.png' height='60' alt='Redux Fluent' aria-label='https://github.com/hitmands/redux-fluent' /></a> redux-fluent | ||
[![Build Status](https://travis-ci.org/hitmands/redux-fluent.svg?branch=master)](https://travis-ci.org/hitmands/redux-fluent) | ||
[![npm version](https://img.shields.io/npm/v/redux-fluent.svg)](https://www.npmjs.com/package/redux-fluent) | ||
[![License](https://img.shields.io/npm/l/redux-fluent.svg)](https://github.com/hitmands/redux-fluent/blob/master/LICENSE) | ||
[![Conventional Commits](https://img.shields.io/badge/Conventional%20Commits-1.0.0-yellow.svg)](https://conventionalcommits.org) | ||
[![npm downloads](https://img.shields.io/npm/dm/redux-fluent.svg)](https://www.npmjs.com/package/redux-fluent) | ||
[![Maintainability](https://api.codeclimate.com/v1/badges/474e33d67c5fa25495ec/maintainability)](https://codeclimate.com/github/hitmands/redux-fluent/maintainability) | ||
[![Test Coverage](https://api.codeclimate.com/v1/badges/474e33d67c5fa25495ec/test_coverage)](https://codeclimate.com/github/hitmands/redux-fluent/test_coverage) | ||
Tiny and eloquent way to manage a redux-like state manager | ||
Tiny and eloquent way to manage a redux-like state manager (*~3K*, dependencies free, definitions included). | ||
[Try it out on RunKit](https://runkit.com/hitmands/redux-fluent-playground) | ||
## Documentation | ||
## Motivation | ||
**[Redux](https://redux.js.org/)** is great, every recent web application has most likely been built on top of it. **How can we make it even better?** | ||
- **λ Go Functional**, Everything is a function and reducers are built by function composition rather than piling up if and switch-case statements: *Let's introduce Redux Fluent Reducers*. | ||
- **Reducers at scale**, due to being handling multiple actions, reducers tend to grow and become difficult to maintain: *Let's introduce Redux Fluent Action Handlers*. | ||
- **Less boilerplate**, Flux architecture is usually verbose and some of their concepts, such as `Action`, `Action Type` and `Action Creator` could all be implemented in a single entity: *Let's introduce Redux Fluent Actions*. | ||
- **FSA compliance**, FSA Actions may have a `error: boolean` field, which indicates whether the action represents a failure or not. Respecting this pattern leads to a series of if statements inside reducers, compromising both readability and maintainability, so the community normally tends to split error and failures into two separate actions (eg: `ADD_TODO_SUCCESS` and `ADD_TODO_ERROR`) which reduces cognitive complexity on one hand but produces even more boilerplate on the other. *Let's embrace FSA and abstract error handling with filterable action handlers*. | ||
## Installation | ||
```bash | ||
yarn add redux-fluent | ||
``` | ||
## Getting Started | ||
```javascript | ||
/** todos.actions.js **/ | ||
import { createAction } from 'redux-fluent'; | ||
export const addTodo = createAction('todos | add'); | ||
``` | ||
```javascript | ||
/** todos.reducer.js **/ | ||
import { createReducer, ofType } from 'redux-fluent'; | ||
import * as actions from './todos.actions.js'; | ||
const addTodo = (state, { payload }) => state.concat(payload); | ||
export const todos = createReducer('todos') | ||
.actions( | ||
ofType(actions.addTodo).map(addTodo), | ||
/* and so on */ | ||
) | ||
.default(() => []); | ||
``` | ||
```javascript | ||
/** application.js **/ | ||
import { createStore } from 'redux'; | ||
import { combineReducers } from 'redux-fluent'; | ||
import * as actions from './todos.actions.js'; | ||
import { todos } from './todos.reducer.js'; | ||
const rootReducer = combineReducers(todos, ...); | ||
const store = createStore(rootReducer); | ||
store.getState(); // { todos: [] } | ||
store.dispatch(actions.addTodo('1')); | ||
store.getState(); // { todos: [1] } | ||
``` |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
62078
16
407
72
2
31
2
2
1