@semi-kit/config 1.1.1 → 1.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +23 -23
- package/lib/commitlint.mjs +112 -0
- package/lib/prettier.mjs +37 -22
- package/package.json +1 -1
- package/lib/commitlint.cjs +0 -181
package/README.md
CHANGED
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
# tsdown-starter
|
|
2
|
-
|
|
3
|
-
A starter for creating a TypeScript package.
|
|
4
|
-
|
|
5
|
-
## Development
|
|
6
|
-
|
|
7
|
-
- Install dependencies:
|
|
8
|
-
|
|
9
|
-
```bash
|
|
10
|
-
npm install
|
|
11
|
-
```
|
|
12
|
-
|
|
13
|
-
- Run the unit tests:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm run test
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
- Build the library:
|
|
20
|
-
|
|
21
|
-
```bash
|
|
22
|
-
npm run build
|
|
23
|
-
```
|
|
1
|
+
# tsdown-starter
|
|
2
|
+
|
|
3
|
+
A starter for creating a TypeScript package.
|
|
4
|
+
|
|
5
|
+
## Development
|
|
6
|
+
|
|
7
|
+
- Install dependencies:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- Run the unit tests:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run test
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
- Build the library:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm run build
|
|
23
|
+
```
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) Semi-Tech(SEMI-TECH) Corporation. All rights reserved.
|
|
3
|
+
* It is against the law to copy the software except as specifically
|
|
4
|
+
* allowed in the authorization agreement.
|
|
5
|
+
* Semi-Tech Confidential Level 2
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { execSync } = require('child_process');
|
|
9
|
+
const scopes = execSync('git status --porcelain || true')
|
|
10
|
+
?.toString()
|
|
11
|
+
?.trim()
|
|
12
|
+
?.split('\n')
|
|
13
|
+
?.map(item => {
|
|
14
|
+
const result = item?.match(/([A-Za-z0-9-_]*)\.[^.]+$/)?.[1];
|
|
15
|
+
return item === 'Custom' ? result : result?.toLowerCase();
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
module.exports = {
|
|
19
|
+
rules: {
|
|
20
|
+
'type-enum': [
|
|
21
|
+
2,
|
|
22
|
+
'always',
|
|
23
|
+
['feat', 'fix', 'docs', 'style', 'refactor', 'perf', 'test', 'build', 'ci', 'revert', 'chore']
|
|
24
|
+
],
|
|
25
|
+
'body-leading-blank': [2, 'always'],
|
|
26
|
+
'body-max-line-length': [2, 'always', 100],
|
|
27
|
+
'footer-leading-blank': [2, 'always'],
|
|
28
|
+
'footer-max-line-length': [2, 'always', 100],
|
|
29
|
+
'footer-max-length': [2, 'always', 100],
|
|
30
|
+
'header-max-length': [2, 'always', 200],
|
|
31
|
+
'type-case': [2, 'always', 'lower-case'],
|
|
32
|
+
'type-empty': [2, 'never'],
|
|
33
|
+
'scope-case': [2, 'always', 'kebab-case'],
|
|
34
|
+
'scope-max-length': [2, 'always', 30],
|
|
35
|
+
'scope-min-length': [2, 'always', 2],
|
|
36
|
+
'subject-max-length': [2, 'always', 100],
|
|
37
|
+
'subject-min-length': [2, 'always', 3],
|
|
38
|
+
'subject-empty': [2, 'never'],
|
|
39
|
+
'subject-full-stop': [2, 'never', '.']
|
|
40
|
+
},
|
|
41
|
+
prompt: {
|
|
42
|
+
messages: {
|
|
43
|
+
type: '选择提交的类型 :',
|
|
44
|
+
scope: '选择修改范围 :',
|
|
45
|
+
customScope: '请输入自定义的提交范围 :',
|
|
46
|
+
subject: '填写简短精炼的变更描述 :\n',
|
|
47
|
+
footer: '列举关联issue (可选) 例如: #31, #101 :\n',
|
|
48
|
+
confirmCommit: '是否提交或修改 commit ?'
|
|
49
|
+
},
|
|
50
|
+
types: [
|
|
51
|
+
{ value: 'feat', name: 'feat: ✨ 新增功能 | A new feature', emoji: ':sparkles:' },
|
|
52
|
+
{ value: 'fix', name: 'fix: 🐛 修复缺陷 | A bug fix', emoji: ':bug:' },
|
|
53
|
+
{
|
|
54
|
+
value: 'docs',
|
|
55
|
+
name: 'docs: 📝 文档更新 | Documentation only changes',
|
|
56
|
+
emoji: ':memo:'
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
value: 'style',
|
|
60
|
+
name: 'style: 💄 代码格式 | Changes that do not affect the meaning of the code',
|
|
61
|
+
emoji: ':lipstick:'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
value: 'refactor',
|
|
65
|
+
name: 'refactor: ♻️ 代码重构 | A code change that neither fixes a bug nor adds a feature',
|
|
66
|
+
emoji: ':recycle:'
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
value: 'perf',
|
|
70
|
+
name: 'perf: ⚡️ 性能提升 | A code change that improves performance',
|
|
71
|
+
emoji: ':zap:'
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
value: 'test',
|
|
75
|
+
name: 'test: ✅ 测试相关 | Adding missing tests or correcting existing tests',
|
|
76
|
+
emoji: ':white_check_mark:'
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
value: 'build',
|
|
80
|
+
name: 'build: 📦️ 构建相关 | Changes that affect the build system or external dependencies',
|
|
81
|
+
emoji: ':package:'
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
value: 'ci',
|
|
85
|
+
name: 'ci: 🎡 持续集成 | Changes to our CI configuration files and scripts',
|
|
86
|
+
emoji: ':ferris_wheel:'
|
|
87
|
+
},
|
|
88
|
+
{ value: 'revert', name: 'revert: ⏪️ 代码回退 | Revert to a commit', emoji: ':hammer:' },
|
|
89
|
+
{
|
|
90
|
+
value: 'chore',
|
|
91
|
+
name: 'chore: 🔨 其他修改 | Other changes that do not modify src or test files',
|
|
92
|
+
emoji: ':rewind:'
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
scopes,
|
|
96
|
+
customScopesAlias: '自定义',
|
|
97
|
+
allowBreakingChanges: ['feat', 'fix', 'refactor', 'chore', 'ci', 'perf', 'revert'],
|
|
98
|
+
skipQuestions: ['body', 'footerPrefix', 'breaking', 'customFooterPrefixs'],
|
|
99
|
+
maxHeaderLength: 200,
|
|
100
|
+
maxSubjectLength: 100,
|
|
101
|
+
minSubjectLength: 3,
|
|
102
|
+
formatMessageCB: ({ defaultHeader, footer }) => {
|
|
103
|
+
let res = defaultHeader;
|
|
104
|
+
if (footer) {
|
|
105
|
+
const reg = /#(\d+)/g;
|
|
106
|
+
const result = footer.replace(reg, `\nhttps://redmine.semi-tech.com/issues/$1`).replace(/^\n|\n$/g, '');
|
|
107
|
+
res += `${result}`;
|
|
108
|
+
}
|
|
109
|
+
return res;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
};
|
package/lib/prettier.mjs
CHANGED
|
@@ -1,22 +1,37 @@
|
|
|
1
|
-
const config = {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
1
|
+
const config = {
|
|
2
|
+
plugins: ['@prettier/plugin-oxc'],
|
|
3
|
+
// 单行输出(不折行)的(最大)长度
|
|
4
|
+
printWidth: 120,
|
|
5
|
+
// 每个缩进级别的空格数
|
|
6
|
+
tabWidth: 2,
|
|
7
|
+
// 使用制表符 Tab 缩进行而不是空格 Space。
|
|
8
|
+
tabs: true,
|
|
9
|
+
// 是否在语句末尾打印分号
|
|
10
|
+
semi: true,
|
|
11
|
+
// 是否使用单引号
|
|
12
|
+
singleQuote: true,
|
|
13
|
+
// 仅在需要时在对象属性周围添加引号
|
|
14
|
+
quoteProps: 'preserve',
|
|
15
|
+
// 是否在对象属性添加空格
|
|
16
|
+
bracketSpacing: true,
|
|
17
|
+
// 将 > 多行 JSX 元素放在最后一行的末尾,而不是单独放在下一行,不适用于自闭元素
|
|
18
|
+
jsxBracketSameLine: false,
|
|
19
|
+
// 去除对象最末尾元素跟随的逗号
|
|
20
|
+
trailingComma: 'none',
|
|
21
|
+
// 不使用缩进符,而使用空格
|
|
22
|
+
useTabs: false,
|
|
23
|
+
// Jsx 不使用单引号,而使用双引号
|
|
24
|
+
jsxSingleQuote: false,
|
|
25
|
+
// 箭头函数,只有一个参数的时候,也需要括号
|
|
26
|
+
arrowParens: 'avoid',
|
|
27
|
+
// 每个文件格式化的范围是文件的全部内容
|
|
28
|
+
rangeStart: 0,
|
|
29
|
+
// 当超出 Print Width 时就折行
|
|
30
|
+
proseWrap: 'always',
|
|
31
|
+
// 换行符
|
|
32
|
+
endOfLine: 'auto',
|
|
33
|
+
// Vue 文件脚本和样式标签缩进
|
|
34
|
+
vueIndentScriptAndStyle: false
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export default config;
|
package/package.json
CHANGED
package/lib/commitlint.cjs
DELETED
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
const { execSync } = require("child_process");
|
|
3
|
-
const scopes = execSync("git status --porcelain || true")?.toString()?.trim()?.split("\n")?.map((item) => {
|
|
4
|
-
const result = item?.match(/([A-Za-z0-9-_]*)\.[^.]+$/)?.[1];
|
|
5
|
-
return item === "Custom" ? result : result?.toLowerCase();
|
|
6
|
-
});
|
|
7
|
-
module.exports = {
|
|
8
|
-
rules: {
|
|
9
|
-
"type-enum": [
|
|
10
|
-
2,
|
|
11
|
-
"always",
|
|
12
|
-
[
|
|
13
|
-
"feat",
|
|
14
|
-
"fix",
|
|
15
|
-
"docs",
|
|
16
|
-
"style",
|
|
17
|
-
"refactor",
|
|
18
|
-
"perf",
|
|
19
|
-
"test",
|
|
20
|
-
"build",
|
|
21
|
-
"ci",
|
|
22
|
-
"revert",
|
|
23
|
-
"chore"
|
|
24
|
-
]
|
|
25
|
-
],
|
|
26
|
-
"body-leading-blank": [2, "always"],
|
|
27
|
-
"body-max-line-length": [
|
|
28
|
-
2,
|
|
29
|
-
"always",
|
|
30
|
-
100
|
|
31
|
-
],
|
|
32
|
-
"footer-leading-blank": [2, "always"],
|
|
33
|
-
"footer-max-line-length": [
|
|
34
|
-
2,
|
|
35
|
-
"always",
|
|
36
|
-
100
|
|
37
|
-
],
|
|
38
|
-
"footer-max-length": [
|
|
39
|
-
2,
|
|
40
|
-
"always",
|
|
41
|
-
100
|
|
42
|
-
],
|
|
43
|
-
"header-max-length": [
|
|
44
|
-
2,
|
|
45
|
-
"always",
|
|
46
|
-
200
|
|
47
|
-
],
|
|
48
|
-
"type-case": [
|
|
49
|
-
2,
|
|
50
|
-
"always",
|
|
51
|
-
"lower-case"
|
|
52
|
-
],
|
|
53
|
-
"type-empty": [2, "never"],
|
|
54
|
-
"scope-case": [
|
|
55
|
-
2,
|
|
56
|
-
"always",
|
|
57
|
-
"kebab-case"
|
|
58
|
-
],
|
|
59
|
-
"scope-max-length": [
|
|
60
|
-
2,
|
|
61
|
-
"always",
|
|
62
|
-
30
|
|
63
|
-
],
|
|
64
|
-
"scope-min-length": [
|
|
65
|
-
2,
|
|
66
|
-
"always",
|
|
67
|
-
2
|
|
68
|
-
],
|
|
69
|
-
"subject-max-length": [
|
|
70
|
-
2,
|
|
71
|
-
"always",
|
|
72
|
-
100
|
|
73
|
-
],
|
|
74
|
-
"subject-min-length": [
|
|
75
|
-
2,
|
|
76
|
-
"always",
|
|
77
|
-
3
|
|
78
|
-
],
|
|
79
|
-
"subject-empty": [2, "never"],
|
|
80
|
-
"subject-full-stop": [
|
|
81
|
-
2,
|
|
82
|
-
"never",
|
|
83
|
-
"."
|
|
84
|
-
]
|
|
85
|
-
},
|
|
86
|
-
prompt: {
|
|
87
|
-
messages: {
|
|
88
|
-
type: "选择提交的类型 :",
|
|
89
|
-
scope: "选择修改范围 :",
|
|
90
|
-
customScope: "请输入自定义的提交范围 :",
|
|
91
|
-
subject: "填写简短精炼的变更描述 :\n",
|
|
92
|
-
footer: "列举关联issue (可选) 例如: #31, #101 :\n",
|
|
93
|
-
confirmCommit: "是否提交或修改 commit ?"
|
|
94
|
-
},
|
|
95
|
-
types: [
|
|
96
|
-
{
|
|
97
|
-
value: "feat",
|
|
98
|
-
name: "feat: ✨ 新增功能 | A new feature",
|
|
99
|
-
emoji: ":sparkles:"
|
|
100
|
-
},
|
|
101
|
-
{
|
|
102
|
-
value: "fix",
|
|
103
|
-
name: "fix: 🐛 修复缺陷 | A bug fix",
|
|
104
|
-
emoji: ":bug:"
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
value: "docs",
|
|
108
|
-
name: "docs: 📝 文档更新 | Documentation only changes",
|
|
109
|
-
emoji: ":memo:"
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
value: "style",
|
|
113
|
-
name: "style: 💄 代码格式 | Changes that do not affect the meaning of the code",
|
|
114
|
-
emoji: ":lipstick:"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
value: "refactor",
|
|
118
|
-
name: "refactor: ♻️ 代码重构 | A code change that neither fixes a bug nor adds a feature",
|
|
119
|
-
emoji: ":recycle:"
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
value: "perf",
|
|
123
|
-
name: "perf: ⚡️ 性能提升 | A code change that improves performance",
|
|
124
|
-
emoji: ":zap:"
|
|
125
|
-
},
|
|
126
|
-
{
|
|
127
|
-
value: "test",
|
|
128
|
-
name: "test: ✅ 测试相关 | Adding missing tests or correcting existing tests",
|
|
129
|
-
emoji: ":white_check_mark:"
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
value: "build",
|
|
133
|
-
name: "build: 📦️ 构建相关 | Changes that affect the build system or external dependencies",
|
|
134
|
-
emoji: ":package:"
|
|
135
|
-
},
|
|
136
|
-
{
|
|
137
|
-
value: "ci",
|
|
138
|
-
name: "ci: 🎡 持续集成 | Changes to our CI configuration files and scripts",
|
|
139
|
-
emoji: ":ferris_wheel:"
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
value: "revert",
|
|
143
|
-
name: "revert: ⏪️ 代码回退 | Revert to a commit",
|
|
144
|
-
emoji: ":hammer:"
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
value: "chore",
|
|
148
|
-
name: "chore: 🔨 其他修改 | Other changes that do not modify src or test files",
|
|
149
|
-
emoji: ":rewind:"
|
|
150
|
-
}
|
|
151
|
-
],
|
|
152
|
-
scopes,
|
|
153
|
-
customScopesAlias: "自定义",
|
|
154
|
-
allowBreakingChanges: [
|
|
155
|
-
"feat",
|
|
156
|
-
"fix",
|
|
157
|
-
"refactor",
|
|
158
|
-
"chore",
|
|
159
|
-
"ci",
|
|
160
|
-
"perf",
|
|
161
|
-
"revert"
|
|
162
|
-
],
|
|
163
|
-
skipQuestions: [
|
|
164
|
-
"body",
|
|
165
|
-
"footerPrefix",
|
|
166
|
-
"breaking",
|
|
167
|
-
"customFooterPrefixs"
|
|
168
|
-
],
|
|
169
|
-
maxHeaderLength: 200,
|
|
170
|
-
maxSubjectLength: 100,
|
|
171
|
-
minSubjectLength: 3,
|
|
172
|
-
formatMessageCB: ({ defaultHeader, footer }) => {
|
|
173
|
-
let res = defaultHeader;
|
|
174
|
-
if (footer) {
|
|
175
|
-
const result = footer.replace(/#(\d+)/g, `\nhttps://redmine.semi-tech.com/issues/$1`).replace(/^\n|\n$/g, "");
|
|
176
|
-
res += `${result}`;
|
|
177
|
-
}
|
|
178
|
-
return res;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
};
|