chore: 删除无用的脚本和规则文件
- 移除 .lingma/rules/project_rule.md 文件 - 删除 clean.sh、daemon.json、frontend.sh、init.sh、other_pack.sh 和 windows_pack.bat 脚本
This commit is contained in:
@@ -1,2 +0,0 @@
|
||||
**添加规则文件可帮助模型精准理解你的编码偏好,如框架、代码风格等**
|
||||
**规则文件只对当前工程生效,单文件限制10000字符。如果无需将该文件提交到远程 Git 仓库,请将其添加到 .gitignore**
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/bin/bash
|
||||
# 清理容器及存储卷
|
||||
|
||||
# 出错退出
|
||||
set -e
|
||||
|
||||
# 如果 REMOTE_CONTAINERS 为 true,则为容器开发环境,退出不执行
|
||||
if [ "$REMOTE_CONTAINERS" = "true" ]; then
|
||||
echo "Container development environment, please change to local development environment to execute this script"
|
||||
echo "当前为容器开发环境,请切换到本地开发环境执行"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# 读取 data/hostname.txt文件内容为容器ID
|
||||
hostname=$(cat data/hostname.txt)
|
||||
|
||||
# 如果hostname为空,则退出
|
||||
if [ -z "$hostname" ]; then
|
||||
echo "hostname is empty, please check data/hostname.txt"
|
||||
echo "hostname为空,请检查 data/hostname.txt"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# get image id by container id
|
||||
imageId=$(docker inspect -f '{{.Image}}' $hostname)
|
||||
|
||||
# 清理容器
|
||||
echo "Cleaning containers ..."
|
||||
docker rm -v -f $hostname
|
||||
echo "Cleaning containers ... done"
|
||||
|
||||
# 清理镜像
|
||||
echo "Cleaning images ..."
|
||||
docker image rm -f $imageId
|
||||
echo "Cleaning images ... done"
|
||||
@@ -1,6 +0,0 @@
|
||||
{
|
||||
"registry-mirrors": [
|
||||
"https://hub-mirror.c.163.com",
|
||||
"https://mirror.baidubce.com"
|
||||
]
|
||||
}
|
||||
@@ -1,64 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# 出错退出
|
||||
set -e
|
||||
|
||||
# 获取程序根目录
|
||||
ROOT_DIR=$(pwd)
|
||||
echo "ROOT_DIR: $ROOT_DIR"
|
||||
# 如果运行目录不存在Makefile,则退出
|
||||
if [ ! -f "Makefile" ]; then
|
||||
echo "Makefile not found, please run this script in the project root directory"
|
||||
echo "请使用 make frontend 命令在项目根目录运行此脚本"
|
||||
exit 1
|
||||
fi
|
||||
# 下载最新的前端代码并打包
|
||||
if [ ! -d "$ROOT_DIR/data" ]; then
|
||||
echo "data directory not found, creating data directory"
|
||||
mkdir -p $ROOT_DIR/data
|
||||
fi
|
||||
cd $ROOT_DIR/data
|
||||
# 如果已经存在前端代码,则删除
|
||||
if [ -d "$ROOT_DIR/data/cool-admin-vue" ]; then
|
||||
echo "cool-admin-vue directory found, deleting cool-admin-vue directory"
|
||||
rm -rf $ROOT_DIR/data/cool-admin-vue
|
||||
fi
|
||||
# 如果当前为codespace开发环境,则使用git clone,否则使用pgit clone
|
||||
if [ "$CODESPACES" = "true" ]; then
|
||||
echo "Cloning cool-admin-vue from github using git"
|
||||
git clone --depth=1 https://github.com/cool-team-official/cool-admin-vue.git
|
||||
else
|
||||
echo "Cloning cool-admin-vue from github use pgit"
|
||||
pgit clone --depth=1 https://github.com/cool-team-official/cool-admin-vue.git
|
||||
fi
|
||||
|
||||
# 进入前端代码目录
|
||||
cd $ROOT_DIR/data/cool-admin-vue
|
||||
# 替换 src/cool/config/index.ts 中的 mode: "history" 为 mode: "hash"
|
||||
sed -i 's#mode: "history"#mode: "hash"#g' src/cool/config/index.ts
|
||||
# 替换 src/cool/config/prod.ts 中的 baseUrl: "/api" 为 baseUrl: "/"
|
||||
sed -i 's#baseUrl: "/api"#baseUrl: ""#g' src/cool/config/prod.ts
|
||||
|
||||
# 替换yarn.lock中的npm镜像地址
|
||||
sed -i 's#https://registry.npmjs.org/#https://registry.npmmirror.com/#g' yarn.lock
|
||||
# 安装前端依赖
|
||||
echo "Installing front-end dependencies"
|
||||
yarn install
|
||||
# # 打包前端代码
|
||||
echo "Building front-end code"
|
||||
yarn build
|
||||
|
||||
|
||||
# ## 如果存在 data/public 目录,则删除
|
||||
# cd $ROOT_DIR
|
||||
# if [ -d "data/public" ]; then
|
||||
# echo "$ROOT_DIR/data/public directory found, deleting $ROOT_DIR/data/public directory"
|
||||
# rm -rf $ROOT_DIR/data/public
|
||||
# fi
|
||||
# ## 移动dist目录到data目录并重命名为public
|
||||
# echo "Moving dist directory to data directory and renaming it to public"
|
||||
# mv $ROOT_DIR/data/cool-admin-vue/dist $ROOT_DIR/data/public
|
||||
# ## gf 打包
|
||||
# cd $ROOT_DIR/data
|
||||
# echo "Packaging public directory"
|
||||
# gf pack public $ROOT_DIR/internal/packed/public.go -y
|
||||
@@ -1,82 +0,0 @@
|
||||
#!/bin/bash
|
||||
# This script is used to initialize the environment for the project
|
||||
# Usage: ./init.sh
|
||||
# Author: LiDong
|
||||
# Date: 2022-11-08
|
||||
|
||||
# 出错退出
|
||||
set -e
|
||||
# 获取公网IP
|
||||
IP=$(curl -s ifconfig.me)
|
||||
|
||||
# 使用ip-api.com获取IP地理位置信息
|
||||
INFO=$(curl -s "http://ip-api.com/json/${IP}")
|
||||
|
||||
# 判断是否在中国
|
||||
if echo "$INFO" | grep -q '"country":"China"'; then
|
||||
echo "IP is in China"
|
||||
# 如果 REMOTE_CONTAINERS 为 true,则为容器开发环境,进行相关配置
|
||||
if [ "$REMOTE_CONTAINERS" = "true" ]; then
|
||||
# 容器开发环境,配置容器内部的环境变量
|
||||
echo "Configuring environment variables for container development environment"
|
||||
# 记录hostname到 data/hostname.txt 如果 data 目录不存在,则创建
|
||||
if [ ! -d "data" ]; then
|
||||
mkdir data
|
||||
chmod 777 data
|
||||
fi
|
||||
echo "$(hostname)" >data/hostname.txt
|
||||
|
||||
# 配置goproxy
|
||||
echo "Configuring goproxy"
|
||||
go env -w GO111MODULE=on
|
||||
go env -w GOPROXY=https://goproxy.cn,direct
|
||||
|
||||
# 配置npm mirror
|
||||
echo "Configuring npm mirror"
|
||||
npm config set registry https://registry.npmmirror.com
|
||||
yarn config set registry https://registry.npmmirror.com
|
||||
|
||||
# 安装pgit
|
||||
echo "Installing pgit"
|
||||
curl -o pgit https://gitee.com/gcslaoli/pgit/raw/main/shell/pgit && chmod +x pgit && sudo mv pgit /usr/local/bin
|
||||
|
||||
# 安装cool-tools
|
||||
echo "Installing cool-tools ..."
|
||||
go install blazing/cool-tools@latest
|
||||
# 安装gf
|
||||
echo "Installing gf use mirror ..."
|
||||
pgit wget -O gf \
|
||||
https://github.com/gogf/gf/releases/latest/download/gf_$(go env GOOS)_$(go env GOARCH) &&
|
||||
chmod +x gf &&
|
||||
./gf install -y &&
|
||||
rm ./gf
|
||||
|
||||
fi
|
||||
|
||||
else
|
||||
echo "IP is not in China"
|
||||
# 如果 REMOTE_CONTAINERS 为 true,则为容器开发环境,进行相关配置
|
||||
if [ "$REMOTE_CONTAINERS" = "true" ]; then
|
||||
# 容器开发环境,配置容器内部的环境变量
|
||||
echo "Configuring environment variables for container development environment"
|
||||
# 记录hostname到 data/hostname.txt 如果 data 目录不存在,则创建
|
||||
if [ ! -d "data" ]; then
|
||||
mkdir data
|
||||
chmod 777 data
|
||||
fi
|
||||
echo "$(hostname)" >data/hostname.txt
|
||||
|
||||
# 安装cool-tools
|
||||
echo "Installing cool-tools ..."
|
||||
go install blazing/cool-tools@latest
|
||||
# 安装gf
|
||||
echo "Installing gf use mirror ..."
|
||||
wget -O gf \
|
||||
https://github.com/gogf/gf/releases/latest/download/gf_$(go env GOOS)_$(go env GOARCH) &&
|
||||
chmod +x gf &&
|
||||
./gf install -y &&
|
||||
rm ./gf
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
@@ -1,37 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
echo "请通过命令行参数指定要打包的目录"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
ROOT_DIR=$(pwd)
|
||||
DIST_DIR="$1"
|
||||
|
||||
if [ ! -d "$DIST_DIR" ]; then
|
||||
echo "未找到指定的目录:$DIST_DIR"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# 如果存在 data/public 目录,则删除
|
||||
public_dir="$ROOT_DIR/data/public"
|
||||
|
||||
echo "🔎 正在检查 $public_dir 目录..."
|
||||
if [ -d "$public_dir" ]; then
|
||||
echo "🗑️ 正在删除 $public_dir 目录"
|
||||
rm -rf "$public_dir"
|
||||
echo "✅ $public_dir 目录已删除"
|
||||
else
|
||||
echo "✅ $public_dir 目录未找到"
|
||||
fi
|
||||
|
||||
# 移动指定目录到data目录并重命名为public
|
||||
echo "🚚 正在移动 $DIST_DIR 目录到 data 目录并重命名为 public"
|
||||
mv "$DIST_DIR" "$public_dir"
|
||||
echo "✅ 已移动并重命名 $DIST_DIR 目录"
|
||||
|
||||
# gf 打包
|
||||
cd "$ROOT_DIR/data"
|
||||
echo "📦 正在打包 public 目录"
|
||||
gf pack public "$ROOT_DIR/internal/packed/public.go" -y
|
||||
echo "✅ 打包完成"
|
||||
@@ -1,35 +0,0 @@
|
||||
@echo off
|
||||
setlocal enabledelayedexpansion
|
||||
|
||||
if "%1" == "" (
|
||||
echo 请通过命令行参数指定要打包的目录
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set ROOT_DIR=%CD%
|
||||
set DIST_DIR=%1
|
||||
|
||||
if not exist "%DIST_DIR%" (
|
||||
echo 未找到指定的目录: %DIST_DIR%
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
set PUBLIC_DIR=%ROOT_DIR%\data\public
|
||||
|
||||
echo 🔎 正在检查 %PUBLIC_DIR% 目录...
|
||||
if exist "%PUBLIC_DIR%" (
|
||||
echo 🗑️ 正在删除 %PUBLIC_DIR% 目录
|
||||
rmdir /s /q "%PUBLIC_DIR%"
|
||||
echo ✅ %PUBLIC_DIR% 目录已删除
|
||||
) else (
|
||||
echo ✅ %PUBLIC_DIR% 目录未找到
|
||||
)
|
||||
|
||||
echo 🚚 正在移动 %DIST_DIR% 目录到 data 目录并重命名为 public
|
||||
move "%DIST_DIR%" "%PUBLIC_DIR%"
|
||||
echo ✅ 已移动并重命名 %DIST_DIR% 目录
|
||||
|
||||
echo 📦 正在打包 public 目录
|
||||
cd "%ROOT_DIR%\data"
|
||||
gf pack public "%ROOT_DIR%\internal\packed\public.go" -y
|
||||
echo ✅ 打包完成
|
||||
Reference in New Issue
Block a user