Skip to content

Commit

Permalink
change from cra to vite & update to antd v5 (#25)
Browse files Browse the repository at this point in the history
* update to vite v4 & antd v5
* update ci
* Update README.md
  • Loading branch information
basefas authored Mar 6, 2023
1 parent 8f41c38 commit 2e5d06d
Show file tree
Hide file tree
Showing 55 changed files with 4,832 additions and 37,496 deletions.
1 change: 1 addition & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,4 @@ build
.dockerignore
.editorconfig
Dockerfile
.local
16 changes: 0 additions & 16 deletions .editorconfig

This file was deleted.

5 changes: 5 additions & 0 deletions .env.development
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# use in dev mode
VITE_API_HOST=http://localhost
VITE_API_PORT=8088
VITE_API_TIMEOUT=5000
VITE_PLATFORM_NAME=React Antd Admin
5 changes: 5 additions & 0 deletions .env.production
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# use in build mode
VITE_API_HOST=http://localhost
VITE_API_PORT=8086
VITE_API_TIMEOUT=5000
VITE_PLATFORM_NAME=React Antd Admin
10 changes: 5 additions & 5 deletions .github/workflows/docker-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,28 +19,28 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

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

- name: Log into registry ${{ env.REGISTRY }}
uses: docker/login-action@v1
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GHCR_PAT }}

- name: Extract Docker metadata
id: meta
uses: docker/metadata-action@v3
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- name: Build and push Docker image
id: build-and-push
uses: docker/build-push-action@v2
uses: docker/build-push-action@v4
with:
context: .
push: true
Expand Down
40 changes: 19 additions & 21 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,26 +1,24 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
pnpm-debug.log*
lerna-debug.log*

# IDE
node_modules
dist
dist-ssr
*.local

# Editor directories and files
.vscode/*
!.vscode/extensions.json
.idea
.DS_Store
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
FROM node:lts-alpine AS builder
WORKDIR /usr/src/app/
WORKDIR /app
COPY package.json package-lock.json ./
RUN npm install
COPY ./ ./
RUN npm run build

FROM nginx:stable-alpine
COPY --from=builder /usr/src/app/build/ /usr/share/nginx/html
COPY --from=builder /app/dist/ /usr/share/nginx/html
COPY ./nginx.conf /etc/nginx/conf.d/default.conf
EXPOSE 80
ENTRYPOINT ["nginx", "-g", "daemon off;"]
127 changes: 125 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,125 @@
# react-antd-admin
A Management System Web powered by React.
<!-- PROJECT SHIELDS -->
[![LICENSE](https://img.shields.io/github/license/basefas/react-antd-admin.svg?style=flat-square)](/LICENSE)
[![Releases](https://img.shields.io/github/release/basefas/react-antd-admin/all.svg?style=flat-square)](https://github.com/basefas/react-antd-admin/releases)
![GitHub Repo stars](https://img.shields.io/github/stars/basefas/react-antd-admin?style=social)

<!-- PROJECT LOGO -->
<br />
<div align="center">
<a>
<img src="https://raw.githubusercontent.com/basefas/files/main/logo.svg" alt="Logo" width="80" height="80">
</a>

<h3 align="center">react-antd-admin</h3>

<p align="center">
一个使用 React 和 Antd 开发管理系统
<br />
</p>
</div>

<!-- Introduction -->

## 简介

react-antd-admin 使用 vite 与 antd v5 开发,包含常用后台使用的基本模块,依赖项少,结构简单,同时提供完整功能的后端程序,可快速用于二次开发及功能扩展。


| | url | introduction |
|-----------|---------------------------------------------|--------------------------------------------|
| backend | https://github.com/basefas/admin-go | 使用 Go & Gin 开发的后台管理系统后端 |
| frontend | https://github.com/basefas/react-antd-admin | 使用 react & vite & antd 开发的后台管理系统前端|


## 页面截图

### 登录页面

![Screen Shot](https://github.com/basefas/files/blob/main/login.png)

### 用户管理

![Screen Shot](https://github.com/basefas/files/blob/main/user.png)

### 分组管理

![Screen Shot](https://github.com/basefas/files/blob/main/group.png)

### 菜单管理

![Screen Shot](https://github.com/basefas/files/blob/main/menu.png)

### 角色及权限管理

![Screen Shot](https://github.com/basefas/files/blob/main/permission.png)


<!-- GETTING STARTED -->

## 快速开始

1. 克隆项目到本地

```
git clone https://github.com/basefas/react-antd-admin
```

2. 安装依赖

```
npm install
```

3. 运行

```
npm run dev
```

<!-- BUILD -->

## Build

1. 本地编译

```
npm run build
```

2. 本地查看编译结果

```
npm run preview
```


2. 使用 docker 编译并打包 docker 镜像

```
docker build -f Dockerfile -t react-antd-admin:<your_version> .
```

> 注:将 `<your_version>` 替换为你需要的版本号
3. 修改配置

本地开发修改 `env.development` 文件修改配置
打包需在编译前修改 `env.production` 文件修改配置
可配置项如下

```
# API 的 URL
VITE_API_HOST=http://localhost
# API 的 PORT
VITE_API_PORT=8086
# API 的 超时时间
VITE_API_TIMEOUT=5000
# 用于显示的平台名称
VITE_PLATFORM_NAME=React Antd Admin
```

<!-- LICENSE -->

## 版权声明

react-antd-admin 基于 MIT 协议, 详情请参考 [license](LICENSE)
16 changes: 0 additions & 16 deletions craco.config.js

This file was deleted.

11 changes: 11 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8"/>
<title>React Antd Admin</title>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading

0 comments on commit 2e5d06d

Please sign in to comment.