chore(main-framework): remove non-framework dirs and keep aggregator for framework
This commit is contained in:
parent
afdfcf29a1
commit
4dadab0990
@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
# Basic pre-commit hook initialized at repo root.
|
||||
# Add your checks below (lint/test/etc.).
|
||||
|
||||
echo "husky pre-commit: no checks configured yet"
|
||||
exit 0
|
||||
@ -1,19 +0,0 @@
|
||||
# Critical Scenario Simulator (CSS)
|
||||
|
||||
临界事故情景分析模拟系统(CSS)业务模块。
|
||||
|
||||
## 后端模块
|
||||
- Maven 模块路径:`business-css/`
|
||||
- 依赖复用:依赖 `framework` 生成的 classes JAR(`com.yfd:platform:1.0`)。
|
||||
- 按需添加业务领域代码(实体、服务、控制器)。
|
||||
|
||||
## 前端模块
|
||||
- 目录:`business-css/frontend/`
|
||||
- 初始化方式:从 `framework/frontend` 复制基线前端后进行业务化开发。
|
||||
- 同步机制:使用 `scripts/sync-frontend.ps1` 从基线前端同步公共目录(排除环境配置)。
|
||||
|
||||
## 初始化步骤
|
||||
1. 执行前端同步脚本,初始化 `business-css/frontend`。
|
||||
2. 安装前端依赖:`pnpm i` 或 `npm ci`。
|
||||
3. 启动前端:`pnpm dev` 或 `npm run dev`。
|
||||
4. 后端模块使用 `mvn -pl business-css -am clean verify` 构建与测试。
|
||||
@ -1,6 +0,0 @@
|
||||
# CSS 前端(占位)
|
||||
|
||||
初始化指引:
|
||||
- 运行 `scripts/sync-frontend.ps1` 将 `framework/frontend` 基线复制到此目录。
|
||||
- 在本目录执行 `pnpm i` 或 `npm ci` 安装依赖。
|
||||
- 更新 `.env.*`、路由与页面以适配 CSS 业务需求。
|
||||
@ -1,51 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>com.yfd</groupId>
|
||||
<artifactId>JavaProjectParent</artifactId>
|
||||
<version>1.0</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>com.yfd.css</groupId>
|
||||
<artifactId>css-backend</artifactId>
|
||||
<version>1.0.0-SNAPSHOT</version>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<name>Critical Scenario Simulator (CSS) Backend</name>
|
||||
<description>临界事故情景分析模拟系统 - 后端模块</description>
|
||||
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<!-- 复用平台框架的 classes JAR -->
|
||||
<dependency>
|
||||
<groupId>com.yfd</groupId>
|
||||
<artifactId>framework</artifactId>
|
||||
<version>1.0</version>
|
||||
<type>jar</type>
|
||||
</dependency>
|
||||
|
||||
<!-- 业务自身的基础依赖,可按需扩展 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-validation</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@ -1,11 +0,0 @@
|
||||
server:
|
||||
port: 8098
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: css-backend
|
||||
|
||||
css:
|
||||
scenario:
|
||||
defaultRiskLevel: MEDIUM
|
||||
simulationMaxSteps: 1000
|
||||
68
git管理方案.md
68
git管理方案.md
@ -11,31 +11,18 @@
|
||||
- 清晰的分支与发布节奏,降低冲突与回归风险。
|
||||
|
||||
## 1. 仓库结构与现状
|
||||
|
||||
### 当前仓库(已存在)
|
||||
```
|
||||
ProjectFrameWork2025/
|
||||
├── framework/ # 后端框架(含 src/、pom.xml 等)
|
||||
│ └── frontend/ # 前端工程(当前位于 framework 目录下)
|
||||
├── docs/ # 项目文档
|
||||
├── pom.xml # 父 POM
|
||||
└── git.md # Git 管理方案
|
||||
```
|
||||
|
||||
### 推荐结构(框架含基线前端,业务前端复制自框架)
|
||||
```
|
||||
ProjectFrameWork2025/
|
||||
JavaProjectRepo/
|
||||
├── framework/ # 后端框架(Maven 模块)+ 基线前端
|
||||
│ └── frontend/ # 基线前端(可作为模板与上游源)
|
||||
├── business-app-a/ # 业务系统A(Maven 模块)
|
||||
├── business-css/ # 业务系统A(Maven 模块)
|
||||
│ ├── src/ # 业务A后端代码
|
||||
│ └── frontend/ # 业务A前端(由 framework/frontend 复制)
|
||||
├── business-app-b/ # 业务系统B(Maven 模块)
|
||||
│ ├── src/
|
||||
│ └── frontend/
|
||||
├── docs/
|
||||
├── pom.xml # 父POM(仅管理后端Maven模块)
|
||||
└── README.md
|
||||
```
|
||||
|
||||
说明:
|
||||
@ -47,24 +34,24 @@ ProjectFrameWork2025/
|
||||
|
||||
### 长期分支
|
||||
```bash
|
||||
main # 框架稳定版本(受保护)
|
||||
main-framework # 框架稳定版本(受保护)
|
||||
develop-framework # 框架开发分支
|
||||
develop-business # 业务开发分支(单业务时)
|
||||
business-main # 业务稳定分支(单业务时,受保护)
|
||||
# 多业务可扩展:develop-business-a / business-a-main 等
|
||||
main-business-css # 业务稳定分支(单业务时,受保护)
|
||||
develop-business-css # 业务开发分支(单业务时)
|
||||
# 多业务可扩展:main-business-css / develop-business-css 等
|
||||
```
|
||||
|
||||
### 受保护策略(建议在 Git 服务器上配置)
|
||||
- `main`、`business-main`:
|
||||
- `main-framework`、`main-business-css`:
|
||||
- 禁止直接 push;必须通过合并请求(MR/PR)。
|
||||
- 必须通过 CI(单元测试 + 构建)与至少 1 人代码评审。
|
||||
- 建议启用“必须线性历史”(不允许非快进式合并)或统一使用 squash merge。
|
||||
- 标签(tags)仅允许由“发布管理员”或 CI 流水线创建。
|
||||
|
||||
### 合并策略
|
||||
- 框架到业务:业务分支定期合入 `main` 的框架更新(推荐 `git merge --no-ff` 或 `git rebase`,视团队偏好)。
|
||||
- 业务到业务稳定:`develop-business` → `business-main` 通过 MR/PR,保持发布记录清晰。
|
||||
- 框架发布:`develop-framework` → `main`,并打版本标签。
|
||||
- 框架到业务:业务分支定期合入 `main-framework` 的框架更新(推荐 `git merge --no-ff` 或 `git rebase`,视团队偏好)。
|
||||
- 业务到业务稳定:`develop-business-css` → `main-business-css` 通过 MR/PR,保持发布记录清晰。
|
||||
- 框架发布:`develop-framework` → `main-framework`,并打版本标签。
|
||||
|
||||
## 3. 代码组织(Maven 多模块 + 前端)
|
||||
|
||||
@ -73,7 +60,7 @@ business-main # 业务稳定分支(单业务时,受保护)
|
||||
<!-- pom.xml -->
|
||||
<modules>
|
||||
<module>framework</module>
|
||||
<module>business-app</module>
|
||||
<module>business-css</module>
|
||||
<!-- 前端不纳入 Maven modules;独立管理 -->
|
||||
<!-- 如需统一构建,可在 CI 中分阶段调用前端构建脚本 -->
|
||||
</modules>
|
||||
@ -113,7 +100,7 @@ business-main # 业务稳定分支(单业务时,受保护)
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>platform-business</artifactId>
|
||||
<artifactId>platform-business-css</artifactId>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<dependencies>
|
||||
@ -156,18 +143,19 @@ robocopy "$src/src/shared" "$dst/src/shared" /MIR
|
||||
|
||||
### 初始化与分支创建
|
||||
```bash
|
||||
git clone http://121.37.111.42:3000/ThbTech/ProjectFrameWork2025.git
|
||||
cd ProjectFrameWork2025
|
||||
git checkout -b main
|
||||
git clone http://121.37.111.42:3000/ThbTech/JavaProjectRepo.git
|
||||
cd JavaProjectRepo
|
||||
git checkout -b main-framework
|
||||
git push -u origin main-framework
|
||||
|
||||
# 框架开发分支
|
||||
git checkout -b develop-framework
|
||||
git push -u origin develop-framework
|
||||
|
||||
# 业务开发分支(如仅一个业务)
|
||||
git checkout main
|
||||
git checkout -b develop-business
|
||||
git push -u origin develop-business
|
||||
git checkout main-framework
|
||||
git checkout -b develop-business-css
|
||||
git push -u origin develop-business-css
|
||||
```
|
||||
|
||||
### 框架功能开发
|
||||
@ -179,26 +167,26 @@ git commit -m "feat(framework): 新增通用权限管理模块"
|
||||
git push origin develop-framework
|
||||
|
||||
# 合并到 main(发布框架版本)
|
||||
git checkout main
|
||||
git checkout main-framework
|
||||
git merge --no-ff develop-framework
|
||||
git tag -a fw-v1.1.0 -m "框架版本 v1.1.0"
|
||||
git push origin main --tags
|
||||
git push origin main-framework --tags
|
||||
```
|
||||
|
||||
### 业务功能开发与同步框架
|
||||
```bash
|
||||
git checkout develop-business
|
||||
git fetch origin
|
||||
git merge origin/main # 合入最新框架
|
||||
git merge origin/main-framework # 合入最新框架
|
||||
|
||||
# 在 business-app/ 下开发
|
||||
git add business-app/
|
||||
# 在 business-css/ 下开发
|
||||
git add business-css/
|
||||
git commit -m "feat(order): 实现订单管理功能"
|
||||
git push origin develop-business
|
||||
git push origin develop-business-css
|
||||
|
||||
# 稳定分支(如需要)
|
||||
git checkout -b business-main
|
||||
git push -u origin business-main
|
||||
git checkout -b main-business-css
|
||||
git push -u origin main-business-css
|
||||
```
|
||||
|
||||
### 业务前端初始化(从框架复制)
|
||||
@ -282,7 +270,7 @@ spring:
|
||||
```bash
|
||||
git checkout develop-business
|
||||
git fetch origin
|
||||
git merge origin/main # 或:git rebase origin/main
|
||||
git merge origin/main-framework # 或:git rebase origin/main
|
||||
|
||||
# 处理常见冲突:
|
||||
# - application.yml / profiles 差异
|
||||
|
||||
1
pom.xml
1
pom.xml
@ -13,7 +13,6 @@
|
||||
|
||||
<modules>
|
||||
<module>framework</module>
|
||||
<module>business-css</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
||||
@ -1,20 +0,0 @@
|
||||
Param(
|
||||
[string]$Source = "framework/frontend",
|
||||
[string]$Target = "business-css/frontend"
|
||||
)
|
||||
|
||||
Write-Host "Sync frontend from '$Source' to '$Target'" -ForegroundColor Cyan
|
||||
|
||||
if (!(Test-Path $Target)) {
|
||||
New-Item -ItemType Directory -Path $Target | Out-Null
|
||||
}
|
||||
|
||||
# 同步除 node_modules/.git/.husky 外的所有文件,排除环境与锁文件
|
||||
robocopy $Source $Target /MIR /XD node_modules .git .husky /XF .env* pnpm-lock.yaml npm-lock.yaml yarn.lock
|
||||
|
||||
# 可选:按需同步共享目录,避免覆盖业务自定义
|
||||
if (Test-Path "$Source/src/shared") {
|
||||
robocopy "$Source/src/shared" "$Target/src/shared" /MIR
|
||||
}
|
||||
|
||||
Write-Host "Sync completed." -ForegroundColor Green
|
||||
Loading…
Reference in New Issue
Block a user