1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-10-29 03:16:57 +08:00

refactor(chore): 迁移至 fairy-cli 工程化并升级 @142vip 依赖

- 新增 fairy.config.ts,单包仓覆盖 commitmsg/preinstall,移除 simple-git-hooks
- 升级 fairy-cli、utils、vuepress;check:commit 改为 fa commit --quiet
- 删除 scripts/core/verify-commit.ts,保留 scripts/ci 供 CI/Docker 安装依赖
This commit is contained in:
chufan
2026-10-09 16:51:56 +08:00
parent 3bf10930d7
commit 7454b0380c
6 changed files with 898 additions and 813 deletions

View File

@@ -8,5 +8,4 @@ export default defineVipEslintConfig({
'.vuepress/.cache/**',
'vuepress.config.ts.*.mjs',
],
rules: {},
})

30
fairy.config.ts Normal file
View File

@@ -0,0 +1,30 @@
import { defineFairyConfig } from '@142vip/fairy-cli'
/**
* 本仓为单包 VuePress 文档站(无 `pnpm-workspace.yaml`),工程化基座为 `@142vip/fairy-cli`。
*
* - `pnpm i` 会执行 `@142vip/fairy-cli` postinstall,合并默认钩子并写入 `.git/hooks`
* - 覆盖默认 `commitmsg`(去掉 Monorepo `-s`);关闭 `precommit`
* - `pnpm check:commit` / `commit-msg`:`npx fa commit --quiet`
* - `pnpm release`:`npx fa release`(`release.vip` + `checkBranch`)
*/
export default defineFairyConfig({
hooks: {
precommit: false,
commitmsg: 'npx fa commit --quiet',
preinstall: [
'npx only-allow pnpm',
'sh -c \'if [ -d ./scripts ]; then find ./scripts -maxdepth 1 -type f -exec chmod +x {} +; fi\'',
],
},
commit: {
quiet: true,
},
release: {
vip: true,
checkBranch: [
'next',
'main',
],
},
})

View File

@@ -16,31 +16,24 @@
"pnpm": "9.15.0"
},
"scripts": {
"preinstall": "npx only-allow pnpm && chmod +x ./scripts/*",
"postinstall": "rm -rf .git/hooks && npx simple-git-hooks",
"clean": "npx fa clean --ignore-tips --dist --vite --deps --all",
"clean:hooks": "npx fa clean --git-hooks --all --ignore-tips",
"dev": "npx vuepress dev",
"build": "npx vuepress build --clean-temp --clean-cache",
"build:proxy": "NEED_PROXY=true npx vuepress build --clean-temp --clean-cache",
"build:image": "./scripts/build-image",
"lint": "npx fa lint",
"lint:fix": "npx fa lint --fix",
"dev": "vuepress dev",
"build": "vuepress build --clean-temp --clean-cache",
"build:proxy": "NEED_PROXY=true vuepress build --clean-temp --clean-cache",
"release": "npx fa release --vip --check-branch next --check-branch main",
"check:commit": "npx node --loader ts-node/esm --no-warnings scripts/core/verify-commit.ts"
"clean": "npx fa clean --ignore-tips --dist --vite --deps --all",
"clean:hooks": "npx fa clean --git-hooks --all --ignore-tips",
"release": "npx fa release",
"check:commit": "npx fa commit --quiet"
},
"devDependencies": {
"@142vip/commit-linter": "0.0.1-alpha.2",
"@142vip/eslint-config": "0.0.1-alpha.6",
"@142vip/fairy-cli": "0.0.3-alpha.33",
"@142vip/eslint-config": "0.0.1-alpha.9",
"@142vip/fairy-cli": "0.0.3-alpha.41",
"@142vip/open-source": "0.0.1-alpha.4",
"@142vip/utils": "0.0.1-alpha.58",
"@142vip/utils": "0.0.1-alpha.65",
"@142vip/vuepress": "0.0.1-alpha.25",
"only-allow": "1.2.1",
"simple-git-hooks": "2.13.0",
"ts-node": "10.9.2"
},
"simple-git-hooks": {
"pre-commit": "pnpm lint:fix",
"commit-msg": "pnpm check:commit"
}
}

1633
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,9 +1,10 @@
#!/bin/bash
#
# 依赖安装脚本
# 依赖安装脚本(CI / Docker / 本地)
# 使用:
# ./scripts/ci
# ./scripts/ci --ignore-scripts # Docker 构建阶段跳过 lifecycle
#
set -euo pipefail

View File

@@ -1,15 +0,0 @@
import { commitLiner } from '@142vip/commit-linter'
import { VipColor, VipConsole, vipLogger } from '@142vip/utils'
/**
* 验证Git Commit信息
*/
function verifyCommitMain(): void {
const { type, scope, subject, commit } = commitLiner()
// 提交符合规范,打印相关信息
VipConsole.log(`type: ${type}, scope: ${scope}, subject: ${subject}`)
vipLogger.logByBlank(`${VipColor.greenBright('Git Commit: ')} ${VipColor.green(commit)}`)
}
void verifyCommitMain()