1 Star 6 Fork 0

hu-snail/snail-uni

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
verify-commit.mjs 947 Bytes
一键复制 编辑 原始数据 按行查看 历史
Admin 提交于 2024-07-28 00:07 . feat: project init
import pico from 'picocolors';
import { readFileSync } from 'node:fs';
import path from 'node:path';
const msgPath = path.resolve('.git/COMMIT_EDITMSG');
const msg = readFileSync(msgPath, 'utf-8').trim();
const commitRE =
/^(revert: )?(feat|fix|docs|dx|style|refactor|perf|test|workflow|build|ci|chore|types|wip|release)((.+))?: .{1,50}/;
if (!commitRE.test(msg)) {
console.log(pico.yellow(`\n你提交的信息: ${msg}\n`));
console.error(
` ${pico.white(pico.bgRed(' 错误 '))} ${pico.red(
`无效的提交信息格式.`
)}\n\n` +
pico.red(` 正确的提交消息格式. 例如:\n\n`) +
` ${pico.green(`feat: add a new feature`)}\n` +
` ${pico.green(`fix: fixed an interaction bug`)}\n\n` +
pico.red(
`我们参考了Vue3的方案.\n` +
`访问 https://github.com/vuejs/core/blob/main/.github/commit-convention.md 查看更多细节.\n`
)
);
process.exit(1);
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/hu-snail/snail-uni.git
[email protected]:hu-snail/snail-uni.git
hu-snail
snail-uni
snail-uni
main

搜索帮助