Skip to content

Commit

Permalink
zustand-x
Browse files Browse the repository at this point in the history
  • Loading branch information
zbeyens committed Dec 7, 2023
1 parent b6aad93 commit 04bebac
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 63 deletions.
4 changes: 2 additions & 2 deletions .changeset/config.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"$schema": "https://unpkg.com/@changesets/config@1.6.0/schema.json",
"changelog": ["@changesets/changelog-github", { "repo": "udecode/zustood" }],
"changelog": ["@changesets/changelog-github", { "repo": "udecode/zustand-x" }],
"commit": false,
"linked": [["@udecode/zustood*"]],
"linked": [["zustand-x"]],
"access": "public",
"baseBranch": "main",
"updateInternalDependencies": "patch",
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
name: '🚨 Bug'
about: A bug that occurs in zustood logic
about: A bug that occurs in zustand-x logic
title: ''
labels: bug
assignees: ''
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: "💬 Support: Discussions"
url: https://github.com/udecode/zustood/discussions
url: https://github.com/udecode/zustand-x/discussions
about: Share ideas, ask and answer questions in our Discussions.
2 changes: 1 addition & 1 deletion .github/workflows/comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@ jobs:
with:
issue-number: ${{ github.event.issue.number }}
body: |
A new release has been made for this pull request. You can install it with `yarn add @udecode/zustood@${{ steps.version.outputs.version }}`.
A new release has been made for this pull request. You can install it with `yarn add zustand-x@${{ steps.version.outputs.version }}`.
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Contributing

Thanks for your interest in improving `zustood`! We are a
Thanks for your interest in improving `zustand-x`! We are a
community-driven project and welcome contributions of all kinds: from
discussion to documentation to bugfixes to feature improvements.

Expand All @@ -12,7 +12,7 @@ everyone's precious time.
No software is bug-free. So, if you got an issue, follow these steps:

