修改
This commit is contained in:
@@ -1,37 +0,0 @@
|
||||
module.exports = {
|
||||
title: 'CoolAdminGo文档',
|
||||
description: 'CoolAdminGo文档',
|
||||
base: '/cool-admin-go/',
|
||||
locales: {
|
||||
'/': {
|
||||
lang: 'zh-CN',
|
||||
title: 'CoolAdminGo文档',
|
||||
description: 'CoolAdminGo文档',
|
||||
},
|
||||
},
|
||||
themeConfig: {
|
||||
logo: '/logo-admin-new.png',
|
||||
repo: 'https://github.com/cool-team-official/cool-admin-go',
|
||||
docsDir: 'docs',
|
||||
editLinks: true,
|
||||
editLinkText: '在 GitHub 上编辑此页',
|
||||
nav: [
|
||||
{ text: '首页', link: '/' },
|
||||
{ text: 'CoolAdmin官网', link: 'https://cool-js.com' },
|
||||
{ text: 'GoFrame官网', link: 'https://goframe.org' },
|
||||
],
|
||||
lastUpdated: '上次更新',
|
||||
sidebar: [
|
||||
"/",
|
||||
"/introduction",
|
||||
"/feedback",
|
||||
"/development",
|
||||
"/cli",
|
||||
"/quick_start",
|
||||
"/config",
|
||||
"/changelog",
|
||||
"/known_issues",
|
||||
],
|
||||
},
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.8 KiB |
@@ -1,89 +0,0 @@
|
||||
#!/bin/bash
|
||||
###############################################################################
|
||||
# Install Golang 安装Golang,仅限linux系统. #
|
||||
# Author: LiDong #
|
||||
# Email: cnlidong@live.cn #
|
||||
# Date: 2022-08-15 #
|
||||
###############################################################################
|
||||
# 出错退出
|
||||
set -e
|
||||
# 进入脚本所在目录
|
||||
|
||||
# 获取第一个参数设为版本号
|
||||
VERSION=$1
|
||||
# 判断版本号参数是否为空
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Usage: $0 VERSION [mirror]"
|
||||
echo "Example: $0 1.19.2 https://mirrors.aliyun.com/golang"
|
||||
echo "You can visit https://go.dev/dl/ to find version"
|
||||
exit 1
|
||||
fi
|
||||
echo "version: $VERSION"
|
||||
# 获取第二个参数为镜像地址前缀
|
||||
PREFIX=$2
|
||||
# 判断镜像地址前缀参数是否为空
|
||||
if [ -z "$PREFIX" ]; then
|
||||
PREFIX="https://go.dev/dl"
|
||||
fi
|
||||
echo "prefix: $PREFIX"
|
||||
# 判断当前用户是否为root,不是则退出
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "Error: This script must be run as root."
|
||||
echo "You can use 'sudo su' command switch to root "
|
||||
exit 1
|
||||
fi
|
||||
# 安装Golang
|
||||
echo "Install Golang..."
|
||||
# 获取当前操作系统
|
||||
OS=$(uname)
|
||||
# 判断是否是Linux系统,如果不是则退出
|
||||
if [ $OS != "Linux" ]; then
|
||||
echo "Not Linux system, exit..."
|
||||
exit
|
||||
else
|
||||
OS="linux"
|
||||
fi
|
||||
# 获取CPU类型
|
||||
ARCH=$(uname -m)
|
||||
# 转换CPU类型为go env arch格式
|
||||
if [ $ARCH = "x86_64" ]; then
|
||||
ARCH="amd64"
|
||||
elif [ $ARCH = "i686" ]; then
|
||||
ARCH="386"
|
||||
elif [ $ARCH = "armv6l" ]; then
|
||||
ARCH="armv6l"
|
||||
elif [ $ARCH = "aarch64" ]; then
|
||||
ARCH="arm64"
|
||||
else
|
||||
echo "Not support CPU, exit..."
|
||||
exit
|
||||
fi
|
||||
# 安装Golang
|
||||
echo "Download Golang..."
|
||||
echo $PREFIX/go${VERSION}.$OS-$ARCH.tar.gz
|
||||
curl -L $PREFIX/go${VERSION}.$OS-$ARCH.tar.gz -o /tmp/go${VERSION}.$OS-$ARCH.tar.gz
|
||||
tar -C /usr/local -xzf /tmp/go${VERSION}.$OS-$ARCH.tar.gz
|
||||
# 删除临时文件
|
||||
rm -f /tmp/go${VERSION}.$OS-$ARCH.tar.gz
|
||||
# 配置环境变量
|
||||
echo 'export PATH=$PATH:/usr/local/node/bin' >>/etc/profile
|
||||
|
||||
echo 'export PATH=$PATH:/usr/local/go/bin' >>/etc/profile
|
||||
|
||||
source /etc/profile
|
||||
|
||||
echo 'export PATH=$PATH:$(go env GOPATH)/bin' >>/etc/profile
|
||||
go env -w GO111MODULE=on
|
||||
go env -w GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
source /etc/profile
|
||||
|
||||
# 安装成功
|
||||
echo "Install Golang success!"
|
||||
# 查看Golang版本
|
||||
go version
|
||||
# 提示重启终端
|
||||
echo "Please restart the terminal to take effect!"
|
||||
echo "安装成功,请重启终端使其生效!"
|
||||
echo "You can use 'source /etc/profile' command to make the PATH changes effective immediately."
|
||||
echo "你可以使用 'source /etc/profile' 命令使其立即生效."
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Install Node.js on linux x86_64
|
||||
|
||||
# 出错时停止
|
||||
set -e
|
||||
|
||||
# 判断当前操作系统是否为Linux,如果不是则退出
|
||||
if [ "$(uname)" != "Linux" ]; then
|
||||
echo "Error: This script only supports Linux."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 获取当前CPU架构
|
||||
ARCH=$(uname -m)
|
||||
|
||||
# 判断当前CPU架构是否为x86_64,如果不是则退出
|
||||
if [ "$ARCH" != "x86_64" ]; then
|
||||
echo "Error: This script only supports x86_64."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 判断当前是否为root,如果不是则退出
|
||||
if [ "$(id -u)" != "0" ]; then
|
||||
echo "Error: This script must be run as root."
|
||||
echo "You can use 'sudo su' command switch to root "
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 获取第一个参数为版本号
|
||||
VERSION=$1
|
||||
|
||||
# 校验版本号
|
||||
if [ -z "$VERSION" ]; then
|
||||
echo "Usage: $0 VERSION"
|
||||
echo "Example: $0 18.12.0"
|
||||
echo "You can visit https://nodejs.org/en/download/ to find version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 校验版本号格式
|
||||
if ! echo "$VERSION" | grep -qE '^[0-9]+\.[0-9]+\.[0-9]+$'; then
|
||||
echo "Invalid version: $VERSION, should be like 1.2.3"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 下载安装包
|
||||
wget https://nodejs.org/dist/v$VERSION/node-v$VERSION-linux-x64.tar.xz
|
||||
|
||||
# 解压
|
||||
tar -xvf node-v$VERSION-linux-x64.tar.xz
|
||||
|
||||
# 移动到 /usr/local
|
||||
mv node-v$VERSION-linux-x64 /usr/local/node
|
||||
|
||||
# 添加到环境变量
|
||||
echo 'export PATH=$PATH:/usr/local/node/bin' >>/etc/profile
|
||||
|
||||
# 使环境变量生效
|
||||
source /etc/profile
|
||||
# 删除安装包
|
||||
rm node-v$VERSION-linux-x64.tar.xz
|
||||
# 查看版本
|
||||
node -v
|
||||
npm -v
|
||||
# 激活yarn
|
||||
corepack enable
|
||||
# 配置淘宝镜像
|
||||
npm config set registry https://registry.npmmirror.com
|
||||
# 查看配置
|
||||
npm config list
|
||||
# 提示安装成功
|
||||
echo "Node.js $VERSION installed successfully."
|
||||
# 提示用户重启终端
|
||||
echo "Please restart your terminal to make the PATH changes effective."
|
||||
echo "You can use 'source /etc/profile' command to make the PATH changes effective immediately."
|
||||
@@ -1,25 +0,0 @@
|
||||
# CoolAdminGo 文档
|
||||
|
||||
本文档使用`vuepress`编写,可使用`cool-tools docs`进行本地预览。版本随`CoolAdminGo`版本更新。
|
||||
|
||||
## 文档目录
|
||||
|
||||
- [介绍](introduction.md)
|
||||
- [问题反馈](feedback.md)
|
||||
- [开发环境](development.md)
|
||||
- [开发工具](cli.md)
|
||||
- [快速开始](quick_start.md)
|
||||
- [配置](config.md)
|
||||
- [CRUD](crud.md)
|
||||
- [数据库](database.md)
|
||||
- [文件上传](file_upload.md)
|
||||
- [表单验证](form_validate.md)
|
||||
- [系统模块](system_module.md)
|
||||
- [分布式函数](distributed_function.md)
|
||||
- [定时任务](cron.md)
|
||||
- [部署](deploy.md)
|
||||
- [日志](log.md)
|
||||
- [常见问题](faq.md)
|
||||
- [更新日志](changelog.md)
|
||||
- [已知问题](known_issues.md)
|
||||
- [贡献代码](contributing.md)
|
||||
@@ -1,92 +0,0 @@
|
||||
# 更新日志
|
||||
|
||||
## 1.5.0
|
||||
|
||||
- 更新 gf 至 v2.4.0
|
||||
|
||||
## 1.0.19
|
||||
|
||||
- 修复base/parma模块的bug 感谢 @vera-byte
|
||||
|
||||
## 1.0.18
|
||||
|
||||
- 增加app接口下的EPS以匹配cool-uni
|
||||
- 更新依赖
|
||||
|
||||
|
||||
## 1.0.17
|
||||
|
||||
- list page 接口增加 ModifyAfter 钩子,用于对数据进行修改
|
||||
- 更新 gf 至 v2.3.2
|
||||
|
||||
|
||||
## 1.0.16
|
||||
|
||||
- 更新依赖
|
||||
- cool-tools创建的项目增加容器开发环境
|
||||
|
||||
## 1.0.15
|
||||
|
||||
- 更新 gf 至 v2.3.1
|
||||
|
||||
## 1.0.14
|
||||
|
||||
- 更新 gf 至 v2.3.0
|
||||
- 调整 base 模块中的事务对象为接口定义以匹配 gf 的变更
|
||||
- 引入 redis 库(gf v2.3.0 版本 redis 拆分为单独的库)
|
||||
- 增加用户时对密码进行 md5 加密
|
||||
|
||||
## 1.0.13
|
||||
|
||||
- 增加 pgsql 支持
|
||||
- 调整部分表字段类型以兼容 pgsql
|
||||
|
||||
## 1.0.12
|
||||
|
||||
- 更新 gf 版本至 v2.2.6(sql 统计中 total 由 int64 修改为 int)
|
||||
|
||||
## 1.0.11
|
||||
|
||||
- 修复 dict 模块的 bug
|
||||
|
||||
## 1.0.10
|
||||
|
||||
- 修复 base/menu/add 不支持数组菜单的问题
|
||||
|
||||
## 1.0.9
|
||||
|
||||
- GetCfgWithDefault 函数支持环境变量,优先级 配置文件>环境变量>默认值
|
||||
- 更新 gf 版本至 v2.2.5 修复软删除 bug
|
||||
|
||||
## 1.0.8
|
||||
|
||||
- 更新依赖包版本
|
||||
- 调整 cool-tools version 命令输出格式
|
||||
- 修复 go install 模式安装的 cool-tools docs 命令无法使用的问题
|
||||
|
||||
## 1.0.7
|
||||
|
||||
- 更新 gf 依赖至 v2.2.4
|
||||
- cool-tools 增加 -y 支持
|
||||
- 集成 gf pack
|
||||
|
||||
## 1.0.6
|
||||
|
||||
- docs 独立为单独 mod,减小主库体积
|
||||
- 清理部分无用文件,减小主库体积
|
||||
- 更新依赖
|
||||
- 主库移除内置的前端
|
||||
- 增加 make frontend 命令,用于构建前端
|
||||
- 权限中间件移除部分 Debug 日志
|
||||
- 清理 cool-tools 模块部分无用文件
|
||||
- 引入 gf 的 run 命令至 cool-tools 模块
|
||||
- 引入 gf 的 build 命令至 cool-tools 模块
|
||||
- 调整 cool-tools 使用 hack 目录下的配置文件
|
||||
|
||||
## 1.0.5
|
||||
|
||||
- 本次更新主要针对主库开发环境
|
||||
- Added changelog.md
|
||||
- 更新主框架开发用前端打包脚本 使用 make public 更新
|
||||
- 更新主框架支持 remote container 开发, 基于`cool-admin-codespace`镜像
|
||||
- 调整优化文档发布,更新了一些依赖
|
||||
88
docs/cli.md
88
docs/cli.md
@@ -1,88 +0,0 @@
|
||||
# 开发工具
|
||||
|
||||
[返回目录](README.md)
|
||||
|
||||
::: warning 注意
|
||||
以下部分命令需您已经安装了 Go 语言环境,如果没有安装,请自行安装,如果已经安装,请自行配置环境变量
|
||||
:::
|
||||
|
||||
## cool-tools
|
||||
|
||||
cool-tools 是一个用于快速生成`CoolAdminGo`项目的脚手架工具,可用于快速生成项目、模块、页面、接口等。
|
||||
|
||||
### `cool-tools`安装
|
||||
|
||||
Linux, Mac 可使用以下命令安装:
|
||||
|
||||
从 github 下载
|
||||
|
||||
```bash
|
||||
wget -O cool-tools \
|
||||
https://github.com/cool-team-official/cool-admin-go/releases/latest/download/cool-tools_$(go env GOOS)_$(go env GOARCH) \
|
||||
&& chmod +x cool-tools \
|
||||
&& ./cool-tools install \
|
||||
&& rm ./cool-tools
|
||||
```
|
||||
|
||||
从镜像下载
|
||||
|
||||
```bash
|
||||
wget -O cool-tools \
|
||||
https://gh.hjmcloud.cn/github.com/cool-team-official/cool-admin-go/releases/latest/download/cool-tools_$(go env GOOS)_$(go env GOARCH) \
|
||||
&& chmod +x cool-tools \
|
||||
&& ./cool-tools install \
|
||||
&& rm ./cool-tools
|
||||
```
|
||||
|
||||
验证
|
||||
|
||||
```bash
|
||||
cool-tools version
|
||||
```
|
||||
|
||||
Windows 可以直接下载编译后的可执行文件,下载地址:[releases](https://github.com/cool-team-official/cool-admin-go/releases),选择对应的版本下载。下载后复制到`PATH`环境变量中的目录下即可。
|
||||
|
||||
::: tip 提示
|
||||
在正确地将 GOPATH/bin 目录添加到 PATH 环境变量中后,可以直接使用`go install`命令安装,因为该安装方式为本地编译安装,可享受`goproxy`的加速服务,安装速度更快,适用于所有平台。
|
||||
:::
|
||||
|
||||
```bash
|
||||
go install github.com/cool-team-official/cool-admin-go/cool-tools@latest
|
||||
```
|
||||
|
||||
|
||||
## gf
|
||||
|
||||
`GoFrame`框架提供了功能强大的`gf`命令行开发辅助工具,是框架发展的一个重要组成部分。
|
||||
|
||||
### `gf`安装
|
||||
|
||||
Linux, Mac 可使用以下命令安装:
|
||||
|
||||
从 github 下载
|
||||
|
||||
```bash
|
||||
wget -O gf \
|
||||
https://github.com/gogf/gf/releases/latest/download/gf_$(go env GOOS)_$(go env GOARCH) \
|
||||
&& chmod +x gf \
|
||||
&& ./gf install \
|
||||
&& rm ./gf
|
||||
```
|
||||
|
||||
使用镜像下载
|
||||
|
||||
```
|
||||
wget -O gf \
|
||||
https://gh.hjmcloud.cn/github.com/gogf/gf/releases/latest/download/gf_$(go env GOOS)_$(go env GOARCH) \
|
||||
&& chmod +x gf \
|
||||
&& ./gf install \
|
||||
&& rm ./gf
|
||||
```
|
||||
|
||||
验证
|
||||
|
||||
```bash
|
||||
gf version
|
||||
```
|
||||
|
||||
更多`gf`工具的安装使用说明,可以访问 [https://goframe.org/pages/viewpage.action?pageId=1114260](https://goframe.org/pages/viewpage.action?pageId=1114260)
|
||||
154
docs/config.md
154
docs/config.md
@@ -1,154 +0,0 @@
|
||||
# 配置
|
||||
|
||||
[返回目录](README.md)
|
||||
|
||||
## 配置文件
|
||||
|
||||
`CoolAdminGo`配置文件默认位于`mainfest/config/config.yaml`.继承自`GoFrame`的配置文件,支持多种格式,包括`yaml`、`toml`、`json`、`ini`、`xml`等。可访问[GoFrame 配置文件](https://goframe.org/pages/viewpage.action?pageId=1114668)查看更多配置文件格式。
|
||||
|
||||
## 数据库配置
|
||||
|
||||
`CoolAdminGo`支持多种数据库,可通过引入不同的依赖包进行切换,同时您也可以开发自己的数据库驱动。
|
||||
|
||||
### SQLite 配置
|
||||
|
||||
使用`sqllite`数据库时,需在`main.go`中引入`_ "github.com/cool-team-official/cool-admin-go/contrib/drivers/sqlite"`包,然后在`config.yaml`中配置`sqlite`数据库。
|
||||
|
||||
::: warning 注意
|
||||
`sqlite`引入应早于使用数据库的包, 为防止编辑器自动排序,可在数据包引入下方加一个空行。
|
||||
:::
|
||||
|
||||
```go
|
||||
// main.go
|
||||
import (
|
||||
// 引入sqlite驱动
|
||||
_ "github.com/cool-team-official/cool-admin-go/contrib/drivers/sqlite"
|
||||
|
||||
// 引入其他包
|
||||
"github.com/cool-team-official/cool-admin-go/pkg/dao"
|
||||
|
||||
)
|
||||
```
|
||||
|
||||
配置文件中相关配置如下:
|
||||
|
||||
```yaml
|
||||
database:
|
||||
default: # 数据源名称,当不指定数据源时 default 为默认数据源
|
||||
type: "sqlite" # 数据库类型
|
||||
link: "cool.sqlite" # 数据库文件名称,可以带路径,如:/tmp/cool.sqlite
|
||||
extra: busy_timeout=5000 # 数据库连接扩展参数
|
||||
createdAt: "createTime" # 创建时间字段
|
||||
updatedAt: "updateTime" # 更新时间字段
|
||||
debug: true # 是否开启调试模式,开启后会打印SQL日志
|
||||
```
|
||||
|
||||
### MySQL 配置
|
||||
|
||||
使用`mysql`数据库时,需在`main.go`中引入`_ "github.com/cool-team-official/cool-admin-go/contrib/drivers/mysql"`包,然后在`config.yaml`中配置`mysql`数据库。
|
||||
|
||||
::: warning 注意
|
||||
`mysql`引入应早于使用数据库的包, 为防止编辑器自动排序,可在数据包引入下方加一个空行。
|
||||
:::
|
||||
|
||||
```go
|
||||
// main.go
|
||||
import (
|
||||
// 引入mysql驱动
|
||||
_ "github.com/cool-team-official/cool-admin-go/contrib/drivers/mysql"
|
||||
|
||||
// 引入其他包
|
||||
"github.com/cool-team-official/cool-admin-go/pkg/dao"
|
||||
|
||||
)
|
||||
```
|
||||
|
||||
配置文件中相关配置如下:
|
||||
|
||||
```yaml
|
||||
database:
|
||||
default: # 数据源名称,当不指定数据源时 default 为默认数据源
|
||||
type: "mysql" # 数据库类型
|
||||
host: "127.0.0.1" # 数据库地址
|
||||
port: "3306" # 数据库端口
|
||||
user: "root" # 数据库用户名
|
||||
pass: "123456" # 数据库密码
|
||||
name: "cooltest" # 数据库名称
|
||||
charset: "utf8mb4" # 数据库编码
|
||||
timezone: "Asia/Shanghai" # 数据库时区
|
||||
debug: true # 是否开启调试模式,开启后会打印SQL日志
|
||||
createdAt: "createTime" # 创建时间字段
|
||||
updatedAt: "updateTime" # 更新时间字段
|
||||
```
|
||||
|
||||
可以使用`docker-compose`快速启动一个`mysql`数据库,配置如下:
|
||||
|
||||
```yaml
|
||||
# docker-compose.yaml
|
||||
version: "3"
|
||||
services:
|
||||
# mysql8 数据库
|
||||
mysql8:
|
||||
image: mysql:8
|
||||
container_name: mysql8
|
||||
command: --default-authentication-plugin=mysql_native_password --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
|
||||
# restart: always # 重启策略
|
||||
environment:
|
||||
TZ: Asia/Shanghai # 指定时区
|
||||
MYSQL_ROOT_PASSWORD: "123456" # 配置root用户密码
|
||||
MYSQL_DATABASE: "cooltest" # 业务库名
|
||||
MYSQL_USER: "cooltest" # 业务库用户名
|
||||
MTSQL_PASSWORD: "123123" # 业务库密码
|
||||
ports:
|
||||
- 3306:3306
|
||||
volumes:
|
||||
- ./data/mysql/:/var/lib/mysql/
|
||||
```
|
||||
|
||||
启动`mysql`数据库:
|
||||
|
||||
```bash
|
||||
docker compose -f "docker-compose.yml" up -d --build mysql8
|
||||
```
|
||||
|
||||
关闭`mysql`数据库:
|
||||
|
||||
```bash
|
||||
docker compose -f "docker-compose.yml" down mysql8
|
||||
```
|
||||
|
||||
### PostgreSQL 配置
|
||||
|
||||
使用`postgresql`数据库时,需在`main.go`中引入`_ "github.com/cool-team-official/cool-admin-go/contrib/drivers/pgsql"`包,然后在`config.yaml`中配置`postgresql`数据库。
|
||||
|
||||
::: warning 注意
|
||||
`postgresql`引入应早于使用数据库的包, 为防止编辑器自动排序,可在数据包引入下方加一个空行。
|
||||
:::
|
||||
|
||||
```go
|
||||
// main.go
|
||||
import (
|
||||
// 引入postgresql驱动
|
||||
_ "github.com/cool-team-official/cool-admin-go/contrib/drivers/pgsql"
|
||||
|
||||
// 引入其他包
|
||||
"github.com/cool-team-official/cool-admin-go/pkg/dao"
|
||||
|
||||
)
|
||||
```
|
||||
|
||||
配置文件中相关配置如下:
|
||||
|
||||
```yaml
|
||||
database:
|
||||
default:
|
||||
type: "pgsql" # 数据库类型
|
||||
host: "127.0.0.1" # 数据库地址
|
||||
port: "5432" # 数据库端口
|
||||
user: "cooltest" # 数据库用户名
|
||||
pass: "123456" # 数据库密码
|
||||
name: "cooltest" # 数据库名称
|
||||
debug: true # 是否开启调试模式,开启后会打印SQL日志
|
||||
createdAt: "createTime" # 创建时间字段
|
||||
updatedAt: "updateTime" # 更新时间字段
|
||||
```
|
||||
@@ -1,118 +0,0 @@
|
||||
# 开发环境
|
||||
|
||||
[返回目录](README.md)
|
||||
|
||||
::: warning 注意
|
||||
推荐使用 Linux 或 MacOS 进行开发,Windows 下可使用 WSL2。
|
||||
|
||||
Linux 及 WSL2 下推荐使用 root 用户进行开发.
|
||||
:::
|
||||
|
||||
## Node.js 环境
|
||||
|
||||
官网下载地址:[https://nodejs.org/en/download/](https://nodejs.org/en/download/)
|
||||
|
||||
一般选择 LTS 版本即可。
|
||||
|
||||
MacOS 下可使用 Homebrew 进行安装 nvm:
|
||||
|
||||
```bash
|
||||
brew install nvm
|
||||
```
|
||||
|
||||
nvm 是 node 版本管理工具,可以通过`nvm install <version>` 安装指定版本,使用 `nvm use <version>` 切换版本。
|
||||
|
||||
或者直接下载 pkg 安装包进行安装。
|
||||
|
||||
Linux 下可使用以下脚本进行安装:
|
||||
|
||||
```bash
|
||||
wget -O nodejs-install.sh https://cool-team-official.github.io/cool-admin-go/scripts/nodejs-install.sh \
|
||||
&& chmod +x nodejs-install.sh \
|
||||
&& ./nodejs-install.sh 18.12.0
|
||||
```
|
||||
|
||||
脚本文件内容如下:
|
||||
|
||||
<<< @/docs/.vuepress/public/scripts/nodejs-install.sh
|
||||
|
||||
::: tip
|
||||
安装完成后,可使用`node -v`查看版本号,使用`npm -v`查看 npm 版本号。
|
||||
为提高依赖包下载速度,可使用`npm config set registry https://registry.npmmirror.com`切换到淘宝镜像。
|
||||
新版本的 node 已经集成了 yarn,需激活`corepack`,可使用 `corepack enable`命令激活。激活后可使用`yarn -v`查看版本号。
|
||||
|
||||
Linux 安装脚本已完成镜像切换及 corepack 激活。
|
||||
:::
|
||||
|
||||
## Go 环境
|
||||
|
||||
官网下载地址:[https://go.dev/dl/](https://go.dev/dl/)
|
||||
|
||||
一般选择最新版本即可。
|
||||
|
||||
MacOS 下可使用 Homebrew 进行安装:
|
||||
|
||||
```bash
|
||||
brew install go
|
||||
```
|
||||
|
||||
或者直接下载 pkg 安装包进行安装。
|
||||
|
||||
Linux 下可使用以下脚本进行安装:
|
||||
|
||||
```bash
|
||||
wget -O golang-install.sh https://cool-team-official.github.io/cool-admin-go/scripts/golang-install.sh \
|
||||
&& chmod +x golang-install.sh \
|
||||
&& ./golang-install.sh 1.19.3
|
||||
```
|
||||
|
||||
脚本文件内容如下:
|
||||
|
||||
<<< @/docs/.vuepress/public/scripts/golang-install.sh
|
||||
|
||||
::: tip
|
||||
安装完成后,可使用`go version`查看版本号。
|
||||
为提高依赖下载速度,推荐配置`goproxy`,可使用`go env -w GOPROXY=https://goproxy.cn,direct`切换到 goproxy.cn 镜像。
|
||||
:::
|
||||
|
||||
## VSCode
|
||||
|
||||
官网下载地址:[https://code.visualstudio.com/](https://code.visualstudio.com/)
|
||||
|
||||
一般选择最新版本即可。
|
||||
|
||||
推荐安装以下插件:
|
||||
|
||||
- [Go](https://marketplace.visualstudio.com/items?itemName=golang.go)
|
||||
- [Vetur](https://marketplace.visualstudio.com/items?itemName=octref.vetur)
|
||||
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
|
||||
- [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
|
||||
- [EditorConfig](https://marketplace.visualstudio.com/items?itemName=EditorConfig.EditorConfig)
|
||||
- [GitLens](https://marketplace.visualstudio.com/items?itemName=eamodio.gitlens)
|
||||
|
||||
## Docker
|
||||
|
||||
云原生时代,Docker 已经成为开发者必备的工具之一。
|
||||
|
||||
开发过程中,我们将使用 Docker 进行数据库管理,以及打包测试。
|
||||
|
||||
官网下载地址:[https://www.docker.com/products/docker-desktop](https://www.docker.com/products/docker-desktop)
|
||||
|
||||
一般选择最新版本即可。
|
||||
|
||||
配置 Docker 镜像加速器:
|
||||
|
||||
```bash
|
||||
# Linux
|
||||
sudo mkdir -p /etc/docker
|
||||
sudo tee /etc/docker/daemon.json <<-'EOF'
|
||||
{
|
||||
"registry-mirrors": ["https://registry.docker-cn.com"]
|
||||
}
|
||||
EOF
|
||||
sudo systemctl daemon-reload
|
||||
sudo systemctl restart docker
|
||||
|
||||
```
|
||||
|
||||
MacOS 及 Windows 下可在 Docker Desktop 的设置中配置。
|
||||
@@ -1,48 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
# This script deploys the documentation to the gh-pages branch.
|
||||
# 发布文档到 https://cooladmingo.github.io
|
||||
|
||||
# 确保脚本抛出遇到的错误
|
||||
set -e
|
||||
# 检测是否存在 package.json,如果不存在,说明运行目录不对
|
||||
if [ ! -f "package.json" ]; then
|
||||
echo "package.json not found, please run this script in the root directory of the project"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# 生成静态文件
|
||||
npm run docs:build
|
||||
|
||||
# 进入生成的文件夹
|
||||
cd docs/.vuepress/dist
|
||||
|
||||
# 如果是发布到自定义域名
|
||||
# echo 'www.example.com' > CNAME
|
||||
|
||||
# 获取当前时间
|
||||
now=$(date "+%Y.%m.%d-%H.%M.%S")
|
||||
echo "${now}" > version.txt
|
||||
|
||||
|
||||
git init
|
||||
git add -A
|
||||
git commit -m 'deploy'
|
||||
|
||||
# 如果当前运行在 github codespace 中, 则使用 https 方式提交.否则使用 ssh 方式提交
|
||||
if [ -n "$CODESPACES" ]; then
|
||||
echo "github codespace detected, using https to push"
|
||||
git push -f https://github.com/cool-team-official/cool-admin-go.git main:gh-pages
|
||||
else
|
||||
echo "github codespace not detected, use ssh"
|
||||
git push -f git@github.com:cool-team-official/cool-admin-go.git master:gh-pages
|
||||
fi
|
||||
|
||||
# 如果发布到 https://<USERNAME>.github.io
|
||||
# git push -f git@github.com:cooladmingo/cooladmingo.github.io.git master:gh-pages
|
||||
# git push -f https://github.com/cool-team-official/cool-admin-go.git master:gh-pages
|
||||
|
||||
# 如果发布到 https://<USERNAME>.github.io/<REPO>
|
||||
# git push -f git@github.com:<USERNAME>/<REPO>.git master:gh-pages
|
||||
|
||||
cd -
|
||||
@@ -1 +0,0 @@
|
||||
package docs
|
||||
@@ -1,13 +0,0 @@
|
||||
# 问题反馈
|
||||
|
||||
[返回目录](README.md)
|
||||
|
||||
## 方式一
|
||||
|
||||
在代码仓库中提交[issue](https://github.com/cool-team-official/cool-admin-go/issues)
|
||||
|
||||
## 方式二
|
||||
|
||||
技术交流群
|
||||
|
||||

|
||||
@@ -1,3 +0,0 @@
|
||||
module github.com/cool-team-official/cool-admin-go/docs
|
||||
|
||||
go 1.18
|
||||
@@ -1,30 +0,0 @@
|
||||
# 项目介绍
|
||||
|
||||
[返回目录](README.md)
|
||||
|
||||
`CoolAdminGo` 基于 [goframe](https://goframe.org) 开发的后端项目,提供了基础的 CURD 结构,以及基础的用户管理模块,可以快速搭建后端项目。做为`CoolAdmin`系列的`go`版本后端,提供了与`node`版本后端相同的接口,可以快速切换前端项目。
|
||||
|
||||
`GoFrame`是一款模块化、高性能、企业级的 Go 基础开发框架。`GoFrame`是一款通用性的基础开发框架,是 Golang 标准库的一个增强扩展级,包含通用核心的基础开发组件,优点是实战化、模块化、文档全面、模块丰富、易用性高、通用性强、面向团队。如果您想使用 Golang 开发一个业务型项目,无论是小型还是中大型项目,`GoFrame`是您的不二之选。如果您想开发一个 Golang 组件库,`GoFrame`提供开箱即用、丰富强大的基础组件库也能助您的工作事半功倍。如果您是团队 Leader,`GoFrame`丰富的资料文档、详尽的代码注释、活跃的社区成员将会极大降低您的指导成本,支持团队快速接入、语言转型与能力提升。
|
||||
|
||||
## 代码仓库
|
||||
|
||||
CoolAdminGo 是开源免费的,遵循`MIT`开源协议,意味着您无需支付任何费用,也无需授权,即可将它应用到您的产品中。
|
||||
|
||||
::: warning 注意
|
||||
开源免费,并不意味着您可以将 cool-admin 应用到非法的领域,比如涉及赌博,暴力等方面。如因此产生纠纷等法律问题,cool-admin 不承担任何责任。
|
||||
:::
|
||||
|
||||
CoolAdminGo 代码仓库地址:[https://github.com/cool-team-official/cool-admin-go](https://github.com/cool-team-official/cool-admin-go)
|
||||
|
||||
::: tip 提示
|
||||
如果您觉得 CoolAdminGo 帮助到了您,欢迎给我们点个 star,您的支持是我们最大的动力。
|
||||
|
||||
通常情况下,您并不需要直接使用 CoolAdminGo 代码仓库,而是使用我们提供的脚手架工具,快速搭建项目。
|
||||
:::
|
||||
|
||||
## 技术选型
|
||||
|
||||
- [CoolAdmin](https://cool-js.com):`CoolAdmin` 项目官网。
|
||||
- [GoFrame](https://goframe.org):`GoFrame` 项目官网, `CoolAdminGo` 基于 `GoFrame` 开发。
|
||||
- [Gorm](https://gorm.io):`Gorm` 数据库操作库, `CoolAdminGo` 基于 `Gorm` 实现数据表创建功能。
|
||||
- [Goproxy](https://goproxy.cn):`Goproxy` 代理。
|
||||
@@ -1,4 +0,0 @@
|
||||
# 已知问题
|
||||
|
||||
[返回目录](README.md)
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
# 快速开始
|
||||
|
||||
[返回目录](README.md)
|
||||
|
||||
## 工程目录
|
||||
|
||||
一个合理的工程目录可以让开发更加高效,`CoolAdminGo`项目推荐的工程目录如下:
|
||||
|
||||
```bash
|
||||
# 假定项目名称为 cool-study
|
||||
|
||||
cool-study/
|
||||
├── backend # 后端代码
|
||||
├── cool-study # 主库,存放生产部署相关脚本等
|
||||
├── frontend # 前端代码
|
||||
└── mobile # 移动端代码
|
||||
```
|
||||
|
||||
## 创建后端项目
|
||||
|
||||
```bash
|
||||
# 创建工程目录
|
||||
mkdir cool-study
|
||||
# 进入工程目录
|
||||
cd cool-study
|
||||
# 创建后端代码目录
|
||||
cool-tools init backend
|
||||
# 进入后端代码目录
|
||||
cd backend
|
||||
# 安装依赖
|
||||
go mod tidy
|
||||
# 开发模式运行后端项目
|
||||
gf run main.go
|
||||
```
|
||||
|
||||
## 创建前端项目
|
||||
|
||||
```bash
|
||||
# 进入工程目录
|
||||
cd cool-study
|
||||
# 拉取前端代码
|
||||
git clone https://github.com/cool-team-official/cool-admin-vue frontend
|
||||
# 如果网络不好,可以使用国内镜像
|
||||
git clone https://gitee.com/cool-team-official/cool-admin-vue frontend
|
||||
# 进入前端代码目录
|
||||
cd frontend
|
||||
# 安装依赖
|
||||
yarn
|
||||
```
|
||||
Reference in New Issue
Block a user