mirror of
				https://github.com/bufanyun/hotgo.git
				synced 2025-11-04 16:23:43 +08:00 
			
		
		
		
	Merge pull request #137 from apefuu/v2.0
Upgrade web Toolchain and update web docs
This commit is contained in:
		@@ -10,7 +10,7 @@ gf run main.go
 | 
			
		||||
 | 
			
		||||
# web端
 | 
			
		||||
cd web
 | 
			
		||||
yarn dev
 | 
			
		||||
pnpm run dev 或 npm run dev
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
以下是一个关联表的CURD生成流程
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ gf run main.go
 | 
			
		||||
 | 
			
		||||
# web端
 | 
			
		||||
cd web
 | 
			
		||||
yarn dev
 | 
			
		||||
pnpm run dev 或 npm run dev
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
以下是一个基本的CURD生成流程
 | 
			
		||||
 
 | 
			
		||||
@@ -10,7 +10,7 @@ gf run main.go
 | 
			
		||||
 | 
			
		||||
# web端
 | 
			
		||||
cd web
 | 
			
		||||
yarn dev
 | 
			
		||||
pnpm run dev 或 npm run dev
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
以下是一个基本的树形CURD生成流程
 | 
			
		||||
 
 | 
			
		||||
@@ -41,7 +41,7 @@ cd server &&  make build
 | 
			
		||||
cd server                                             # 切换到服务端目录下
 | 
			
		||||
rm -rf ./resource/public/admin/                       # 删除之前的web资源
 | 
			
		||||
mkdir ./resource/public/admin/                        # 重新创建web资源存放目录,除首次编译后续可以跳过执行此步骤
 | 
			
		||||
cd ../web && yarn build                               # 切换到web项目下,编译web项目
 | 
			
		||||
cd ../web && pnpm run build                               # 切换到web项目下,编译web项目
 | 
			
		||||
