Skip to content

Commit de188de

Browse files
committed
chore: update README, add CI
1 parent dab7c2d commit de188de

File tree

6 files changed

+48
-55
lines changed

6 files changed

+48
-55
lines changed

.github/workflows/test.yml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
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: actions/setup-node@v4
12+
with:
13+
node-version: '18'
14+
cache: 'npm'
15+
16+
- name: Install packages
17+
run: npm ci
18+
19+
- name: Run tests
20+
run: npm test

projects/angular-redux/README.md

+24-51
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,41 @@
33
Official Angular bindings for [Redux](https://github.com/reduxjs/redux).
44
Performant and flexible.
55

6+
7+
![GitHub Workflow Status](https://img.shields.io/github/actions/workflow/status/reduxjs/angular-redux/test.yml?style=flat-square) [![npm version](https://img.shields.io/npm/v/@reduxjs/angular.svg?style=flat-square)](https://www.npmjs.com/package/@reduxjs/angular)
8+
[![npm downloads](https://img.shields.io/npm/dm/@reduxjs/angular.svg?style=flat-square)](https://www.npmjs.com/package/@reduxjs/angular)
9+
610
> [!WARNING]
711
> This package is in alpha and is rapidly developing.
812
9-
# Features
13+
## Installation
14+
15+
Angular Redux requires **Angular 17.3 or later**.
1016

11-
- Compatible with Angular 18+
12-
- [Signals](https://angular.dev/guide/signals) support
13-
- [Redux Toolkit](https://redux-toolkit.js.org/) support
17+
To use React Redux with your Angular app, install it as a dependency:
18+
19+
```bash
20+
# If you use npm:
21+
npm install @reduxjs/angular-redux
22+
23+
# Or if you use Yarn:
24+
yarn add @reduxjs/angular-redux
25+
```
26+
27+
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.
28+
29+
This assumes that you’re using [npm](http://npmjs.com/) package manager
30+
with a module bundler like [Webpack](https://webpack.js.org/) or
31+
[Browserify](http://browserify.org/) to consume [CommonJS
32+
modules](https://webpack.js.org/api/module-methods/#commonjs).
1433

1534
# Usage
1635

1736
The following Angular component works as-expected:
1837

1938
```angular-ts
2039
import { Component } from '@angular/core'
21-
import {injectSelector, injectDispatch} from "angular-redux";
40+
import {injectSelector, injectDispatch} from "@reduxjs/angular-redux";
2241
import { decrement, increment, RootState } from './store/counter-slice'
2342
2443
@Component({
@@ -52,49 +71,3 @@ export class AppComponent {
5271
decrement = decrement
5372
}
5473
```
55-
56-
Assuming the following `store.ts` file is present:
57-
58-
```typescript
59-
import { PayloadAction, configureStore, createSlice } from '@reduxjs/toolkit'
60-
61-
export interface CounterState {
62-
value: number
63-
}
64-
65-
const initialState: CounterState = {
66-
value: 0,
67-
}
68-
69-
export const counterSlice = createSlice({
70-
name: 'counter',
71-
initialState,
72-
reducers: {
73-
increment: (state) => {
74-
// Redux Toolkit allows us to write "mutating" logic in reducers. It
75-
// doesn't actually mutate the state because it uses the Immer library,
76-
// which detects changes to a "draft state" and produces a brand new
77-
// immutable state based off those changes
78-
state.value += 1
79-
},
80-
decrement: (state) => {
81-
state.value -= 1
82-
},
83-
incrementByAmount: (state, action: PayloadAction<number>) => {
84-
state.value += action.payload
85-
},
86-
},
87-
})
88-
89-
// Action creators are generated for each case reducer function
90-
export const { increment, decrement, incrementByAmount } = counterSlice.actions
91-
92-
export const store = configureStore({
93-
reducer: {
94-
counter: counterSlice.reducer,
95-
},
96-
})
97-
98-
export type RootState = ReturnType<typeof store.getState>
99-
export type AppDispatch = typeof store.dispatch
100-
```

projects/angular-redux/src/lib/inject-dispatch.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export function createDispatchInjection<
7272
*
7373
* @example
7474
*
75-
* import { injectDispatch } from 'angular-redux'
75+
* import { injectDispatch } from '@reduxjs/angular-redux'
7676
*
7777
* @Component({
7878
* selector: 'example-component',

projects/angular-redux/src/lib/inject-selector.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ export function createSelectorInjection(): InjectSelector {
125125
*
126126
* @example
127127
*
128-
* import { injectSelector } from 'angular-redux'
128+
* import { injectSelector } from '@reduxjs/angular-redux'
129129
*
130130
* @Component({
131131
* selector: 'counter-component',

projects/angular-redux/src/lib/inject-store.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ export function createStoreInjection<
9393
*
9494
* @example
9595
*
96-
* import { injectStore } from 'angular-redux'
96+
* import { injectStore } from '@reduxjs/angular-redux'
9797
*
9898
* @Component({
9999
* selector: 'example-component',

projects/angular-redux/src/public-api.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Public API Surface of angular-redux
2+
* Public API Surface of @reduxjs/angular-redux
33
*/
44

55
export * from './lib/inject-dispatch';

0 commit comments

Comments
 (0)