UNPKG

byt-commit-hooks

Version:

git commit hooks

35 lines (31 loc) 859 B
/* * @Description: * @Author: 王国火 * @Date: 2025-06-23 15:52:57 * @LastEditTime: 2025-06-24 10:20:22 * @LastEditors: 王国火 */ const fs = require('fs'); const path = require('path'); const lintFileNames=require("./verify-filename"); const lintRoutePaths = require("./verify-route-path"); function getConfig() { return new Promise(resolve => { // 读取根配置文件 .commit-hooks.json try { const configPath = path.join(process.cwd(), '.commit-hooks.json'); if (fs.existsSync(configPath)) { return resolve(JSON.parse(fs.readFileSync(configPath, 'utf8'))); } resolve({}); } catch (error) { console.error(`解析配置文件失败: ${error.message}`); resolve({}); } }) } module.exports = { getConfig, lintFileNames, lintRoutePaths };