\cp -rf ./dist/*  ../server/resource/public/admin/    # 将编译好的web资源复制到server对应的资源存放路径下
 | 
			
		||||
cd ../server                                          # 切换回服务端目录下
 | 
			
		||||
echo "y" | gf build                                   # 编译hotgo服务端
 | 
			
		||||
@@ -58,7 +58,7 @@ echo "y" | gf build                              # 编译hotgo服务端
 | 
			
		||||
 | 
			
		||||
# 编译web端
 | 
			
		||||
cd web                                           
 | 
			
		||||
yarn build
 | 
			
		||||
pnpm run build 或 npm run build
 | 
			
		||||
 | 
			
		||||
# web端编译完成后,将web/dist/*中的文件上传到`server`端线上运行目录:/resource/public/admin即可
 | 
			
		||||
# 至此,web端和server端都可以独立覆盖更新
 | 
			
		||||
 
 | 
			
		||||
@@ -11,8 +11,8 @@
 | 
			
		||||
1. 前往https://nodejs.org/zh-cn/下载当前版本node
 | 
			
		||||
2. 命令行运行 `node -v` 若控制台输出版本号则node安装成功
 | 
			
		||||
3. node 版本需大于等于 `16.0`
 | 
			
		||||
4. 安装yarn:`npm install -g yarn`
 | 
			
		||||
5. 命令行运行 `yarn -v` 若控制台输出版本号则前端环境搭建成功
 | 
			
		||||
4. 安装pnpm:`npm install -g pnpm`
 | 
			
		||||
5. 命令行运行 `pnpm -v` 若控制台输出版本号则前端环境搭建成功
 | 
			
		||||
 | 
			
		||||
### 后端环境
 | 
			
		||||
1. 下载golang安装 版本号需>=1.21
 | 
			
		||||
 
 | 
			
		||||
@@ -88,13 +88,13 @@ gfcli:
 | 
			
		||||
2、web前端:
 | 
			
		||||
```shell script
 | 
			
		||||
    cd web
 | 
			
		||||
    # 首先确定你以安装node16.0以上版本并安装了包[npm、yarn],否则可能会出现一些未知报错
 | 
			
		||||
    # 首先确定你以安装node16.0以上版本并安装了包[npm、pnpm],否则可能会出现一些未知报错
 | 
			
		||||
    
 | 
			
		||||
    # 安装依赖
 | 
			
		||||
    yarn install 
 | 
			
		||||
    pnpm install 
 | 
			
		||||
    
 | 
			
		||||
    # 启动web项目
 | 
			
		||||
    yarn dev 
 | 
			
		||||
    pnpm run dev 
 | 
			
		||||
    
 | 
			
		||||
    # 如果顺利,至此到浏览器打开:http://你的IP:8001/admin
 | 
			
		||||
    # 登录账号:admin, 密码:123456
 | 
			
		||||
 
 | 
			
		||||
@@ -128,7 +128,7 @@ gfcli:
 | 
			
		||||
### 生成CRUD表格
 | 
			
		||||
 | 
			
		||||
- 推荐使用热编译方式启动HotGo,这样生成完成页面自动刷新即可看到新生成内容,无需手动重启
 | 
			
		||||
- 服务端热编译启动:`gf run main.go`, web前端启动:`yarn dev`
 | 
			
		||||
- 服务端热编译启动:`gf run main.go`, web前端启动:`pnpm run dev` 或 `npm run dev`
 | 
			
		||||
 | 
			
		||||
1、创建数据表
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -15,7 +15,7 @@
 | 
			
		||||
 | 
			
		||||
项目开发完成之后,执行以下命令进行构建
 | 
			
		||||
```shell
 | 
			
		||||
yarn build
 | 
			
		||||
pnpm run build 或 npm run build
 | 
			
		||||
```
 | 
			
		||||
构建打包成功之后,会在根目录生成 dist 文件夹,里面就是构建打包好的文件
 | 
			
		||||
 | 
			
		||||
@@ -40,15 +40,15 @@ VITE_LEGACY = true
 | 
			
		||||
使用项目自定的命令进行预览(推荐)
 | 
			
		||||
```shell
 | 
			
		||||
# 先打包在进行预览
 | 
			
		||||
yarn preview
 | 
			
		||||
pnpm run preview 或 npm run preview
 | 
			
		||||
# 直接预览本地 dist 文件目录
 | 
			
		||||
yarn preview:dist
 | 
			
		||||
pnpm run preview:dist 或 npm run preview:dist
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
- 本地服务器预览(通过 live-server)
 | 
			
		||||
```shell
 | 
			
		||||
# 1.全局安装live-server
 | 
			
		||||
yarn global add live-server
 | 
			
		||||
npm -g install live-server
 | 
			
		||||
# 2. 进入打包的后目录
 | 
			
		||||
cd ./dist
 | 
			
		||||
# 本地预览,默认端口8080
 | 
			
		||||
@@ -60,7 +60,7 @@ live-server --port 9000
 | 
			
		||||
### 分析构建文件体积
 | 
			
		||||
如果你的构建文件很大,可以通过项目内置 [rollup-plugin-analyzer](https://github.com/doesdev/rollup-plugin-analyzer) 插件进行代码体积分析,从而优化你的代码。
 | 
			
		||||
```shell
 | 
			
		||||
yarn report
 | 
			
		||||
pnpm run report 或 npm run report
 | 
			
		||||
```
 | 
			
		||||
运行之后,在自动打开的页面可以看到具体的体积分布,以分析哪些依赖有问题。
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -9,7 +9,7 @@ ADMIN_RESOURCE_PATH = "/resource/public/admin/"
 | 
			
		||||
build:
 | 
			
		||||
	@rm -rf ./$(ADMIN_RESOURCE_PATH)
 | 
			
		||||
	@mkdir ./$(ADMIN_RESOURCE_PATH)
 | 
			
		||||
	@cd ../web && yarn build && \cp -rf ./dist/*  ../server$(ADMIN_RESOURCE_PATH)
 | 
			
		||||
	@cd ../web && pnpm run build && \cp -rf ./dist/*  ../server$(ADMIN_RESOURCE_PATH)
 | 
			
		||||
	@cd ../server
 | 
			
		||||
	@echo "y" | gf build
 | 
			
		||||
 | 
			
		||||
@@ -37,7 +37,7 @@ auth:
 | 
			
		||||
# 启动web服务
 | 
			
		||||
.PHONY: web
 | 
			
		||||
web:
 | 
			
		||||
	@cd ../web && yarn dev
 | 
			
		||||
	@cd ../web && pnpm run dev
 | 
			
		||||
 | 
			
		||||
# 刷新casbin权限
 | 
			
		||||
.PHONY: refresh
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										130
									
								
								web/package.json
									
									
									
									
									
								
							
							
						
						
									
										130
									
								
								web/package.json
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
			
		||||
{
 | 
			
		||||
  "name": "hotgo",
 | 
			
		||||
  "type": "module",
 | 
			
		||||
  "version": "2.15.7",
 | 
			
		||||
  "version": "2.15.8",
 | 
			
		||||
  "author": {
 | 
			
		||||
    "name": "MengShuai",
 | 
			
		||||
    "email": "133814250@qq.com",
 | 
			
		||||
@@ -9,106 +9,116 @@
 | 
			
		||||
  },
 | 
			
		||||
  "private": true,
 | 
			
		||||
  "scripts": {
 | 
			
		||||
    "bootstrap": "yarn install",
 | 
			
		||||
    "serve": "npm run dev",
 | 
			
		||||
    "bootstrap": "pnpm install",
 | 
			
		||||
    "serve": "pnpm run dev",
 | 
			
		||||
    "dev": "vite",
 | 
			
		||||
    "build": "vite build && esno ./build/script/postBuild.ts",
 | 
			
		||||
    "build:no-cache": "yarn clean:cache && npm run build",
 | 
			
		||||
    "report": "cross-env REPORT=true npm run build",
 | 
			
		||||
    "preview": "npm run build && vite preview",
 | 
			
		||||
    "build:no-cache": "pnpm clean:cache && pnpm run build",
 | 
			
		||||
    "report": "cross-env REPORT=true pnpm run build",
 | 
			
		||||
    "preview": "pnpm run build && vite preview",
 | 
			
		||||
    "preview:dist": "vite preview",
 | 
			
		||||
    "clean:cache": "rimraf node_modules/.cache/ && rimraf node_modules/.vite",
 | 
			
		||||
    "clean:lib": "rimraf node_modules",
 | 
			
		||||
    "build typecheck": "vuedx-typecheck . && vite build",
 | 
			
		||||
    "deploy": "gh-pages -d dist",
 | 
			
		||||
    "lint:eslint": "eslint \"{src,mock}/**/*.{vue,ts,tsx}\" --fix",
 | 
			
		||||
    "lint:prettier": "prettier --write --loglevel warn \"src/**/*.{js,json,tsx,css,less,scss,vue,html,md}\"",
 | 
			
		||||
    "lint:stylelint": "stylelint --fix \"**/*.{vue,less,postcss,css,scss}\" --cache --cache-location node_modules/.cache/stylelint/",
 | 
			
		||||
    "lint:lint-staged": "lint-staged -c ./.husky/lintstagedrc.js",
 | 
			
		||||
    "lint:pretty": "pretty-quick --staged",
 | 
			
		||||
    "build typecheck": "vuedx-typecheck . && vite build",
 | 
			
		||||
    "test prod gzip": "http-server dist --cors --gzip -c-1"
 | 
			
		||||
  },
 | 
			
		||||
  "dependencies": {
 | 
			
		||||
    "@vicons/antd": "^0.12.0",
 | 
			
		||||
    "@vicons/ionicons5": "^0.12.0",
 | 
			
		||||
    "@vue/runtime-core": "^3.4.21",
 | 
			
		||||
    "@vue/runtime-core": "^3.4.38",
 | 
			
		||||
    "@vueup/vue-quill": "^1.2.0",
 | 
			
		||||
    "@vueuse/core": "^10.9.0",
 | 
			
		||||
    "axios": "^1.7.2",
 | 
			
		||||
    "date-fns": "^2.30.0",
 | 
			
		||||
    "@vueuse/core": "^11.0.3",
 | 
			
		||||
    "axios": "^1.7.7",
 | 
			
		||||
    "blueimp-md5": "^2.19.0",
 | 
			
		||||
    "date-fns": "^3.6.0",
 | 
			
		||||
    "echarts": "^5.5.1",
 | 
			
		||||
    "element-resize-detector": "^1.2.4",
 | 
			
		||||
    "fingerprintjs2": "^2.1.4",
 | 
			
		||||
    "highlight.js": "^11.8.0",
 | 
			
		||||
    "highlight.js": "^11.10.0",
 | 
			
		||||
    "lodash-es": "^4.17.21",
 | 
			
		||||
    "mint-filter": "^4.0.3",
 | 
			
		||||
    "mitt": "^3.0.1",
 | 
			
		||||
    "naive-ui": "^2.39.0",
 | 
			
		||||
    "pinia": "^2.1.7",
 | 
			
		||||
    "pinyin-pro": "^3.16.3",
 | 
			
		||||
    "pinia": "^2.2.2",
 | 
			
		||||
    "pinyin-pro": "^3.24.2",
 | 
			
		||||
    "print-js": "^1.6.0",
 | 
			
		||||
    "qrcode.vue": "3.3.3",
 | 
			
		||||
    "qs": "^6.12.1",
 | 
			
		||||
    "qrcode.vue": "3.4.1",
 | 
			
		||||
    "qs": "^6.13.0",
 | 
			
		||||
    "quill-image-uploader": "^1.3.0",
 | 
			
		||||
    "quill-magic-url": "^4.2.0",
 | 
			
		||||
    "spark-md5": "^3.0.2",
 | 
			
		||||
    "throttle-debounce": "^5.0.0",
 | 
			
		||||
    "vue": "^3.4.31",
 | 
			
		||||
    "vue-router": "^4.4.0",
 | 
			
		||||
    "vue-types": "^4.2.1",
 | 
			
		||||
    "vue-waterfall-plugin-next": "^2.2.3",
 | 
			
		||||
    "throttle-debounce": "^5.0.2",
 | 
			
		||||
    "vfonts": "^0.0.3",
 | 
			
		||||
    "vue": "^3.4.38",
 | 
			
		||||
    "vue-router": "^4.4.3",
 | 
			
		||||
    "vue-types": "^5.1.3",
 | 
			
		||||
    "vue-waterfall-plugin-next": "^2.6.0",
 | 
			
		||||
    "vue3-json-viewer": "^2.2.2",
 | 
			
		||||
    "vuedraggable": "^4.1.0",
 | 
			
		||||
    "weixin-js-sdk": "^1.6.0"
 | 
			
		||||
    "weixin-js-sdk": "^1.6.5"
 | 
			
		||||
  },
 | 
			
		||||
  "devDependencies": {
 | 
			
		||||
    "@commitlint/cli": "^17.8.1",
 | 
			
		||||
    "@commitlint/config-conventional": "^17.8.1",
 | 
			
		||||
    "@types/lodash": "^4.17.6",
 | 
			
		||||
    "@types/node": "^18.19.39",
 | 
			
		||||
    "@typescript-eslint/eslint-plugin": "^5.62.0",
 | 
			
		||||
    "@typescript-eslint/parser": "^5.62.0",
 | 
			
		||||
    "@vitejs/plugin-vue": "^3.2.0",
 | 
			
		||||
    "@vitejs/plugin-vue-jsx": "^2.1.1",
 | 
			
		||||
    "@vue/compiler-sfc": "^3.4.31",
 | 
			
		||||
    "@vue/eslint-config-typescript": "^11.0.3",
 | 
			
		||||
    "autoprefixer": "^10.4.19",
 | 
			
		||||
    "@commitlint/cli": "^19.4.1",
 | 
			
		||||
    "@commitlint/config-conventional": "^19.4.1",
 | 
			
		||||
    "@types/lodash": "^4.17.7",
 | 
			
		||||
    "@types/node": "^22.5.2",
 | 
			
		||||
    "@typescript-eslint/eslint-plugin": "^8.4.0",
 | 
			
		||||
    "@typescript-eslint/parser": "^8.4.0",
 | 
			
		||||
    "@vitejs/plugin-vue": "^5.1.3",
 | 
			
		||||
    "@vitejs/plugin-vue-jsx": "^4.0.1",
 | 
			
		||||
    "@vue/compiler-sfc": "^3.4.38",
 | 
			
		||||
    "@vue/eslint-config-typescript": "^13.0.0",
 | 
			
		||||
    "autoprefixer": "^10.4.20",
 | 
			
		||||
    "commitizen": "^4.3.0",
 | 
			
		||||
    "core-js": "^3.37.1",
 | 
			
		||||
    "core-js": "^3.38.1",
 | 
			
		||||
    "cross-env": "^7.0.3",
 | 
			
		||||
    "crypto-js": "^4.2.0",
 | 
			
		||||
    "dotenv": "^16.4.5",
 | 
			
		||||
    "eslint": "^8.57.0",
 | 
			
		||||
    "eslint-config-prettier": "^8.10.0",
 | 
			
		||||
    "eslint-define-config": "1.12.0",
 | 
			
		||||
    "eslint-plugin-jest": "^27.9.0",
 | 
			
		||||
    "eslint-plugin-prettier": "^4.2.1",
 | 
			
		||||
    "eslint-plugin-vue": "^9.26.0",
 | 
			
		||||
    "esno": "^0.16.3",
 | 
			
		||||
    "gh-pages": "^4.0.0",
 | 
			
		||||
    "husky": "^8.0.3",
 | 
			
		||||
    "eslint": "^9.9.1",
 | 
			
		||||
    "eslint-config-prettier": "^9.1.0",
 | 
			
		||||
    "eslint-define-config": "2.1.0",
 | 
			
		||||
    "eslint-plugin-jest": "^28.8.2",
 | 
			
		||||
    "eslint-plugin-prettier": "^5.2.1",
 | 
			
		||||
    "eslint-plugin-vue": "^9.28.0",
 | 
			
		||||
    "esno": "^4.7.0",
 | 
			
		||||
    "gh-pages": "^6.1.1",
 | 
			
		||||
    "husky": "^9.1.5",
 | 
			
		||||
    "jest": "^29.7.0",
 | 
			
		||||
    "less": "^4.2.0",
 | 
			
		||||
    "less-loader": "^11.1.4",
 | 
			
		||||
    "lint-staged": "^13.3.0",
 | 
			
		||||
    "postcss": "^8.4.38",
 | 
			
		||||
    "prettier": "^2.8.8",
 | 
			
		||||
    "pretty-quick": "^3.3.1",
 | 
			
		||||
    "rimraf": "^3.0.2",
 | 
			
		||||
    "stylelint": "^14.16.1",
 | 
			
		||||
    "less-loader": "^12.2.0",
 | 
			
		||||
    "lint-staged": "^15.2.10",
 | 
			
		||||
    "mockjs": "^1.1.0",
 | 
			
		||||
    "npm-check-updates": "^17.1.1",
 | 
			
		||||
    "postcss": "^8.4.44",
 | 
			
		||||
    "prettier": "^3.3.3",
 | 
			
		||||
    "pretty-quick": "^4.0.0",
 | 
			
		||||
    "rimraf": "^6.0.1",
 | 
			
		||||
    "stylelint": "^16.9.0",
 | 
			
		||||
    "stylelint-config-prettier": "^9.0.5",
 | 
			
		||||
    "stylelint-config-standard": "^29.0.0",
 | 
			
		||||
    "stylelint-order": "^5.0.0",
 | 
			
		||||
    "stylelint-scss": "^4.7.0",
 | 
			
		||||
    "tailwindcss": "^3.4.4",
 | 
			
		||||
    "typescript": "^5.3.0",
 | 
			
		||||
    "unplugin-vue-components": "^0.22.12",
 | 
			
		||||
    "vite": "^5.3.2",
 | 
			
		||||
    "stylelint-config-standard": "^36.0.1",
 | 
			
		||||
    "stylelint-order": "^6.0.4",
 | 
			
		||||
    "stylelint-scss": "^6.5.1",
 | 
			
		||||
    "tailwindcss": "^3.4.10",
 | 
			
		||||
    "typescript": "^5.5.4",
 | 
			
		||||
    "unplugin-vue-components": "^0.27.4",
 | 
			
		||||
    "vite": "^5.4.2",
 | 
			
		||||
    "vite-plugin-compression": "^0.5.1",
 | 
			
		||||
    "vite-plugin-html": "^3.2.2",
 | 
			
		||||
    "vite-plugin-require-transform": "^1.0.5",
 | 
			
		||||
    "vite-plugin-mock": "^3.0.2",
 | 
			
		||||
    "vite-plugin-require-transform": "^1.0.21",
 | 
			
		||||
    "vite-plugin-style-import": "^2.0.0",
 | 
			
		||||
    "vite-plugin-top-level-await": "^1.2.2",
 | 
			
		||||
    "vite-plugin-top-level-await": "^1.4.4",
 | 
			
		||||
    "vite-plugin-vue-setup-extend": "^0.4.0",
 | 
			
		||||
    "vue-eslint-parser": "^9.4.3"
 | 
			
		||||
    "vue-demi": "^0.14.10",
 | 
			
		||||
    "vue-draggable-next": "^2.2.1",
 | 
			
		||||
    "vue-eslint-parser": "^9.4.3",
 | 
			
		||||
    "vuedraggable": "^4.1.0"
 | 
			
		||||
  },
 | 
			
		||||
  "lint-staged": {
 | 
			
		||||
    "*.{vue,js,ts,tsx}": "eslint --fix"
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										9520
									
								
								web/pnpm-lock.yaml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										9520
									
								
								web/pnpm-lock.yaml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -17,7 +17,7 @@
 | 
			
		||||
<script lang="ts">
 | 
			
		||||
  import { defineComponent, ref } from 'vue';
 | 
			
		||||
  import { useMessage } from 'naive-ui';
 | 
			
		||||
  import { isYesterday, addDays } from 'date-fns/esm';
 | 
			
		||||
  import { isYesterday, addDays } from 'date-fns';
 | 
			
		||||
 | 
			
		||||
  export default defineComponent({
 | 
			
		||||
    setup() {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user