chore(repo): 完善仓库维护与自动化

This commit is contained in:
Awuqing
2026-08-09 19:42:02 +08:00
parent bdd16dafa8
commit 14b61b23a2
32 changed files with 479 additions and 157 deletions
+25
View File
@@ -0,0 +1,25 @@
root = true
[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{go,mod,sum}]
indent_style = tab
indent_size = 4
[Makefile]
indent_style = tab
[*.{js,jsx,ts,tsx,json,yml,yaml,css,scss,html,md,mdx}]
indent_style = space
indent_size = 2
[*.sh]
indent_style = space
indent_size = 4
[*.md]
trim_trailing_whitespace = false
+15
View File
@@ -0,0 +1,15 @@
* text=auto eol=lf
*.bat text eol=crlf
*.cmd text eol=crlf
*.gif binary
*.ico binary
*.jpg binary
*.jpeg binary
*.png binary
*.webp binary
*.woff binary
*.woff2 binary
*.gz binary
*.zip binary
+28 -15
View File
@@ -1,14 +1,14 @@
---
name: "\U0001F41B Bug 报告"
about: "报告一个 Bug,帮助我们改进 BackupX"
name: "Bug 报告"
about: "提交可复现的缺陷报告"
title: "[Bug] "
labels: ["bug"]
assignees: []
---
## 描述
## 问题描述
<!-- 清晰简洁地描述这个 Bug -->
<!-- 清晰说明发生了什么,以及它为什么是缺陷。 -->
## 复现步骤
@@ -18,26 +18,39 @@ assignees: []
## 期望行为
<!-- 描述你期望发生什么 -->
<!-- 描述正确结果。 -->
## 实际行为
<!-- 描述实际发生了什么 -->
<!-- 描述实际结果,包括稳定复现还是偶发。 -->
## 环境信息
- **OS**: <!-- 例如 Ubuntu 22.04 -->
- **Go 版本**: <!-- 例如 1.21 -->
- **Node.js 版本**: <!-- 例如 18.17 -->
- **浏览器**: <!-- 例如 Chrome 120 -->
- **BackupX 版本**: <!-- 例如 v1.0.0 -->
- BackupX 版本或提交:
- 部署方式(Docker、裸机、集群):
- 操作系统与架构:
- 数据库或备份类型:
- 浏览器版本(仅界面问题):
- 是否使用代理、私有 CA 或堡垒机:
## 最小配置
<!-- 仅保留复现所需字段。删除密码、Token、域名、IP 和存储凭据。 -->
```yaml
```
## 相关日志
```
<!-- 粘贴相关日志输出 -->
<!-- 附问题发生前后的最小日志片段,并先删除所有敏感信息。 -->
```text
```
## 截图
## 补充信息
<!-- 如有截图请附上 -->
<!-- 可附截图、相关 Issue、临时缓解方式或其他上下文。 -->
请勿提交数据库文件、完整配置、备份数据、API Key、Agent Token、安装命令或未脱敏日志。安全漏洞请使用私密漏洞报告入口。
+3 -3
View File
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: 💬 讨论区 / Discussions
url: https://github.com/Awuqing/GoogleDriverBackupEveryDay/discussions
about: 提问、讨论功能想法或分享使用经验
- name: 安全漏洞 / Security vulnerability
url: https://github.com/Awuqing/BackupX/security/advisories/new
about: 请通过私密渠道报告安全问题,不要创建公开 Issue。
+23 -10
View File
@@ -1,23 +1,36 @@
---
name: "\U0001F680 功能请求"
about: "建议一个新功能或改进"
name: "功能请求"
about: "建议一个可落地的新功能或改进"
title: "[Feature] "
labels: ["enhancement"]
assignees: []
---
## 需求描述
<!-- 清晰简洁地描述你希望的功能 -->
## 使用场景
<!-- 描述在什么场景下需要这个功能 -->
<!-- 描述在什么环境中遇到了什么问题。 -->
## 建议的解决方案
## 期望结果
<!-- 描述你认为应该如何实现(可选) -->
<!-- 说明用户最终需要完成的任务,不要只描述界面元素。 -->
## 建议方案
<!-- 可选:描述 API、配置、工作流或界面交互。 -->
## 替代方案
<!-- 说明当前绕过方式,以及它为什么不足。 -->
## 兼容性与风险
<!-- 是否影响现有配置、数据格式、部署方式、权限或集群节点。 -->
## 验收标准
- [ ]
- [ ]
## 补充信息
<!-- 任何其他相关信息、截图或上下文 -->
<!-- 可附相关文档、日志、截图或同类实现。不要附敏感信息。 -->
+38 -19
View File
@@ -1,29 +1,48 @@
## Pull Request
## 变更说明 / Summary
### 变更类型 / Type of Change
<!-- 说明做了什么、为什么需要,以及对用户或运维人员的影响。 -->
- [ ] 🐛 Bug 修复 (非破坏性变更)
- [ ] ✨ 新功能 (非破坏性变更)
- [ ] 💥 破坏性变更 (修复或功能导致现有功能变更)
- [ ] 📝 文档更新
- [ ] ♻️ 代码重构 (不影响功能)
- [ ] ⚡ 性能优化
## 变更类型 / Type of Change
### 描述 / Description
- [ ] 缺陷修复
- [ ] 新功能
- [ ] 破坏性变更
- [ ] 性能优化
- [ ] 重构或工程化
- [ ] 文档更新
<!-- 描述你做了什么更改以及为什么 -->
## 相关 Issue / Related Issue
### 相关 Issue / Related Issue
<!-- 例如:Closes #123。没有关联 Issue 时写“无”。 -->
<!-- 关联的 Issue 编号,如 Fixes #123 -->
## 验证 / Validation
### 测试 / Testing
<!-- 只勾选实际执行过的项目,并在下方补充无法执行的原因。 -->
- [ ] 后端测试通过 (`go test ./...`)
- [ ] 前端测试通过 (`npm run test`)
- [ ] 前端构建成功 (`npm run build`)
- [ ] 已在本地环境手动测试
- [ ] 后端格式、静态检查与测试通过
- [ ] 前端测试与生产构建通过
- [ ] 文档类型检查与中英文生产构建通过
- [ ] 配置、迁移或部署兼容性已验证
- [ ] 已完成与变更范围相符的手动验证
### 截图 / Screenshots
验证命令与结果:
<!-- 如有 UI 变更请附上截图 -->
```text
```
## 风险与回滚 / Risk and Rollback
<!-- 说明兼容性风险、数据迁移、配置变化和回滚方法。无风险时写“无”。 -->
## 界面变更 / UI Changes
<!-- 有界面变更时附前后截图;无界面变更时写“无”。 -->
## 提交前检查 / Checklist
- [ ] 提交信息符合 Conventional Commits
- [ ] 未提交密钥、Token、真实配置、数据库或日志
- [ ] 新行为已补充测试和中英文文档
- [ ] 前端未使用 Emoji、渐变、阴影、独立字体或超过 4px 的圆角
- [ ] 没有夹带与本 PR 无关的格式化或重构
+28 -22
View File
@@ -1,34 +1,40 @@
# 安全漏洞披露政策 / Security Policy
# 安全策 / Security Policy
## 支持的版本 / Supported Versions
## 支持范围 / Supported Versions
| Version | Supported |
|---------|--------------------|
| latest | ✅ |
| < latest | ❌ |
安全修复面向最新稳定版本和 `main` 分支。旧版本不会单独维护安全补丁;升级前请先阅读对应 Release Notes 和升级恢复文档。
## 报告安全漏洞 / Reporting a Vulnerability
Security fixes target the latest stable release and the `main` branch. Older versions do not receive separate security patches. Review the release notes and upgrade documentation before updating.
如果您发现了安全漏洞,**请不要通过公开 Issue 报告**。
| Version | Status |
|---------|--------|
| Latest stable release | Supported |
| `main` | Development support |
| Older releases | Unsupported |
请发送邮件至项目维护者,包含以下信息:
## 报告漏洞 / Reporting a Vulnerability
1. 漏洞描述
2. 复现步骤
3. 受影响的版本
4. 可能的影响范围
请勿通过公开 Issue、Discussion 或 Pull Request 披露安全漏洞。使用 GitHub 的[私密漏洞报告入口](https://github.com/Awuqing/BackupX/security/advisories/new)提交报告。
我们会在 48 小时内确认收到并开始处理。
Do not disclose vulnerabilities in a public Issue, Discussion, or Pull Request. Submit the report through GitHub's [private vulnerability reporting form](https://github.com/Awuqing/BackupX/security/advisories/new).
---
报告应包含:
If you discover a security vulnerability, **please do NOT open a public issue**.
1. 受影响版本或提交;
2. 漏洞描述、攻击前提和影响范围;
3. 最小复现步骤或验证代码;
4. 已知缓解措施;
5. 希望使用的署名信息。
Instead, email the project maintainer with the following details:
不要上传真实密钥、Token、备份数据、数据库或包含客户信息的日志。必要时请先脱敏,并使用最小化测试数据。
1. Description of the vulnerability
2. Steps to reproduce
3. Affected versions
4. Potential impact
Do not upload real credentials, tokens, backup data, databases, or logs containing customer information. Redact sensitive values and use minimal test data.
We will acknowledge receipt within 48 hours and begin working on a fix.
## 处理流程 / Response Process
- 维护者会尽快确认报告并进行初步分级;
- 修复期间请保持细节私密,避免影响仍未升级的部署;
- 修复发布后会在安全公告或 Release Notes 中说明受影响范围、缓解措施和升级版本;
- 披露时间由报告者与维护者协调确定。
The maintainer will acknowledge and triage the report as soon as practical. Details should remain private until a fix and coordinated disclosure are ready.
+86
View File
@@ -0,0 +1,86 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: /
schedule:
interval: weekly
day: monday
time: "03:00"
timezone: Asia/Shanghai
open-pull-requests-limit: 5
commit-message:
prefix: chore(deps)
groups:
github-actions:
patterns:
- "*"
- package-ecosystem: gomod
directory: /server
schedule:
interval: weekly
day: monday
time: "03:10"
timezone: Asia/Shanghai
open-pull-requests-limit: 5
commit-message:
prefix: chore(deps)
groups:
go-minor-and-patch:
patterns:
- "*"
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /web
schedule:
interval: weekly
day: monday
time: "03:20"
timezone: Asia/Shanghai
open-pull-requests-limit: 5
commit-message:
prefix: chore(deps)
groups:
web-minor-and-patch:
patterns:
- "*"
update-types:
- minor
- patch
- package-ecosystem: npm
directory: /docs-site
schedule:
interval: weekly
day: monday
time: "03:30"
timezone: Asia/Shanghai
open-pull-requests-limit: 5
commit-message:
prefix: chore(deps)
groups:
docs-minor-and-patch:
patterns:
- "*"
update-types:
- minor
- patch
- package-ecosystem: docker
directory: /
schedule:
interval: weekly
day: monday
time: "03:40"
timezone: Asia/Shanghai
open-pull-requests-limit: 5
commit-message:
prefix: chore(deps)
groups:
container-images:
patterns:
- "*"
+28 -8
View File
@@ -2,18 +2,24 @@ name: CI
on:
push:
branches: [main, master]
branches: [main]
pull_request:
branches: [main, master]
branches: [main]
workflow_dispatch:
# 最小权限:构建/测试仅需读取仓库内容,显式声明以收敛默认的可写令牌。
permissions:
contents: read
concurrency:
group: ci-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
backend:
name: Go Build & Test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
@@ -23,6 +29,23 @@ jobs:
go-version: '1.25'
cache-dependency-path: server/go.sum
- name: Verify modules
working-directory: server
run: go mod verify
- name: Check formatting
working-directory: server
run: |
unformatted="$(gofmt -l .)"
if [ -n "$unformatted" ]; then
printf '%s\n' "$unformatted"
exit 1
fi
- name: Vet
working-directory: server
run: go vet ./...
- name: Build
working-directory: server
run: go build ./...
@@ -34,13 +57,14 @@ jobs:
frontend:
name: React Build & Test
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '24'
cache: 'npm'
cache-dependency-path: web/package-lock.json
@@ -48,14 +72,10 @@ jobs:
working-directory: web
run: npm ci
- name: Type Check
working-directory: web
run: npx tsc --noEmit -p tsconfig.json
- name: Test
working-directory: web
run: npm run test
- name: Build
- name: Type Check & Build
working-directory: web
run: npm run build
+24 -7
View File
@@ -1,9 +1,16 @@
name: Deploy Docs
# 触发条件:
# - 推送 main 时,如果 docs-site/ 或站点相关 README 有变化
# - PR 修改 docs-site/ 时执行类型检查和构建
# - 推送 main 时构建并部署 GitHub Pages
# - 手动触发(在 Actions 页面)
on:
pull_request:
branches:
- main
paths:
- 'docs-site/**'
- '.github/workflows/docs.yml'
push:
branches:
- main
@@ -12,20 +19,20 @@ on:
- '.github/workflows/docs.yml'
workflow_dispatch:
# 允许写入 Pages,用于发布到 github.com/Awuqing/BackupX 的 Pages 站点
# 默认只读;Pages 写权限仅授予部署任务。
permissions:
contents: read
pages: write
id-token: write
# 同时只保留一个部署任务
# 同一分支只保留最新一次构建,避免旧提交覆盖新结果。
concurrency:
group: pages-${{ github.ref }}
group: docs-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Build Docs
runs-on: ubuntu-latest
timeout-minutes: 20
defaults:
run:
working-directory: docs-site
@@ -36,24 +43,34 @@ jobs:
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '24'
cache: 'npm'
cache-dependency-path: docs-site/package-lock.json
- name: Install dependencies
run: npm ci
- name: Type check
run: npm run typecheck
- name: Build site
run: npm run build
- name: Upload artifact
if: github.event_name != 'pull_request'
uses: actions/upload-pages-artifact@v3
with:
path: docs-site/build
deploy:
name: Deploy Docs
if: github.event_name != 'pull_request'
needs: build
runs-on: ubuntu-latest
timeout-minutes: 10
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
+70 -5
View File
@@ -27,25 +27,85 @@ on:
type: string
permissions:
contents: write
packages: write
contents: read
# 统一版本号:tag 推送取 ref_name,手动触发取 inputs.version
env:
VERSION: ${{ github.event.inputs.version || github.ref_name }}
concurrency:
group: release-${{ github.ref }}-${{ github.event.inputs.version || 'tag' }}
cancel-in-progress: false
jobs:
# ─── Job 0: 校验版本与测试 ───
verify:
name: Validate Release
runs-on: ubuntu-latest
timeout-minutes: 25
steps:
- uses: actions/checkout@v4
- name: Validate release input
shell: bash
env:
RELEASE_VERSION: ${{ env.VERSION }}
RELEASE_EVENT: ${{ github.event_name }}
RELEASE_REF: ${{ github.ref }}
run: |
if [[ ! "$RELEASE_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z][0-9A-Za-z.-]*)?$ ]]; then
echo "Version must be a SemVer tag such as v1.2.3 or v1.2.3-rc.1"
exit 1
fi
if [[ "$RELEASE_EVENT" == "workflow_dispatch" && "$RELEASE_REF" != "refs/heads/main" ]]; then
echo "Manual releases must run from the main branch"
exit 1
fi
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.25'
cache-dependency-path: server/go.sum
- name: Verify backend
working-directory: server
run: |
go mod verify
unformatted="$(gofmt -l .)"
if [ -n "$unformatted" ]; then
printf '%s\n' "$unformatted"
exit 1
fi
go vet ./...
go test ./...
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'npm'
cache-dependency-path: web/package-lock.json
- name: Verify frontend
working-directory: web
run: |
npm ci
npm run test
# ─── Job 1: 构建前端 ───
build-web:
name: Build Frontend
needs: verify
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
node-version: '24'
cache: 'npm'
cache-dependency-path: web/package-lock.json
@@ -67,6 +127,9 @@ jobs:
name: Build ${{ matrix.goarch }}
needs: build-web
runs-on: ubuntu-latest
timeout-minutes: 30
permissions:
contents: write
strategy:
matrix:
include:
@@ -98,13 +161,13 @@ jobs:
run: |
go build \
-trimpath \
-ldflags "-s -w -X main.version=${{ env.VERSION }}" \
-ldflags "-s -w -X main.version=${VERSION}" \
-o ../backupx \
./cmd/backupx
- name: Package release
run: |
ARCHIVE_NAME="backupx-${{ env.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}"
ARCHIVE_NAME="backupx-${VERSION}-${{ matrix.goos }}-${{ matrix.goarch }}"
mkdir -p "${ARCHIVE_NAME}"
cp backupx "${ARCHIVE_NAME}/"
cp -r web/dist "${ARCHIVE_NAME}/web"
@@ -130,6 +193,7 @@ jobs:
backupx-${{ env.VERSION }}-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz.sha256
backupx-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz
backupx-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz.sha256
fail_on_unmatched_files: true
generate_release_notes: true
# ─── Job 3: Docker 多架构 → Docker Hub ───
@@ -137,6 +201,7 @@ jobs:
name: Build & Push Docker
needs: build-web
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- uses: actions/checkout@v4
+35 -1
View File
@@ -1,4 +1,38 @@
# Dependencies
web/node_modules/
docs-site/node_modules/
# Build and test artifacts
web/dist/
docs-site/build/
docs-site/.docusaurus/
server/bin/
.claude/
coverage/
*.out
*.tsbuildinfo
web/vite.config.js
web/vite.config.d.ts
# Runtime data and local configuration
data/
tmp/
temp/
*.db
*.db-shm
*.db-wal
*.log
.env
.env.*
!.env*.example
# Editors, operating systems, and local tools
.idea/
.vscode/
.DS_Store
Thumbs.db
desktop.ini
*.swp
*.swo
*~
.claude/
.codex/
+1
View File
@@ -0,0 +1 @@
24
+17 -10
View File
@@ -8,8 +8,8 @@ Thanks for your interest in contributing to BackupX! This guide covers how to se
### 依赖 / Prerequisites
- **Go** 1.25+(见 `server/go.mod`
- **Node.js** 20+CI 与 Docker 使用 Node 20
- **npm** 9+
- **Node.js** 24 LTS(见 `.node-version`CI 与 Docker 使用同一主版本
- **npm** 11+
### 快速开始 / Quick Start
@@ -17,6 +17,8 @@ Thanks for your interest in contributing to BackupX! This guide covers how to se
```bash
git clone https://github.com/Awuqing/BackupX.git && cd BackupX
npm --prefix web ci
npm --prefix docs-site ci
# 终端 1 —— 后端(默认 http://localhost:8340
make dev-server
@@ -31,6 +33,7 @@ make dev-web
make build # 同时构建后端与前端
make build-server # 仅后端 → server/bin/backupx
make build-web # 仅前端 → web/dist
make build-docs # 仅文档站 → docs-site/build
make docker # 构建 Docker 镜像
make docker-cn # 国内镜像源加速构建
```
@@ -39,15 +42,17 @@ make docker-cn # 国内镜像源加速构建
## 测试 / Testing
提交前请确保测试通过
提交前应执行与 CI 一致的完整验证
```bash
make test # 后端 + 前端全部测试
make verify # 格式、依赖、静态检查、测试与三端构建
make test # 仅后端 + 前端测试
make test-server # 仅后端:cd server && go test ./...
make test-web # 仅前端:cd web && npm run testvitest
make check-docs # 文档类型检查 + 中英文站点构建
```
新增功能或修复缺陷时,请尽量补充对应测试。
新增功能或修复缺陷时,请补充对应测试。文档变更也必须通过严格断链检查,不能只依赖合并后的 Pages 部署结果。
## 提交信息规范 / Commit Messages
@@ -82,7 +87,7 @@ docs: 补充 CONTRIBUTING 指南
1. **Fork** 仓库并从最新的 `main` 切出特性分支;
2. **开发**功能或修复,必要时补充测试;
3. **自测**:确保 `make test` 通过;
3. **自测**:确保 `make verify` 通过;
4. **提交**:使用上述 Conventional Commits(中文);
5. **推送**并对着 `main` 发起 PR。
@@ -91,15 +96,17 @@ docs: 补充 CONTRIBUTING 指南
- 清晰说明本 PR 做了什么;
- 对新功能/修复,补充动机与背景;
- 关联相关 Issue(如 `Closes #62`);
- 纯文档 PR 可不附测试
- 纯文档 PR 至少应附上 `make check-docs` 的结果
> 请保持分支基于较新的 `main`:基线过旧的分支容易产生大范围冲突,难以评审与合入。
## 编码规范 / Coding Conventions
- **Go**所有错误必须处理(禁止 `_ = err`),日志使用项目已有库(`zap`,禁止 `fmt.Println`提交前执行 `gofmt`
- **前端**遵循项目 ESLint/Prettier/tsconfig 配置,不擅自引入新的 CSS 框架或 UI 库。
- **包管理**`web/` 使用 npm,请提交对应的 `package-lock.json`
- **Go**遵循现有 handler → service → repository 分层;避免把连续业务流程拆成大量无复用价值的独立函数。所有错误必须处理,日志使用 `zap`,禁止 `fmt.Println`提交前执行 `gofmt``go vet`
- **前端组件**复用并组合现有组件,不在页面内复制同类交互逻辑,不擅自改变共享组件的基础样式,不引入新的 CSS 框架或 UI 库。
- **前端视觉**:不使用 Emoji、渐变和 `box-shadow`;图标统一使用项目 SVG 图标组件;圆角为 0–4px;不引入独立字体,不用加粗字体制造层级,减少 Card,不使用数据左侧装饰竖线
- **包管理**`web/``docs-site/` 均使用 npm;依赖变更必须同步提交对应的 `package-lock.json`
- **文档**:英文源文件与 `zh-CN` 翻译应同步维护;新增页面必须加入侧边栏并通过两种语言的生产构建。
## License
+1 -1
View File
@@ -10,7 +10,7 @@ ARG USE_CHINA_MIRROR=false
# ---- Stage 1: Build frontend ----
FROM node:20-alpine AS web-builder
FROM node:24-alpine AS web-builder
ARG USE_CHINA_MIRROR
# 国内镜像:npm 使用淘宝源
+28 -1
View File
@@ -1,4 +1,6 @@
.PHONY: build dev test clean docker docker-cn
.PHONY: build build-server build-web build-docs dev-server dev-web \
test test-server test-web check-docs format-check vet-server \
verify verify-server verify-web verify-docs clean docker docker-cn
# 自动获取版本号(从 git tag 或 commit hash
VERSION ?= $(shell git describe --tags --always --dirty 2>/dev/null || echo dev)
@@ -12,6 +14,9 @@ build-server:
build-web:
cd web && npm run build
build-docs:
cd docs-site && npm run build
# ── 开发模式(分别在两个终端运行)──
dev-server:
cd server && go run ./cmd/backupx
@@ -28,6 +33,28 @@ test-server:
test-web:
cd web && npm run test
check-docs:
cd docs-site && npm run typecheck && npm run build
format-check:
@unformatted="$$(gofmt -l server)"; \
if [ -n "$$unformatted" ]; then \
printf '%s\n' "$$unformatted"; \
exit 1; \
fi
vet-server:
cd server && go mod verify && go vet ./...
# ── 提交前完整验证 ──
verify: verify-server verify-web verify-docs
verify-server: format-check vet-server test-server build-server
verify-web: test-web build-web
verify-docs: check-docs
# ── Docker 构建 ──
docker:
docker build --build-arg VERSION=$(VERSION) -t backupx:$(VERSION) -t backupx:latest .
+2
View File
@@ -10,6 +10,8 @@
<p align="center">
<a href="https://github.com/Awuqing/BackupX/stargazers"><img src="https://img.shields.io/github/stars/Awuqing/BackupX?style=flat-square&color=f5c542" alt="Stars"></a>
<a href="https://github.com/Awuqing/BackupX/releases"><img src="https://img.shields.io/github/v/release/Awuqing/BackupX?style=flat-square&color=brightgreen" alt="Release"></a>
<a href="https://github.com/Awuqing/BackupX/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/Awuqing/BackupX/ci.yml?branch=main&style=flat-square" alt="CI"></a>
<a href="https://github.com/Awuqing/BackupX/actions/workflows/docs.yml"><img src="https://img.shields.io/github/actions/workflow/status/Awuqing/BackupX/docs.yml?branch=main&style=flat-square&label=docs" alt="Docs"></a>
<img src="https://img.shields.io/badge/Go-1.25+-00ADD8?style=flat-square&logo=go" alt="Go">
<img src="https://img.shields.io/badge/React-18-61DAFB?style=flat-square&logo=react" alt="React">
<img src="https://img.shields.io/badge/SQLite-embedded-003B57?style=flat-square&logo=sqlite" alt="SQLite">
+2
View File
@@ -10,6 +10,8 @@
<p align="center">
<a href="https://github.com/Awuqing/BackupX/stargazers"><img src="https://img.shields.io/github/stars/Awuqing/BackupX?style=flat-square&color=f5c542" alt="Stars"></a>
<a href="https://github.com/Awuqing/BackupX/releases"><img src="https://img.shields.io/github/v/release/Awuqing/BackupX?style=flat-square&color=brightgreen" alt="Release"></a>
<a href="https://github.com/Awuqing/BackupX/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/Awuqing/BackupX/ci.yml?branch=main&style=flat-square" alt="CI"></a>
<a href="https://github.com/Awuqing/BackupX/actions/workflows/docs.yml"><img src="https://img.shields.io/github/actions/workflow/status/Awuqing/BackupX/docs.yml?branch=main&style=flat-square&label=docs" alt="Docs"></a>
<img src="https://img.shields.io/badge/Go-1.25+-00ADD8?style=flat-square&logo=go" alt="Go">
<img src="https://img.shields.io/badge/React-18-61DAFB?style=flat-square&logo=react" alt="React">
<img src="https://img.shields.io/badge/SQLite-embedded-003B57?style=flat-square&logo=sqlite" alt="SQLite">
+1 -1
View File
@@ -6,7 +6,7 @@ description: Get a BackupX dev environment running — backend, frontend, tests.
# Development Setup
**Requirements:** Go ≥ 1.25, Node.js ≥ 20, npm.
**Requirements:** Go ≥ 1.25, Node.js 24 LTS, npm 11 or later.
## Clone & install
@@ -51,7 +51,7 @@ The installer:
## From source
Requires Go ≥ 1.25 and Node.js ≥ 20.
Requires Go ≥ 1.25, Node.js 24 LTS, and npm 11 or later.
```bash
git clone https://github.com/Awuqing/BackupX.git && cd BackupX
@@ -6,7 +6,7 @@ description: 搭建 BackupX 本地开发环境 — 后端、前端、测试。
# 开发环境
**环境要求:** Go ≥ 1.25Node.js ≥ 20npm
**环境要求:** Go ≥ 1.25Node.js 24 LTS、npm 11 或更高版本
## 克隆与依赖
@@ -51,7 +51,7 @@ sudo ./install.sh # 创建系统用户、安装到 /opt/backupx、配置
## 从源码构建
依赖:Go ≥ 1.25Node.js ≥ 20
依赖:Go ≥ 1.25Node.js 24 LTS、npm 11 或更高版本
```bash
git clone https://github.com/Awuqing/BackupX.git && cd BackupX
+1 -1
View File
@@ -25,7 +25,7 @@
"typescript": "~6.0.2"
},
"engines": {
"node": ">=20.0"
"node": ">=24.0"
}
},
"node_modules/@11ty/gray-matter": {
+1 -1
View File
@@ -44,6 +44,6 @@
]
},
"engines": {
"node": ">=20.0"
"node": ">=24.0"
}
}
+11 -8
View File
@@ -23,7 +23,7 @@
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@testing-library/user-event": "^14.6.1",
"@types/node": "^22.13.10",
"@types/node": "^24.13.3",
"@types/react": "^18.3.20",
"@types/react-dom": "^18.3.6",
"@vitejs/plugin-react": "^4.3.4",
@@ -31,6 +31,9 @@
"typescript": "^5.7.3",
"vite": "^6.4.3",
"vitest": "^3.2.7"
},
"engines": {
"node": ">=24.0"
}
},
"node_modules/@adobe/css-tools": {
@@ -1529,13 +1532,13 @@
"license": "MIT"
},
"node_modules/@types/node": {
"version": "22.19.15",
"resolved": "https://registry.npmmirror.com/@types/node/-/node-22.19.15.tgz",
"integrity": "sha512-F0R/h2+dsy5wJAUe3tAU6oqa2qbWY5TpNfL/RGmo1y38hiyO1w3x2jPtt76wmuaJI4DQnOBu21cNXQ2STIUUWg==",
"version": "24.13.3",
"resolved": "https://registry.npmjs.org/@types/node/-/node-24.13.3.tgz",
"integrity": "sha512-Dh8vAsV36ig5wa9OX4pXvMc9D3Veibfw2wix0CUwYODLD8nkj9UsLjASr49nPg+2eKzxhBV+v7L8pXvT4e639Q==",
"dev": true,
"license": "MIT",
"dependencies": {
"undici-types": "~6.21.0"
"undici-types": "~7.18.0"
}
},
"node_modules/@types/prop-types": {
@@ -3468,9 +3471,9 @@
}
},
"node_modules/undici-types": {
"version": "6.21.0",
"resolved": "https://registry.npmmirror.com/undici-types/-/undici-types-6.21.0.tgz",
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
"version": "7.18.2",
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.18.2.tgz",
"integrity": "sha512-AsuCzffGHJybSaRrmr5eHr81mwJU3kjw6M+uprWvCXiNeN9SOGwQ3Jn8jb8m3Z6izVgknn1R0FTCEAP2QrLY/w==",
"dev": true,
"license": "MIT"
},
+6 -2
View File
@@ -3,9 +3,13 @@
"private": true,
"version": "0.1.0",
"type": "module",
"engines": {
"node": ">=24.0"
},
"scripts": {
"dev": "vite",
"build": "tsc --noEmit -p tsconfig.json && vite build",
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p tsconfig.node.json",
"build": "npm run typecheck && vite build",
"preview": "vite preview",
"test": "vitest run"
},
@@ -25,7 +29,7 @@
"@testing-library/jest-dom": "^6.6.3",
"@testing-library/react": "^16.2.0",
"@testing-library/user-event": "^14.6.1",
"@types/node": "^22.13.10",
"@types/node": "^24.13.3",
"@types/react": "^18.3.20",
"@types/react-dom": "^18.3.6",
"@vitejs/plugin-react": "^4.3.4",
+1 -2
View File
@@ -29,6 +29,5 @@
"src/pages/login/page.tsx",
"src/pages/system-info/page.tsx",
"src/stores/auth.test.ts"
],
"references": [{ "path": "./tsconfig.node.json" }]
]
}
+1 -1
View File
@@ -1,11 +1,11 @@
{
"compilerOptions": {
"composite": true,
"target": "ES2020",
"lib": ["ES2020", "DOM"],
"module": "ESNext",
"moduleResolution": "Bundler",
"allowSyntheticDefaultImports": true,
"noEmit": true,
"types": ["node"]
},
"include": ["vite.config.ts"]
File diff suppressed because one or more lines are too long
-1
View File
@@ -1 +0,0 @@
{"root":["./src/rootapp.tsx","./src/main.tsx","./src/components/authbootstrap.tsx","./src/components/fullpageloading.tsx","./src/layouts/applayout.tsx","./src/pages/dashboard/dashboardpage.tsx","./src/pages/login/loginpage.tsx","./src/pages/system-info/systeminfopage.tsx","./src/router/protectedroute.tsx","./src/router/index.tsx","./src/services/auth.ts","./src/services/http.ts","./src/services/system.ts","./src/stores/auth.ts","./src/test/setup.ts","./src/types/api.ts","./src/types/auth.ts","./src/types/system.ts"],"version":"5.9.3"}
-2
View File
@@ -1,2 +0,0 @@
declare const _default: import("vite").UserConfig;
export default _default;
-32
View File
@@ -1,32 +0,0 @@
import { defineConfig } from 'vitest/config';
import react from '@vitejs/plugin-react';
export default defineConfig({
plugins: [react()],
server: {
port: 5173,
proxy: {
'/api': {
target: 'http://127.0.0.1:8340',
changeOrigin: true,
},
},
},
build: {
rollupOptions: {
output: {
manualChunks: {
'vendor-react': ['react', 'react-dom', 'react-router-dom'],
'vendor-arco': ['@arco-design/web-react'],
'vendor-echarts': ['echarts', 'echarts-for-react'],
},
},
},
},
test: {
environment: 'jsdom',
setupFiles: './src/test/setup.ts',
globals: true,
include: ['src/**/*.test.ts', 'src/**/*.test.tsx'],
exclude: ['src/components/auth-guard.test.tsx', 'src/stores/auth.test.ts'],
},
});