Skip to content

Commit 74b19e8

Browse files
committed
chore: update README add CI tests
1 parent 2a68adf commit 74b19e8

File tree

2 files changed

+44
-50
lines changed

2 files changed

+44
-50
lines changed

.github/workflows/test.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Tests
2+
3+
on: [push, pull_request, workflow_dispatch]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: pnpm/action-setup@v4
12+
- uses: actions/setup-node@v4
13+
with:
14+
node-version: '18'
15+
cache: 'pnpm'
16+
17+
- name: Install packages
18+
run: pnpm install --frozen-lockfile
19+
20+
- name: Run tests
21+
run: pnpm test

packages/vue-redux/README.md

+23-50
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,40 @@
33
Official Vue bindings for [Redux](https://github.com/reduxjs/redux).
44
Performant and flexible.
55

6+
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/reduxjs/vue-redux/test.yml?style=flat-square) [![npm version](https://img.shields.io/npm/v/@reduxjs/vue.svg?style=flat-square)](https://www.npmjs.com/package/@reduxjs/vue)
7+
[![npm downloads](https://img.shields.io/npm/dm/@reduxjs/vue.svg?style=flat-square)](https://www.npmjs.com/package/@reduxjs/vue)
8+
69
> [!WARNING]
710
> This package is in alpha and is rapidly developing.
811
9-
# Features
12+
## Installation
13+
14+
Vue Redux requires **Vue 3 or later**.
15+
16+
To use React Redux with your Vue app, install it as a dependency:
17+
18+
```bash
19+
# If you use npm:
20+
npm install @reduxjs/vue-redux
1021

11-
- Compatible with Vue 3+
12-
- [Redux Toolkit](https://redux-toolkit.js.org/) support
22+
# Or if you use Yarn:
23+
yarn add @reduxjs/vue-redux
24+
```
25+
26+
You'll also need to [install Redux](https://redux.js.org/introduction/installation) and [set up a Redux store](https://redux.js.org/recipes/configuring-your-store/) in your app.
27+
28+
This assumes that you’re using [npm](http://npmjs.com/) package manager
29+
with a module bundler like [Webpack](https://webpack.js.org/) or
30+
[Browserify](http://browserify.org/) to consume [CommonJS
31+
modules](https://webpack.js.org/api/module-methods/#commonjs).
1332

1433
# Usage
1534

1635
The following Vue component works as-expected:
1736

1837
```vue
1938
<script setup lang="ts">
20-
import { useSelector, useDispatch } from 'vue-redux'
39+
import { useSelector, useDispatch } from '@reduxjs/vue-redux'
2140
import { decrement, increment } from './store/counter-slice'
2241
import { RootState } from './store'
2342
@@ -39,49 +58,3 @@ The following Vue component works as-expected:
3958
</div>
4059
</template>
4160
```
42-
43-
Assuming the following `store.ts` file is present:
44-
45-
```typescript
46-
import { PayloadAction, configureStore, createSlice } from '@reduxjs/toolkit'
47-
48-
export interface CounterState {
49-
value: number
50-
}
51-
52-
const initialState: CounterState = {
53-
value: 0,
54-
}
55-
56-
export const counterSlice = createSlice({
57-
name: 'counter',
58-
initialState,
59-
reducers: {
60-
increment: (state) => {
61-
// Redux Toolkit allows us to write "mutating" logic in reducers. It
62-
// doesn't actually mutate the state because it uses the Immer library,
63-
// which detects changes to a "draft state" and produces a brand new
64-
// immutable state based off those changes
65-
state.value += 1
66-
},
67-
decrement: (state) => {
68-
state.value -= 1
69-
},
70-
incrementByAmount: (state, action: PayloadAction<number>) => {
71-
state.value += action.payload
72-
},
73-
},
74-
})
75-
76-
// Action creators are generated for each case reducer function
77-
export const { increment, decrement, incrementByAmount } = counterSlice.actions
78-
79-
export const store = configureStore({
80-
reducer: {
81-
counter: counterSlice.reducer,
82-
},
83-
})
84-
85-
export type RootState = ReturnType<typeof store.getState>
86-
export type AppDispatch = typeof store.dispatch
87-
```

0 commit comments

Comments
 (0)