Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Todo: add zustand template #54

Merged
merged 10 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![MIT License](https://img.shields.io/npm/l/react-native-tab-view.svg?style=flat-square)](https://github.com/sj-distributor/create-react-boilerplates/blob/main/LICENSE)
[![node](https://img.shields.io/badge/node-%5E14.18.0%20%7C%7C%20%3E%3D%2016.0.0-brightgreen)](https://github.com/nodejs/release#release-schedule)
[![CI Test](https://github.com/sj-distributor/create-react-boilerplates/actions/workflows/pull_request.yml/badge.svg)](https://github.com/sj-distributor/create-react-boilerplates/actions/workflows/pull_request.yml)
[![Review PR](https://camo.githubusercontent.com/a5031f46617d8447bca1ab5866a20d50007f2e47e7626e8e6ba94ed8ac4bddc6/68747470733a2f2f646576656c6f7065722e737461636b626c69747a2e636f6d2f696d672f7265766965775f70725f736d616c6c2e737667)](https://stackblitz.com/~/github.com/sj-distributor/create-react-boilerplates)
[![StackBlitz](https://img.shields.io/badge/StackBlitz-Edit-blue?style=flat-square&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAC4AAABECAYAAAD+1gcLAAAACXBIWXMAAC4jAAAuIwF4pT92AAAAB3RJTUUH5AINBw4X0bTGRQAABSxJREFUaN7VmVtsFFUYx//fmQW79bbd2QKpaIIaDcGoifFBEgMGqTTRRA01SgxE5Rbi7QG6S3lgo9J2twpeotxEQlCigLdoQwJ4ARN9QB9MRCNRDBdRzE7LJbTSmTl/H4BYStmd2Z3tDOdt5lzml/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8wqZWNmpXECK6wV+RBCipRLoQBRvyLL2dFwfBlDnTWos7W4xXgi3IATg31p3hldoEG8EAR0IuEC8OuUGK62eCyoYVARutvNOL9VZQD6yxqmnKqmHB6u46PkejHp7XVxmlHOzVhXnTKxgwujXhzH0bdo56m9jymgcKhEITXFl61lFoYV7BMa0akCjkjqJEHOKdP/U7xhNJ1vlZLXOv2Upnmq3JxfJlH4XRzWebBWrmgf38hRXav5F4vSfjqGmHl8if1W/NuSzjWljvW3oQxh0Ly9AQRtqUvdC+Xk4UiXfpmLH9JzB0CBOQKtpwwXtHzxLJcTsQW97FdQDQVxIVc3GUzVuEyEDb4z7NTndysju4c6qfSlOOc8pXQof78nEtoVRDvDsnMlXeK04+o+ztRgSnNOdjq1DSM2z4uLoeecKSCQWhgntXfEsY2ZcHwDQAMESq8VoC7ty5EnxZK37EIAGAV6NArT3c3def2Hm3HdASlSYSipe384bAR6x+tTsIBOBqoMTzlirVz2BrOgoWcF/mizikfkwKiQAAAAASUVORK5CYII=)](https://stackblitz.com/github/{GH_USERNAME}/{REPO_NAME})

## Usage

Expand Down Expand Up @@ -39,7 +39,8 @@ pnpm dev
```

# Templates
|template name|description|
|template name|more description|
|-|-|
|template-react-recoil|vite + typescript + recoil|
|template-react-ts|vite + typescript|
|template-react-recoil|click [here](https://github.com/sj-distributor/create-react-boilerplates/tree/main/templates/template-react-recoil#react-vite-recoil-boilerplate)|
|template-react-ts|click [here](https://github.com/sj-distributor/create-react-boilerplates/tree/main/templates/template-react-ts#react-ts-boilerplate)|
|template-react-zustand|click [here](https://github.com/sj-distributor/create-react-boilerplates/tree/main/templates/template-react-zustand#react-ts-boilerplate)|
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-react-boilerplates",
"version": "2.3.0",
"version": "2.4.0",
"type": "module",
"bin": {
"create-react-boilerplates": "index.js",
Expand Down
13 changes: 9 additions & 4 deletions src/boilerplates.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import { green, yellow } from "kolorist";
import { bgBlack, green, yellow } from "kolorist";

import { Boilerplate } from "./types";

export const boilerplates: Boilerplate[] = [
{
name: "react-recoil",
display: "TypeScript + Recoil",
color: yellow,
display: "Recoil + TypeScript",
color: green,
},
{
name: "react-ts",
display: "TypeScript",
color: green,
color: bgBlack,
},
{
name: "react-zustand",
display: "Zustand + TypeScript",
color: yellow,
},
];
45 changes: 21 additions & 24 deletions templates/template-react-recoil/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
# React Vite Recoil Boilerplate
# React TS Boilerplate

## 技术栈
## Technology Stack

- [Vite](https://vitejs.dev)
- [React](https://reactjs.org)
- [TypeScript](https://www.typescriptlang.org)
- [ReactRouter](https://reactrouter.com/docs/en/v6)
- [Vite](https://vitejs.dev): Efficient build tool for modern browsers.
- [React](https://reactjs.org): JavaScript library for building user interfaces.
- [TypeScript](https://www.typescriptlang.org): Superset of JavaScript with static type-checking.
- [ReactRouter](https://reactrouter.com/docs/en/v6): Navigation library for React applications.
- [TailwindCss](https://tailwindcss.com/): Utility-first CSS framework for creating custom designs.
- [Axios](https://axios-http.com/): Promise-based HTTP client for the browser and Node.js.
- [Ramda](https://ramdajs.com/): Functional programming library for JavaScript.
- [ahooks](https://ahooks.js.org/): Collection of React Hooks for common tasks.
- [Recoil](https://recoiljs.org/): A state management library for React.

## 快速开始
## Quick Start

Install project dependencies

Expand All @@ -21,39 +26,31 @@ Launch the app, it will become available at [http://localhost:3000](http://local
yarn dev
```

## 项目规范
## Project Standards

- xxx
- xxx
- xxx

## 目录结构
## Directory Structure

`├──`[`.vscode`](.vscode) — VSCode settings including code snippets, recommended extensions etc<br>
`├──`[`public`](./public) — Static assets such as robots.txt, index.html etc<br>
`├──`[`src/assets`](./src/assets) — Static assets<br>
`├──`[`src/components`](./src/components) — React public components<br>
`├──`[`src/hooks`](./src/hooks) — React public hooks<br>
`├──`[`src/models`](./src/models) — Status management file<br>
`├──`[`src/models`](./src/hooks) — Status Management<br>
`├──`[`src/pages`](./src/pages) — Application and page (screen) components<br>
`├──`[`src/routes`](./src/routes) — Application routes components<br>
`├──`[`src/theme`](./src/services) — External connection service<br>
`├──`[`src/utils`](./src/utils) — Utility functions<br>

## 安装以下 vscode 插件方便开发
## Recommended VSCode Extensions

Tailwind CSS IntelliSense
- [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss): IntelliSense for Tailwind CSS.
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode&ssr=false#overview): Code formatting tool.
- [EditorConfig for VS Code](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig): Editor configuration consistency.

> https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss
## Coding Conventions

Prettier - Code formatter

> https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode&ssr=false#overview

EditorConfig for VS Code

> https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig

## 编码约定

> https://github.com/sj-distributor/react-coding-conventions
- Check [here](https://github.com/sj-distributor/react-coding-conventions).
40 changes: 18 additions & 22 deletions templates/template-react-ts/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
# React TS Boilerplate

## 技术栈
## Technology Stack

- [Vite](https://vitejs.dev)
- [React](https://reactjs.org)
- [TypeScript](https://www.typescriptlang.org)
- [ReactRouter](https://reactrouter.com/docs/en/v6)
- [Vite](https://vitejs.dev): Efficient build tool for modern browsers.
- [React](https://reactjs.org): JavaScript library for building user interfaces.
- [TypeScript](https://www.typescriptlang.org): Superset of JavaScript with static type-checking.
- [ReactRouter](https://reactrouter.com/docs/en/v6): Navigation library for React applications.
- [TailwindCss](https://tailwindcss.com/): Utility-first CSS framework for creating custom designs.
- [Axios](https://axios-http.com/): Promise-based HTTP client for the browser and Node.js.
- [Ramda](https://ramdajs.com/): Functional programming library for JavaScript.
- [ahooks](https://ahooks.js.org/): Collection of React Hooks for common tasks.

## 快速开始
## Quick Start

Install project dependencies

Expand All @@ -21,13 +25,13 @@ Launch the app, it will become available at [http://localhost:3000](http://local
yarn dev
```

## 项目规范
## Project Standards

- xxx
- xxx
- xxx

## 目录结构
## Directory Structure

`├──`[`.vscode`](.vscode) — VSCode settings including code snippets, recommended extensions etc<br>
`├──`[`public`](./public) — Static assets such as robots.txt, index.html etc<br>
Expand All @@ -39,20 +43,12 @@ yarn dev
`├──`[`src/theme`](./src/services) — External connection service<br>
`├──`[`src/utils`](./src/utils) — Utility functions<br>

## 安装以下 vscode 插件方便开发
## Recommended VSCode Extensions

Tailwind CSS IntelliSense
- [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss): IntelliSense for Tailwind CSS.
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode&ssr=false#overview): Code formatting tool.
- [EditorConfig for VS Code](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig): Editor configuration consistency.

> https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss
## Coding Conventions

Prettier - Code formatter

> https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode&ssr=false#overview

EditorConfig for VS Code

> https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig

## 编码约定

> https://github.com/sj-distributor/react-coding-conventions
- Check [here](https://github.com/sj-distributor/react-coding-conventions).
16 changes: 16 additions & 0 deletions templates/template-react-zustand/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# For more information about the properties used in
# this file, please see the EditorConfig documentation:
# https://editorconfig.org/

root = true

[*]
charset = utf-8
end_of_line = lf
indent_size = 2
indent_style = space
insert_final_newline = true
trim_trailing_whitespace = true

[*.md]
trim_trailing_whitespace = false
18 changes: 18 additions & 0 deletions templates/template-react-zustand/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"root": true,
"env": { "browser": true, "es2020": true, "node": true },
"extends": ["plugin:@sj-distributor/react/recommended"],
"ignorePatterns": ["dist", ".eslintrc.json"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaFeatures": {
"jsx": true
},
"ecmaVersion": "latest",
"sourceType": "module"
},
"plugins": ["react-refresh"],
"rules": {
"@typescript-eslint/no-explicit-any": "off"
}
}
24 changes: 24 additions & 0 deletions templates/template-react-zustand/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
2 changes: 2 additions & 0 deletions templates/template-react-zustand/.prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*.json
.history
1 change: 1 addition & 0 deletions templates/template-react-zustand/.prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
7 changes: 7 additions & 0 deletions templates/template-react-zustand/.vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"recommendations": [
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
"EditorConfig.EditorConfig",
]
}
55 changes: 55 additions & 0 deletions templates/template-react-zustand/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# React TS Boilerplate

## Technology Stack

- [Vite](https://vitejs.dev): Efficient build tool for modern browsers.
- [React](https://reactjs.org): JavaScript library for building user interfaces.
- [TypeScript](https://www.typescriptlang.org): Superset of JavaScript with static type-checking.
- [ReactRouter](https://reactrouter.com/docs/en/v6): Navigation library for React applications.
- [Axios](https://axios-http.com/): Promise-based HTTP client for the browser and Node.js.
- [Ramda](https://ramdajs.com/): Functional programming library for JavaScript.
- [ahooks](https://ahooks.js.org/): Collection of React Hooks for common tasks.
- [Zustand](https://zustand-demo.pmnd.rs/): Small, fast and scaleable bearbones state-management solution.

## Quick Start

Install project dependencies

```
pnpm install
```

Launch the app, it will become available at [http://localhost:3000](http://localhost:3000/)

```
pnpm dev
```

## Project Standards

- xxx
- xxx
- xxx

## Directory Structure

`├──`[`.vscode`](.vscode) — VSCode settings including code snippets, recommended extensions etc<br>
`├──`[`public`](./public) — Static assets such as robots.txt, index.html etc<br>
`├──`[`src/assets`](./src/assets) — Static assets<br>
`├──`[`src/components`](./src/components) — React public components<br>
`├──`[`src/hooks`](./src/hooks) — React public hooks<br>
`├──`[`src/models`](./src/hooks) — Status Management<br>
`├──`[`src/pages`](./src/pages) — Application and page (screen) components<br>
`├──`[`src/routes`](./src/routes) — Application routes components<br>
`├──`[`src/theme`](./src/services) — External connection service<br>
`├──`[`src/utils`](./src/utils) — Utility functions<br>

## Recommended VSCode Extensions

- [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss): IntelliSense for Tailwind CSS.
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode&ssr=false#overview): Code formatting tool.
- [EditorConfig for VS Code](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig): Editor configuration consistency.

## Coding Conventions

- Check [here](https://github.com/sj-distributor/react-coding-conventions).
13 changes: 13 additions & 0 deletions templates/template-react-zustand/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
44 changes: 44 additions & 0 deletions templates/template-react-zustand/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{
"name": "template-react-zustand",
"private": true,
"version": "0.0.0",
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
"preview": "vite preview"
},
"dependencies": {
"ahooks": "^3.7.10",
"axios": "^1.6.7",
"ramda": "^0.29.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.22.0",
"zustand": "^4.5.0"
},
"devDependencies": {
"@sj-distributor/eslint-plugin-react": "^0.7.1",
"@types/ramda": "^0.29.10",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.19",
"@typescript-eslint/eslint-plugin": "^6.21.0",
"@typescript-eslint/parser": "^6.21.0",
"@vitejs/plugin-react": "^4.2.1",
"autoprefixer": "^10.4.17",
"eslint": "^8.56.0",
"eslint-config-prettier": "^9.1.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-prettier": "^5.1.3",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.5",
"eslint-plugin-simple-import-sort": "^12.0.0",
"eslint-plugin-unicorn": "^51.0.1",
"postcss": "^8.4.35",
"prettier": "^3.2.5",
"typescript": "^5.2.2",
"typescript-plugin-css-modules": "^5.1.0",
"vite": "^5.1.0"
}
}
Loading
Loading