Skip to content

Commit 2e5d06d

Browse files
authored
change from cra to vite & update to antd v5 (#25)
* update to vite v4 & antd v5 * update ci * Update README.md
1 parent 8f41c38 commit 2e5d06d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4832
-37496
lines changed

.dockerignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ build
1010
.dockerignore
1111
.editorconfig
1212
Dockerfile
13+
.local

.editorconfig

Lines changed: 0 additions & 16 deletions
This file was deleted.

.env.development

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# use in dev mode
2+
VITE_API_HOST=http://localhost
3+
VITE_API_PORT=8088
4+
VITE_API_TIMEOUT=5000
5+
VITE_PLATFORM_NAME=React Antd Admin

.env.production

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# use in build mode
2+
VITE_API_HOST=http://localhost
3+
VITE_API_PORT=8086
4+
VITE_API_TIMEOUT=5000
5+
VITE_PLATFORM_NAME=React Antd Admin

.github/workflows/docker-publish.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,28 +19,28 @@ jobs:
1919

2020
steps:
2121
- name: Checkout repository
22-
uses: actions/checkout@v2
22+
uses: actions/checkout@v3
2323

2424
# Workaround: https://github.com/docker/build-push-action/issues/461
2525
- name: Setup Docker buildx
26-
uses: docker/setup-buildx-action@v1
26+
uses: docker/setup-buildx-action@v2
2727

2828
- name: Log into registry ${{ env.REGISTRY }}
29-
uses: docker/login-action@v1
29+
uses: docker/login-action@v2
3030
with:
3131
registry: ${{ env.REGISTRY }}
3232
username: ${{ github.actor }}
3333
password: ${{ secrets.GHCR_PAT }}
3434

3535
- name: Extract Docker metadata
3636
id: meta
37-
uses: docker/metadata-action@v3
37+
uses: docker/metadata-action@v4
3838
with:
3939
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4040

4141
- name: Build and push Docker image
4242
id: build-and-push
43-
uses: docker/build-push-action@v2
43+
uses: docker/build-push-action@v4
4444
with:
4545
context: .
4646
push: true

.gitignore

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,24 @@
1-
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2-
3-
# dependencies
4-
/node_modules
5-
/.pnp
6-
.pnp.js
7-
8-
# testing
9-
/coverage
10-
11-
# production
12-
/build
13-
14-
# misc
15-
.DS_Store
16-
.env.local
17-
.env.development.local
18-
.env.test.local
19-
.env.production.local
20-
1+
# Logs
2+
logs
3+
*.log
214
npm-debug.log*
225
yarn-debug.log*
236
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
249

25-
# IDE
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
2618
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?

Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
FROM node:lts-alpine AS builder
2-
WORKDIR /usr/src/app/
2+
WORKDIR /app
33
COPY package.json package-lock.json ./
44
RUN npm install
55
COPY ./ ./
66
RUN npm run build
77

88
FROM nginx:stable-alpine
9-
COPY --from=builder /usr/src/app/build/ /usr/share/nginx/html
9+
COPY --from=builder /app/dist/ /usr/share/nginx/html
1010
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
1111
EXPOSE 80
1212
ENTRYPOINT ["nginx", "-g", "daemon off;"]

README.md

Lines changed: 125 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,125 @@
1-
# react-antd-admin
2-
A Management System Web powered by React.
1+
<!-- PROJECT SHIELDS -->
2+
[![LICENSE](https://img.shields.io/github/license/basefas/react-antd-admin.svg?style=flat-square)](/LICENSE)
3+
[![Releases](https://img.shields.io/github/release/basefas/react-antd-admin/all.svg?style=flat-square)](https://github.com/basefas/react-antd-admin/releases)
4+
![GitHub Repo stars](https://img.shields.io/github/stars/basefas/react-antd-admin?style=social)
5+
6+
<!-- PROJECT LOGO -->
7+
<br />
8+
<div align="center">
9+
<a>
10+
<img src="https://raw.githubusercontent.com/basefas/files/main/logo.svg" alt="Logo" width="80" height="80">
11+
</a>
12+
13+
<h3 align="center">react-antd-admin</h3>
14+
15+
<p align="center">
16+
一个使用 React 和 Antd 开发管理系统
17+
<br />
18+
</p>
19+
</div>
20+
21+
<!-- Introduction -->
22+
23+
## 简介
24+
25+
react-antd-admin 使用 vite 与 antd v5 开发,包含常用后台使用的基本模块,依赖项少,结构简单,同时提供完整功能的后端程序,可快速用于二次开发及功能扩展。
26+
27+
28+
| | url | introduction |
29+
|-----------|---------------------------------------------|--------------------------------------------|
30+
| backend | https://github.com/basefas/admin-go | 使用 Go & Gin 开发的后台管理系统后端 |
31+
| frontend | https://github.com/basefas/react-antd-admin | 使用 react & vite & antd 开发的后台管理系统前端|
32+
33+
34+
## 页面截图
35+
36+
### 登录页面
37+
38+
![Screen Shot](https://github.com/basefas/files/blob/main/login.png)
39+
40+
### 用户管理
41+
42+
![Screen Shot](https://github.com/basefas/files/blob/main/user.png)
43+
44+
### 分组管理
45+
46+
![Screen Shot](https://github.com/basefas/files/blob/main/group.png)
47+
48+
### 菜单管理
49+
50+
![Screen Shot](https://github.com/basefas/files/blob/main/menu.png)
51+
52+
### 角色及权限管理
53+
54+
![Screen Shot](https://github.com/basefas/files/blob/main/permission.png)
55+
56+
57+
<!-- GETTING STARTED -->
58+
59+
## 快速开始
60+
61+
1. 克隆项目到本地
62+
63+
```
64+
git clone https://github.com/basefas/react-antd-admin
65+
```
66+
67+
2. 安装依赖
68+
69+
```
70+
npm install
71+
```
72+
73+
3. 运行
74+
75+
```
76+
npm run dev
77+
```
78+
79+
<!-- BUILD -->
80+
81+
## Build
82+
83+
1. 本地编译
84+
85+
```
86+
npm run build
87+
```
88+
89+
2. 本地查看编译结果
90+
91+
```
92+
npm run preview
93+
```
94+
95+
96+
2. 使用 docker 编译并打包 docker 镜像
97+
98+
```
99+
docker build -f Dockerfile -t react-antd-admin:<your_version> .
100+
```
101+
102+
> 注:将 `<your_version>` 替换为你需要的版本号
103+
104+
3. 修改配置
105+
106+
本地开发修改 `env.development` 文件修改配置
107+
打包需在编译前修改 `env.production` 文件修改配置
108+
可配置项如下
109+
110+
```
111+
# API 的 URL
112+
VITE_API_HOST=http://localhost
113+
# API 的 PORT
114+
VITE_API_PORT=8086
115+
# API 的 超时时间
116+
VITE_API_TIMEOUT=5000
117+
# 用于显示的平台名称
118+
VITE_PLATFORM_NAME=React Antd Admin
119+
```
120+
121+
<!-- LICENSE -->
122+
123+
## 版权声明
124+
125+
react-antd-admin 基于 MIT 协议, 详情请参考 [license](LICENSE)

craco.config.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8"/>
5+
<title>React Antd Admin</title>
6+
</head>
7+
<body>
8+
<div id="root"></div>
9+
<script type="module" src="/src/main.tsx"></script>
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)