-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
hesoso
committed
Dec 19, 2023
0 parents
commit 273bdd1
Showing
63 changed files
with
1,949 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# 本地环境 | ||
NODE_ENV = 'development' | ||
|
||
# 本地环境接口地址 | ||
VITE_API_URL = '/api' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
module.exports = { | ||
root: true, | ||
env: { browser: true, es2020: true }, | ||
extends: [ | ||
'eslint:recommended', | ||
'plugin:@typescript-eslint/recommended', | ||
'plugin:react-hooks/recommended', | ||
], | ||
ignorePatterns: ['dist', '.eslintrc.cjs'], | ||
parser: '@typescript-eslint/parser', | ||
plugins: ['react-refresh'], | ||
rules: { | ||
'react-refresh/only-export-components': [ | ||
'warn', | ||
{ allowConstantExport: true }, | ||
], | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Release Please | ||
|
||
on: | ||
push: | ||
branches: | ||
- main # 或你使用的默认分支名 | ||
|
||
jobs: | ||
release-please: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: GoogleCloudPlatform/release-please-action@v2 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
release-type: node | ||
package-name: 'nirvana' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
pnpm-debug.log* | ||
lerna-debug.log* | ||
|
||
node_modules | ||
dist | ||
dist-ssr | ||
*.local | ||
pnpm-lock.yaml | ||
|
||
# Editor directories and files | ||
.vscode/* | ||
!.vscode/extensions.json | ||
.idea | ||
.DS_Store | ||
*.suo | ||
*.ntvs* | ||
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
PROBLEMS.md | ||
mock/*.mjs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx --no-install commitlint --edit |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/usr/bin/env sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
npx lint-staged |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/dist/* | ||
/public/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "stylelint-config-standard" | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,122 @@ | ||
# Nirvara🚀 | ||
|
||
## 项目简介 | ||
|
||
🚀🚀🚀 Nirvara 是一个使用 React 18 构建的后台管理系统框架,整合了 React-Router v6、React Hooks、Redux & Redux-Toolkit、TypeScript、Vite 和 Ant-Design。它提供了一个现代化、高效的开发环境,适用于快速构建专业的后台管理界面。 | ||
|
||
## Git 地址 | ||
|
||
[GitHub - Nirvara 项目地址](https://github.com/hesoso/toy) | ||
|
||
## 项目功能 | ||
|
||
- ✨ React 18 & React-Router v6:最新的 React 版本和路由管理 | ||
- ✨ React Hooks & Redux-Toolkit:简化的状态管理 | ||
- ✨ TypeScript:增强代码的稳定性和可维护性 | ||
- ✨ Ant-Design v5:自由度极高的主题定制功能 | ||
- ✨ Vite:快速的构建和热重载,vite-plugin-mock 提供 mock 数据 | ||
- ✨ 使用 Prettier 统一格式化代码,集成 Eslint、Stylelint 代码校验规范 | ||
- ✨ 使用 husky、lint-staged、commitlint、commitizen、cz-git 规范提交信息(项目规范配置) | ||
|
||
### 其他 mock 数据解决方案 | ||
|
||
- [fastmock](https://www.fastmock.site/) | ||
- [mengxuegu](https://mock.mengxuegu.com/) | ||
|
||
## 安装与使用 📑 | ||
|
||
下面是如何在本地环境安装和运行你的项目的步骤: | ||
|
||
```bash | ||
# 克隆仓库 | ||
git clone https://github.com/hesoso/toy.git | ||
|
||
# 进入项目目录 | ||
cd nirvana | ||
|
||
# 安装依赖 | ||
yarn install | ||
|
||
# 启动项目 | ||
yarn start | ||
``` | ||
|
||
## 其它命令 | ||
|
||
```bash | ||
#构建生产版本。 | ||
yarn build | ||
|
||
# 校验代码规范 | ||
yarn lint | ||
|
||
# 校验css规范 | ||
yarn lint:css | ||
``` | ||
|
||
## 提交规范 | ||
|
||
为了确保代码质量和提交的一致性,提交代码需遵循以下规范: | ||
|
||
- 功能提交:feat: 新功能描述 | ||
- 修复提交:fix: 修复问题描述 | ||
- 文档提交:docs: 更新文档描述 | ||
- 样式提交:style: 样式更改(不影响代码运行的变动) | ||
- 详见🔗 [提交规范官方配置文件](https://github.com/conventional-changelog/commitlint/blob/master/%40commitlint/config-conventional/index.js) | ||
|
||
## 文件目录说明 📚 | ||
|
||
```text | ||
Nirvara | ||
├─ .github # 用于指定 Release-Please Action 配置 | ||
├─ .husky # 用于配置Git钩子(如pre-commit)的目录 | ||
├─ .vscode # vscode推荐配置 | ||
├─ mock # 模拟接口响应及动态随机数据 | ||
├─ public | ||
├─ src | ||
│ ├─ api # API 接口管理 | ||
│ ├─ assets # 静态资源文件 | ||
│ ├─ components # 全局组件 | ||
│ ├─ config # 基础配置项 | ||
│ ├─ constant # 项目中用到的一些常量 | ||
│ ├─ hooks # 自定义钩子 | ||
│ ├─ http # axios二次封装 | ||
│ ├─ routes # 路由管理 | ||
│ ├─ store # redux store | ||
│ ├─ typings # ts 声明文件 | ||
│ ├─ views # 所有页面 | ||
│ ├─ App.tsx # 入口页面 | ||
│ ├─ main.tsx # 入口文件 | ||
│ └─ env.d.ts # vite 声明文件 | ||
├─ .env.development # 开发环境配置 | ||
├─ .eslintrc.js # eslint 校验代码配置 | ||
├─ .gitignore # git 忽略配置 | ||
├─ .stylelintignore # stylelint 样式校验忽略配置 | ||
├─ .stylelintrc.js # stylelint 样式校验配置 | ||
├─ CHANGELOG.md # 项目更新日志 | ||
├─ commitlint.config.js # git 提交规范配置 | ||
├─ index.html # 入口 html | ||
├─ package.json # 依赖包管理 | ||
├─ README.md # 描述和解释项目的文档 | ||
├─ SCRIPTS.md # 对于一些脚本命令的总结 | ||
├─ TODOS.md # 用于记录一些需要在接下来去完善的事情 | ||
├─ tsconfig.json # typeScript 项目标准配置文件 | ||
├─ tsconfig.node.json # 专门为 Node.js 环境定制的 typeScript 配置文件 | ||
└─ vite.config.ts # vite 配置 | ||
``` | ||
|
||
## 浏览器支持 | ||
|
||
- 本地开发推荐使用 Chrome 最新版浏览器 [Download](https://www.google.com/intl/zh-CN/chrome/)。 | ||
- 生产环境支持现代浏览器,不在支持 IE 浏览器,更多浏览器可以查看 [Can I Use Es Module](https://caniuse.com/?search=ESModule)。 | ||
|
||
| ![IE](https://i.imgtg.com/2023/04/11/8z7ot.png) | ![Edge](https://i.imgtg.com/2023/04/11/8zr3p.png) | ![Firefox](https://i.imgtg.com/2023/04/11/8zKiU.png) | ![Chrome](https://i.imgtg.com/2023/04/11/8zNrx.png) | ![Safari](https://i.imgtg.com/2023/04/11/8zeGj.png) | | ||
| :---------------------------------------------: | :-----------------------------------------------: | :--------------------------------------------------: | :-------------------------------------------------: | :-------------------------------------------------: | | ||
| not support | last 2 versions | last 2 versions | last 2 versions | last 2 versions | | ||
|
||
## 联系方式 | ||
|
||
如果你有任何问题或建议,可以直接提issues,或者通过邮箱联系我: | ||
|
||
- Github: https://github.com/hesoso/toy/issues | ||
- Email: 240502633@qq.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# 常用命令说明 | ||
|
||
## ESLint 相关命令 | ||
|
||
- **`--cache`** | ||
|
||
- **描述**:启用缓存机制,只检查更改的文件。 | ||
- **示例**: | ||
```bash | ||
eslint --cache | ||
``` | ||
|
||
- **`--fix`** | ||
|
||
- **描述**:自动修复代码中的错误和风格问题。 | ||
- **示例**: | ||
```bash | ||
eslint --fix | ||
``` | ||
|
||
- **`--ext`** | ||
|
||
- **描述**:指定需要检查的文件扩展名。 | ||
- **示例**: | ||
```bash | ||
eslint --ext .js,.jsx,.ts,.tsx | ||
``` | ||
|
||
- **`--no-cache`** | ||
|
||
- **描述**:运行检查时不使用缓存。 | ||
- **示例**: | ||
```bash | ||
eslint --no-cache | ||
``` | ||
|
||
- **`--quiet`** | ||
|
||
- **描述**:只报告错误,忽略警告。 | ||
- **示例**: | ||
```bash | ||
eslint --quiet | ||
``` | ||
|
||
- **`--max-warnings`** | ||
|
||
- **描述**:设置警告的最大数量,超过则退出非零状态。 | ||
- **示例**: | ||
```bash | ||
eslint --max-warnings 10 | ||
``` | ||
|
||
- **`--format`** | ||
- **描述**:指定输出报告的格式。 | ||
- **示例**: | ||
```bash | ||
eslint --format stylish | ||
``` | ||
|
||
## Prettier 相关命令 | ||
|
||
- **`--write`** | ||
- **描述**:格式化并覆盖指定文件。 | ||
- **示例**: | ||
```bash | ||
prettier --write | ||
``` | ||
|
||
## 配置相关命令 | ||
|
||
- **`--config`** | ||
|
||
- **描述**:指定使用的配置文件。 | ||
- **示例**: | ||
```bash | ||
eslint --config .eslintrc.js | ||
prettier --config .prettierrc | ||
``` | ||
|
||
- **`--ignore-path`** | ||
- **描述**:指定忽略文件的路径。 | ||
- **示例**: | ||
```bash | ||
eslint --ignore-path .eslintignore | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Todo List | ||
|
||
此文件用于记录前端项目中待完成的功能和任务。每个任务应当明确、具体,并且尽可能分配给特定的团队成员。 | ||
|
||
## 待办事项 📚 | ||
|
||
### 立即执行 🚀 | ||
|
||
- 🔨 关于 keep-alive 的实现 | ||
|
||
### 短期目标 🚀 | ||
|
||
- 🔨 优化页面加载速度。 | ||
- 🔨 添加用户个人信息页面。 | ||
- 🔨 实现表单验证。 | ||
|
||
### 长期目标 🚀 | ||
|
||
- 🔨 实现国际化,支持多语言。 | ||
- 🔨 开发移动端友好的用户界面。 | ||
- 🔨 增加无障碍功能支持。 | ||
|
||
## 正在进行中的任务 🚀 | ||
|
||
> 这里记录正在进行中的任务。 | ||
## 完成的任务 🚀 | ||
|
||
> 这里记录已经完成的任务。 | ||
## 备注 🌈 | ||
|
||
- 请在开始任何新任务前更新此文件。 | ||
- 确保任务的描述尽可能清晰和具体。 | ||
- 每周会进行一次任务审查会议。 | ||
|
||
--- | ||
|
||
更新日期:2023 年 12 月 19 日 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/* eslint-disable no-undef */ | ||
module.exports = { extends: ["@commitlint/config-conventional"] }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
|
||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/x-icon" href="/public/favicon.ico" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Nirvana</title> | ||
<style> | ||
body { | ||
margin: 0; | ||
/* user-select: none; */ | ||
} | ||
</style> | ||
</head> | ||
|
||
<body> | ||
<div id="root"></div> | ||
<script type="module" src="/src/main.tsx"></script> | ||
</body> | ||
|
||
</html> |
Oops, something went wrong.