diff --git a/.gitignore b/.gitignore index 9b1913e..a8770e3 100644 --- a/.gitignore +++ b/.gitignore @@ -1,9 +1,14 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. # dependencies /node_modules /.pnp -.pnp.js +.pnp.* +.yarn/* +!.yarn/patches +!.yarn/plugins +!.yarn/releases +!.yarn/versions # testing /coverage @@ -11,7 +16,7 @@ # next.js /.next/ /out/ - +.idea/ # production /build @@ -23,10 +28,10 @@ npm-debug.log* yarn-debug.log* yarn-error.log* +.pnpm-debug.log* -# local env files -.env -.env*.local +# env files (can opt-in for committing if needed) +.env* # vercel .vercel @@ -34,3 +39,9 @@ yarn-error.log* # typescript *.tsbuildinfo next-env.d.ts +.env.local +dist +*.tar.gz +build_and_copy.log +*.log +*.lock diff --git a/README.md b/README.md new file mode 100644 index 0000000..c9b93f6 --- /dev/null +++ b/README.md @@ -0,0 +1,32 @@ +安装依赖 + + +```shellscript +npm install +``` + +## 启动开发服务器 + +运行以下命令启动开发服务器: + +```shellscript +npm run dev +``` + +开发服务器将在 [http://localhost:3000](http://localhost:3000) 启动。 + +## 生产部署 + +```shellscript +cd video-flow +./compile.sh + +登入服务器: +ssh 77media@182.92.218.171 +./deploy + +键入11回车: +11) Deploy Vedio Flow Frontend +Please select a service to deploy (0-10): 11 +``` + \ No newline at end of file diff --git a/compile.sh b/compile.sh new file mode 100755 index 0000000..f8644e9 --- /dev/null +++ b/compile.sh @@ -0,0 +1,48 @@ +#!/bin/bash + +# 修改项目名称 +PROJECT_NAME="video-flow-frontend" + +# 设置日志文件路径 +LOGFILE="build_and_copy.log" + +# 记录开始时间 +echo "Build process started at $(date)" | tee $LOGFILE + +# 获取当前分支名 +current_branch=$(git rev-parse --abbrev-ref HEAD) + +# 检查当前分支并运行相应的 npm 命令 +if [ "$current_branch" = "dev" ]; then + echo "On dev branch, building project..." | tee -a $LOGFILE + PROFILE_ENV=dev + + # 安装依赖并构建 + yarn install + yarn build + + # 准备dist目录 + mkdir -p dist + cp -r .next dist/ + cp -r public dist/ + cp package.json dist/ + cp package-lock.json dist/ + +else + echo "On non-dev branch ($current_branch), exiting" + exit 1 +fi + +# 创建tar包 +tar -czvf $PROJECT_NAME-$PROFILE_ENV.tar.gz dist + +# 记录结束时间 +echo "Build process completed at $(date)" | tee -a $LOGFILE + +# 上传到 nexus +echo "upload to nexus at $(date)" | tee -a $LOGFILE +curl -u 'admin':'YZ9Gq6=8\*G|?:,' --upload-file $PROJECT_NAME-$PROFILE_ENV.tar.gz https://repo.qikongjian.com/repository/frontend-tar-files/ + + 清理构建文件 + rm -rf dist + rm $PROJECT_NAME-$PROFILE_ENV.tar.gz