-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
67 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,3 @@ | ||
/* eslint-disable @typescript-eslint/no-var-requires */ | ||
// CommonJS | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const { execSync } = require('child_process'); | ||
|
||
const scopes = fs.readdirSync(path.resolve(__dirname, 'src')); | ||
|
||
const gitStatus = execSync('git status --porcelain || true').toString().trim().split('\n'); | ||
|
||
const scopeComplete = gitStatus | ||
.find((r) => ~r.indexOf('M src')) | ||
?.replace(/(\/)/g, '%%') | ||
?.match(/src%%((\w|-)*)/)?.[1]; | ||
|
||
const subjectComplete = gitStatus | ||
.find((r) => ~r.indexOf('M src')) | ||
?.replace(/\//g, '%%') | ||
?.match(/src%%((\w|-)*)/)?.[1]; | ||
|
||
module.exports = { | ||
extends: ['@jsxiaosi/commitlint-config'], | ||
prompt: { | ||
// 范围设置 | ||
scopes: [...scopes, 'mock'], | ||
// 范围是否可以多选 | ||
enableMultipleScopes: true, | ||
// 多选范围后用标识符隔开 | ||
scopeEnumSeparator: ',', | ||
// 设置 选择范围 中 为空选项(empty) 和 自定义选项(custom) 的 位置 | ||
customScopesAlign: !scopeComplete ? 'top' : 'bottom', | ||
// 如果 defaultScope 与在选择范围列表项中的 value 相匹配就会进行星标置顶操作。 | ||
defaultScope: scopeComplete, | ||
// 描述预设值 | ||
defaultSubject: subjectComplete && `[${subjectComplete}] `, | ||
}, | ||
}; | ||
require('@esbuild-kit/cjs-loader'); | ||
module.exports = require('./commitlint.config.ts').default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
import { execSync } from 'child_process'; | ||
|
||
const scopes = fs.readdirSync(path.resolve(__dirname, 'src')); | ||
|
||
const gitStatus = execSync('git status --porcelain || true').toString().trim().split('\n'); | ||
|
||
const scopeComplete = gitStatus | ||
.find((r) => ~r.indexOf('M src')) | ||
?.replace(/(\/)/g, '%%') | ||
?.match(/src%%((\w|-)*)/)?.[1]; | ||
|
||
const subjectComplete = gitStatus | ||
.find((r) => ~r.indexOf('M src')) | ||
?.replace(/\//g, '%%') | ||
?.match(/src%%((\w|-)*)/)?.[1]; | ||
|
||
export default { | ||
extends: ['@jsxiaosi/commitlint-config'], | ||
prompt: { | ||
// 范围设置 | ||
scopes: [...scopes, 'mock'], | ||
// 范围是否可以多选 | ||
enableMultipleScopes: true, | ||
// 多选范围后用标识符隔开 | ||
scopeEnumSeparator: ',', | ||
// 设置 选择范围 中 为空选项(empty) 和 自定义选项(custom) 的 位置 | ||
customScopesAlign: !scopeComplete ? 'top' : 'bottom', | ||
// 如果 defaultScope 与在选择范围列表项中的 value 相匹配就会进行星标置顶操作。 | ||
defaultScope: scopeComplete, | ||
// 描述预设值 | ||
defaultSubject: subjectComplete && `[${subjectComplete}] `, | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.