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:
@@ -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
3
pnpm-lock.yaml
generated
@@ -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)
|
||||
|
||||
@@ -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
15
scripts/core/verify-commit.ts
Executable 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()
|
||||
Reference in New Issue
Block a user