- Search the
[issue list](https://github.com/udecode/zustood/issues?utf8=%E2%9C%93&q=)
[issue list](https://github.com/udecode/zustand-x/issues?utf8=%E2%9C%93&q=)
for current and old issues.
- If you find an existing issue, please UPVOTE the issue by adding a
"thumbs-up reaction". We use this to help prioritize issues!
Expand All @@ -33,8 +33,8 @@ package manager. See
[installation guide](https://yarnpkg.com/en/docs/install).

1. `cd ~` (optional)
2. `git clone https://github.com/udecode/zustood.git` _bonus_: use your own fork for this step
3. `cd zustood`
2. `git clone https://github.com/udecode/zustand-x.git` _bonus_: use your own fork for this step
3. `cd zustand-x`
4. `yarn install`
5. `yarn build`

Expand Down Expand Up @@ -111,7 +111,7 @@ a PR if tests are failing.
include a short description of what you contributed and, if it is a code
change, instructions for how to manually test out the change. This is
informally enforced by our
[PR template](https://github.com/udecode/zustood/blob/main/.github/PULL_REQUEST_TEMPLATE.md).
[PR template](https://github.com/udecode/zustand-x/blob/main/.github/PULL_REQUEST_TEMPLATE.md).
If your PR is reviewed as only needing trivial changes (e.g. small typos
etc), and you have commit access then you can merge the PR after making
those changes.
Expand All @@ -132,7 +132,7 @@ great place to start. Here's how you can help:

### Responding to questions

[Q&A](https://github.com/udecode/zustood/discussions/categories/q-a) is a
[Q&A](https://github.com/udecode/zustand-x/discussions/categories/q-a) is a
great place to help. If you can answer a question, it will help the
asker as well as anyone who has a similar question. Also in the future
if anyone has that same question they can easily find it by searching.
Expand Down Expand Up @@ -160,7 +160,7 @@ labels to filter issues down so we can see all of the issues for a
particular area, and keep the total number of open issues under control.

For example, here is the list of
[open, untyped issues](https://github.com/udecode/zustood/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20-label%3A%22bug%22%20-label%3A%22discussion%22%20-label%3A%22feature%22%20-label%3A%22maintenance%22%20-label%3A%22question%20%2F%20support%22%20-label%3A%22documentation%22%20-label%3A%22greenkeeper%22).
[open, untyped issues](https://github.com/udecode/zustand-x/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20-label%3A%22bug%22%20-label%3A%22discussion%22%20-label%3A%22feature%22%20-label%3A%22maintenance%22%20-label%3A%22question%20%2F%20support%22%20-label%3A%22documentation%22%20-label%3A%22greenkeeper%22).
For more info see
[searching issues](https://help.github.com/articles/searching-issues/)
in the Github docs.
Expand Down
36 changes: 18 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Zustood
# ZustandX

[Zustand](https://github.com/pmndrs/zustand) is a small, fast and
scalable state-management solution battle-tested against common
Expand All @@ -9,21 +9,21 @@ and [context loss](https://github.com/facebook/react/issues/13332)
between mixed renderers. It may be the one state-manager in the React
space that gets all of these right.

As zustand is un-opinionated by design, it's challenging to find out the
As `zustand` is un-opinionated by design, it's challenging to find out the
best patterns to use when creating stores, often leading to boilerplate
code.

Zustood, built on top of zustand, is providing a powerful store factory
`zustand-x`, built on top of `zustand`, is providing a powerful store factory
which solves these challenges, so you can focus on your app.

```bash
yarn add zustand @udecode/zustood
yarn add zustand zustand-x
```

Visit [zustood.netlify.app](https://zustood.netlify.app) for the
Visit [zustand-x.netlify.app](https://zustand-x.netlify.app) for the
API.

### Why zustood over zustand?
### Why zustand-x in addition to zustand?

- Much less boilerplate
- Modular state management:
Expand All @@ -36,10 +36,10 @@ API.
## Create a store

```ts
import { createStore } from '@udecode/zustood'
import { createStore } from 'zustand-x'

const repoStore = createStore('repo')({
name: 'zustood',
name: 'zustandX',
stars: 0,
owner: {
name: 'someone',
Expand All @@ -53,7 +53,7 @@ const repoStore = createStore('repo')({
- the parameter of the second function is the initial state of your
store
- the main difference with zustand is that you don't need to define a
getter and a setter for each field, these are generated by zustood
getter and a setter for each field, these are generated by zustand-x

Note that the zustand store is accessible through:

Expand Down Expand Up @@ -110,12 +110,12 @@ repoStore.get.state()
### Extend selectors

You generally want to write derived selectors (those depending on other
selectors) for reusability. Zustood supports extending selectors with
selectors) for reusability. ZustandX supports extending selectors with
full typescript support:

```ts
const repoStore = createStore('repo')({
name: 'zustood ',
name: 'zustandX',
stars: 0,
middlewares: ['immer', 'devtools', 'persist']
})
Expand Down Expand Up @@ -152,11 +152,11 @@ store.set.state((draft) => {
```

However, you generally want to create derived actions for reusability.
Zustood supports extending actions with full typescript support:
ZustandX supports extending actions with full typescript support:

```ts
const repoStore = createStore('repo')({
name: 'zustood',
name: 'zustandX',
stars: 0,
})
.extendActions((set, get, api) => ({
Expand All @@ -182,7 +182,7 @@ one to import. By combining all the stores, selectors and actions, just
pick what you need using TS autocomplete.

```ts
import { mapValuesKey } from '@udecode/zustood';
import { mapValuesKey } from 'zustand-x';

// Global store
export const rootStore = {
Expand Down Expand Up @@ -281,7 +281,7 @@ export interface CreateStoreOptions<T extends State> {

### Middlewares

Zustood is using these middlewares:
ZustandX is using these middlewares:
- `immer`: required. Autofreeze can be enabled using
`immer.enabledAutoFreeze` option.
- `devtools`: enabled if `devtools.enabled` option is `true`.
Expand All @@ -294,7 +294,7 @@ Zustood is using these middlewares:

### Ideas and discussions

[Discussions](https://github.com/udecode/zustood/discussions) is the best
[Discussions](https://github.com/udecode/zustand-x/discussions) is the best
place for bringing opinions and contributions. Letting us know if we're
going in the right or wrong direction is great feedback and will be much
appreciated!
Expand All @@ -305,7 +305,7 @@ appreciated!

🌟 Stars and 📥 Pull requests are welcome! Don't hesitate to **share
your feedback** here. Read our
[contributing guide](https://github.com/udecode/zustood/blob/main/CONTRIBUTING.md)
[contributing guide](https://github.com/udecode/zustand-x/blob/main/CONTRIBUTING.md)
to get started.

<p>
Expand All @@ -316,4 +316,4 @@ to get started.

## License

[MIT](https://github.com/udecode/zustood/blob/main/LICENSE)
[MIT](https://github.com/udecode/zustand-x/blob/main/LICENSE)
37 changes: 20 additions & 17 deletions packages/zustood/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
# Zustood
> [!NOTE]
> `@udecode/zustood` has been renamed to `zustand-x`.
# ZustandX

[Zustand](https://github.com/pmndrs/zustand) is a small, fast and
scalable state-management solution battle-tested against common
Expand All @@ -13,17 +16,17 @@ As zustand is un-opinionated by design, it's challenging to find out the
best patterns to use when creating stores, often leading to boilerplate
code.

Zustood, built on top of zustand, is providing a powerful store factory
ZustandX, built on top of zustand, is providing a powerful store factory
which solves these challenges, so you can focus on your app.

```bash
yarn add zustand @udecode/zustood
yarn add zustand zustand-x
```

Visit [zustood.udecode.io](https://zustood.udecode.io) for the
Visit [zustand-x.udecode.io](https://zustand-x.udecode.io) for the
API.

### Why zustood over zustand?
### Why zustand-x over zustand?

- Much less boilerplate
- Modular state management:
Expand All @@ -35,10 +38,10 @@ API.
## Create a store

```ts
import { createStore } from '@udecode/zustood'
import { createStore } from 'zustand-x'

const repoStore = createStore('repo')({
name: 'zustood',
name: 'zustandX',
stars: 0,
})
```
Expand All @@ -48,7 +51,7 @@ const repoStore = createStore('repo')({
- the parameter of the second function is the initial state of your
store
- the main difference with zustand is that you don't need to define a
getter and a setter for each field, these are generated by zustood
getter and a setter for each field, these are generated by zustand-x

Note that the zustand store is accessible through:

Expand Down Expand Up @@ -94,12 +97,12 @@ repoStore.get.state()
### Extend selectors

You generally want to write derived selectors (those depending on other
selectors) for reusability. Zustood supports extending selectors with
selectors) for reusability. ZustandX supports extending selectors with
full typescript support:

```ts
const repoStore = createStore('repo')({
name: 'zustood ',
name: 'zustandX',
stars: 0,
})
.extendSelectors((set, get, api) => ({
Expand Down Expand Up @@ -135,11 +138,11 @@ store.set.state((draft) => {
```

However, you generally want to create derived actions for reusability.
Zustood supports extending actions with full typescript support:
ZustandX supports extending actions with full typescript support:

```ts
const repoStore = createStore('repo')({
name: 'zustood',
name: 'zustandX',
stars: 0,
})
.extendActions((set, get, api) => ({
Expand All @@ -165,7 +168,7 @@ one to import. By combining all the stores, selectors and actions, just
pick what you need using TS autocomplete.

```ts
import { mapValuesKey } from '@udecode/zustood';
import { mapValuesKey } from 'zustand-x';

// Global store
export const rootStore = {
Expand Down Expand Up @@ -230,7 +233,7 @@ export interface CreateStoreOptions<T extends State> {

### Middlewares

Zustood is using these middlewares:
ZustandX is using these middlewares:
- `immer`: required. Autofreeze can be enabled using
`immer.enabledAutoFreeze` option.
- `devtools`: enabled if `devtools.enabled` option is `true`.
Expand All @@ -243,7 +246,7 @@ Zustood is using these middlewares:

### Ideas and discussions

[Discussions](https://github.com/udecode/zustood/discussions) is the best
[Discussions](https://github.com/udecode/zustand-x/discussions) is the best
place for bringing opinions and contributions. Letting us know if we're
going in the right or wrong direction is great feedback and will be much
appreciated!
Expand All @@ -254,9 +257,9 @@ appreciated!

🌟 Stars and 📥 Pull requests are welcome! Don't hesitate to **share
your feedback** here. Read our
[contributing guide](https://github.com/udecode/zustood/blob/main/CONTRIBUTING.md)
[contributing guide](https://github.com/udecode/zustand-x/blob/main/CONTRIBUTING.md)
to get started.

## License

[MIT](https://github.com/udecode/zustood/blob/main/LICENSE)
[MIT](https://github.com/udecode/zustand-x/blob/main/LICENSE)
10 changes: 5 additions & 5 deletions packages/zustood/package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "@udecode/zustood",
"name": "zustand-x",
"version": "2.0.0",
"description": "A modular store factory using zustand",
"keywords": [
"zustand"
],
"homepage": "https://github.com/udecode/zustood",
"homepage": "https://github.com/udecode/zustand-x",
"bugs": {
"url": "https://github.com/udecode/zustood/issues"
"url": "https://github.com/udecode/zustand-x/issues"
},
"repository": {
"type": "git",
"url": "https://github.com/udecode/zustood.git",
"directory": "packages/zustood"
"url": "https://github.com/udecode/zustand-x.git",
"directory": "packages/zustand-x"
},
"license": "MIT",
"main": "dist/index.js",
Expand Down
Loading

0 comments on commit 04bebac

Please sign in to comment.