1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-10-28 19:06:10 +08:00

feat: 引入@142vip/commit-linter依赖,增加check:commit命令,校验commit信息 (#147)

This commit is contained in:
142vip.cn
2025-05-12 19:25:32 +08:00
committed by GitHub
parent 237b3abded
commit 3878a438b0
4 changed files with 23 additions and 3 deletions

View File

@@ -26,9 +26,11 @@
"build": "npx vuepress build docs --clean-temp --clean-cache",
"build:proxy": "NEED_PROXY=true npx vuepress build docs --clean-temp --clean-cache",
"build:mark-map": "npx node --loader ts-node/esm --no-warnings scripts/core/mark-map.ts",
"release": "npx fa release --vip --check-branch next --check-branch main"
"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"
},
"devDependencies": {
"@142vip/commit-linter": "0.0.1-alpha.1",
"@142vip/eslint-config": "0.0.1-alpha.4",
"@142vip/fairy-cli": "0.0.3-alpha.24",
"@142vip/utils": "0.0.1-alpha.36",
@@ -43,6 +45,6 @@
},
"simple-git-hooks": {
"pre-commit": "pnpm lint:fix",
"prepare-commit-msg": "pnpm build"
"commit-msg": "pnpm check:commit"
}
}

3
pnpm-lock.yaml generated
View File

@@ -8,6 +8,9 @@ importers:
.:
devDependencies:
'@142vip/commit-linter':
specifier: 0.0.1-alpha.1
version: 0.0.1-alpha.1(@types/node@22.15.17)
'@142vip/eslint-config':
specifier: 0.0.1-alpha.4
version: 0.0.1-alpha.4(@typescript-eslint/utils@8.32.0(eslint@9.23.0(jiti@2.4.2))(typescript@5.8.3))(@vue/compiler-sfc@3.5.13)(jiti@2.4.2)(typescript@5.8.3)

View File

@@ -8,7 +8,7 @@ const markMapTargetPath = VipNodeJS.pathJoin(__dirname, 'docs/.vuepress/public/m
/**
* 扫描目录
*/
function scanDirectory(directory: string, fileType: string) {
function scanDirectory(directory: string, fileType: string): (string | null)[] {
const fileList = VipNodeJS.readdirSync(directory)
return fileList

15
scripts/core/verify-commit.ts Executable file
View File

@@ -0,0 +1,15 @@
import { commitLiner } from '@142vip/commit-linter'
import { VipColor, VipConsole, vipLogger } from '@142vip/utils'
/**
* 验证Git Commit信息
*/
async function verifyCommitMain(): Promise<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()