Skip to content

Commit f02afaa

Browse files
committed
build: github actions
1 parent cbbcc62 commit f02afaa

File tree

13 files changed

+391
-91
lines changed

13 files changed

+391
-91
lines changed

.github/workflows/nodejs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@ jobs:
1414
node-version: 12
1515
registry-url: https://registry.npmjs.org/
1616
- run: yarn install
17+
- run: yarn test
18+
- run: yarn build
1719
- run: npm publish --access public
1820
env:
1921
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ script:
1313
- npm run test:prod && npm run build
1414
after_success:
1515
- npm run travis-deploy-once "npm run report-coverage"
16-
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run travis-deploy-once "npm run deploy-docs"; fi
17-
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then npm run travis-deploy-once "npm run semantic-release"; fi
16+
- if [ "$TRAVIS_BRANCH" = "master" -a "$TRAVIS_PULL_REQUEST" = "false" ]; then
17+
npm run travis-deploy-once "npm run semantic-release"; fi
1818
branches:
1919
except:
2020
- /^v\d+\.\d+\.\d+$/

CONTRIBUTING.md

Lines changed: 0 additions & 17 deletions
This file was deleted.

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
_Next generation global state management for React, without the bloat._
44

5-
The idea of Freedux is to give you a single, immutable, strongly typed object
6-
tree that can be used to store and manage the state of your application. This is
7-
a similar concept to redux, but unlike redux, the Api is super simple and
8-
requires minimum set up code to use.
5+
Freedux gives you a single, immutable, strongly typed object tree that can be
6+
used to store and manage the state of your application. This is a similar
7+
concept to redux, but unlike redux, the Api is super simple and requires hardly
8+
any set up to start using.
99

1010
## Documentation
1111

12-
[Documentation Site](https://amized.github.io/freedux)
12+
[Documentation Site](https://amized.github.io/freedux/#/README)
1313

1414
## Features
1515

docs/README.md

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
# Freedux
2+
3+
_Next generation global state management for React, without the bloat._
4+
5+
Freedux gives you a single, immutable, strongly typed object tree that can be
6+
used to store and manage the state of your application. This is a similar
7+
concept to redux, but unlike redux, the Api is super simple and requires hardly
8+
any set up to start using.
9+
10+
## Features
11+
12+
- Lightweight - 5k zipped
13+
- 0 dependencies
14+
- Modern hooks based API
15+
- Render optimization
16+
- APIs for usage outside of React
17+
- State data stored as plain JS primitives and objects
18+
- Strongly typed
19+
20+
This project uses a fork from the
21+
[ts-object-path](https://github.com/Taras-Tymchiy/ts-object-path#readme)
22+
library.
23+
24+
## Install
25+
26+
```console
27+
npm install freedux
28+
```
29+
30+
## Usage
31+
32+
### 1. Create your store
33+
34+
```javascript
35+
import { createStore } from 'freedux';
36+
37+
// Define your initial state
38+
const initialState = {
39+
count: 0
40+
};
41+
42+
// Create your store to retrieve some hooks
43+
const { useListener, useSetter } = createStore(initialState);
44+
```
45+
46+
### 2. Listen to state changes
47+
48+
Use the `useListener` hook to select and inject state into your component:
49+
50+
```javascript
51+
const CountDisplay = () => {
52+
const count = useListener(state => state.count);
53+
return <>{count}</>;
54+
};
55+
```
56+
57+
### 3. Make updates
58+
59+
Use the `useSetter` hook to update your store. You pass a function that returns
60+
the property you want to update. The hook returns a setter function to do that
61+
work:
62+
63+
```javascript
64+
const CountButton = () => {
65+
const setCount = useSetter(state => state.count);
66+
return (
67+
<button
68+
onClick={() => {
69+
setCount(5);
70+
}}
71+
>
72+
Set the counter to 5
73+
</button>
74+
);
75+
};
76+
```
77+
78+
Those are the basics. Check out the [example](example.md) and
79+
[API docs](store.md), and happy coding!

docs/_sidebar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- About
22

3-
- [Introduction](introduction.md)
3+
- [Introduction](README.md)
44
- [Example](example.md)
55

66
- API

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
loadSidebar: true,
1818
subMaxLevel: 2,
1919
auto2top: true,
20-
homepage: 'introduction.md',
20+
homepage: 'README.md',
2121
}
2222
</script>
2323
<script src="//unpkg.com/docsify/lib/docsify.min.js"></script>

0 commit comments

Comments
 (0)