合肥雷能,web管理后台,https://radar-power.cn/
|
|
2 月之前 | |
|---|---|---|
| .vscode | 2 月之前 | |
| public | 2 月之前 | |
| scripts | 2 月之前 | |
| src | 2 月之前 | |
| .editorconfig | 2 月之前 | |
| .env.development | 2 月之前 | |
| .env.production | 2 月之前 | |
| .env.test | 2 月之前 | |
| .eslintrc.cjs | 2 月之前 | |
| .gitattributes | 2 月之前 | |
| .gitignore | 2 月之前 | |
| .gitmessage.txt | 2 月之前 | |
| .prettierignore | 2 月之前 | |
| .prettierrc.json | 2 月之前 | |
| CHANGELOG.md | 2 月之前 | |
| Dockerfile | 2 月之前 | |
| Jenkinsfile | 2 月之前 | |
| README.md | 2 月之前 | |
| components.d.ts | 2 月之前 | |
| env.d.ts | 2 月之前 | |
| eslint.config.ts | 2 月之前 | |
| index.html | 2 月之前 | |
| nginx.conf | 2 月之前 | |
| package.json | 2 月之前 | |
| pnpm-lock.yaml | 2 月之前 | |
| tsconfig.app.json | 2 月之前 | |
| tsconfig.json | 2 月之前 | |
| tsconfig.node.json | 2 月之前 | |
| version-script.js | 2 月之前 | |
| vite.config.ts | 2 月之前 |
本项目在 package.json 中定义了一系列常用脚本,用于本地开发、构建、发布和部署。
以下是每个脚本的功能及使用方法。
本地开发
npm install # 安装依赖
npm run dev # 启动开发环境
打包并部署测试环境
npm run deploy:test # 单机版环境
发布新版本
npm run release # 发布新版本 + 生成发布日志
同步分支代码
bash scripts/merge_dev_to_pro.sh # 同步dev分支到prod分支
说明:目前分为开发、测试/单机版、生产/集成环境
| 环境 | 命令 | 端口 / 说明 |
|------|------|------------|
| 🟢 开发环境 | npm run dev | 3000 |
| 🟡 测试环境 | npm run dev:test | 4000 |
| 🔴 生产环境 | npm run dev:pro | 5000 |
| 📦 构建开发环境 | npm run build:dev | - |
| 📦 构建测试环境 | npm run build:test | - |
| 📦 构建生产环境 | npm run build | - |
| 🚀 发布版本 | npm run release | 发布版本 + 生成日志 |
| 📤 部署测试环境 | npm run deploy:test | 打包 + 部署 |
| 🔍 类型检查 | npm run type-check | TypeScript 检查 |
| 🧹 代码修复 | npm run lint | ESLint 自动修复 |
| 🎨 格式化代码 | npm run format | Prettier 格式化 |
| 命令 | 说明 | 运行示例 |
|---|---|---|
npm run dev |
启动开发环境(development),端口 3000 | npm run dev |
npm run dev:test |
启动测试环境(test),端口 4000 | npm run dev:test |
npm run dev:pro |
启动生产环境(production)本地调试,端口 5000 | npm run dev:pro |
| 命令 | 说明 | 运行示例 |
|---|---|---|
npm run build:dev |
打包 开发环境 构建产物 | Jenkins代替 |
npm run build:test |
打包 测试环境 构建产物 | npm run build:test |
npm run build |
打包 生产环境 构建产物 | Jenkins代替 |
| 命令 | 说明 | 运行示例 |
|---|---|---|
npm run release |
发布版本 + 生成日志 | npm run release |
| 命令 | 说明 | 运行示例 |
|---|---|---|
npm run deploy:test |
打包测试环境 并执行部署脚本 | npm run deploy:test |
npm run run:deploy |
直接执行部署脚本(不打包) | npm run run:deploy |
⚠
run:deploy会调用scripts/deploy.ps1(PowerShell 脚本),需确保本地已安装 PowerShell 且允许执行脚本。
| 命令 | 说明 | 运行示例 |
|---|---|---|
npm run preview |
本地预览已构建的生产环境包(默认端口 4173) | npm run preview |
| 命令 | 说明 | 运行示例 |
|---|---|---|
npm run type-check |
TypeScript 类型检查 | npm run type-check |
npm run lint |
ESLint 代码规范检查并自动修复问题 | npm run lint |
npm run format |
使用 Prettier 格式化 src/ 目录下的代码 |
npm run format |