@blueking/bkui-lint 0.1.6 → 0.1.8
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/eslint.mjs +1 -1
- package/package.json +1 -1
- package/verify-commit.mjs +58 -0
package/eslint.mjs
CHANGED
package/package.json
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Tencent is pleased to support the open source community by making
|
|
3
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) available.
|
|
4
|
+
*
|
|
5
|
+
* Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved.
|
|
6
|
+
*
|
|
7
|
+
* 蓝鲸智云PaaS平台 (BlueKing PaaS) is licensed under the MIT License.
|
|
8
|
+
*
|
|
9
|
+
* License for 蓝鲸智云PaaS平台 (BlueKing PaaS):
|
|
10
|
+
*
|
|
11
|
+
* ---------------------------------------------------
|
|
12
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
|
|
13
|
+
* documentation files (the "Software"), to deal in the Software without restriction, including without limitation
|
|
14
|
+
* the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and
|
|
15
|
+
* to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
16
|
+
*
|
|
17
|
+
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of
|
|
18
|
+
* the Software.
|
|
19
|
+
*
|
|
20
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
|
21
|
+
* THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
22
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
|
|
23
|
+
* CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
|
24
|
+
* IN THE SOFTWARE.
|
|
25
|
+
*/
|
|
26
|
+
/*
|
|
27
|
+
("feat", "A new feature. Correlates with MINOR in SemVer"),
|
|
28
|
+
("fix", "A bug fix. Correlates with PATCH in SemVer"),
|
|
29
|
+
("docs", "Documentation only changes"),
|
|
30
|
+
("style", "Changes that do not affect the meaning of the code"),
|
|
31
|
+
("refactor", "A code change that neither fixes a bug nor adds a feature"),
|
|
32
|
+
("perf", "A code change that improves performance"),
|
|
33
|
+
("test", "Adding missing or correcting existing tests"),
|
|
34
|
+
("chore", "Changes to the build process or auxiliary tools and libraries such as documentation generation"),
|
|
35
|
+
|
|
36
|
+
# 即将启用的prefix,仍保留一段时间
|
|
37
|
+
("feature", "新特性"),
|
|
38
|
+
("bugfix", "线上功能bug"),
|
|
39
|
+
("minor", "不重要的修改(换行,拼写错误等)"),
|
|
40
|
+
("optimization", "功能优化"),
|
|
41
|
+
("sprintfix", "未上线代码修改 (功能模块未上线部分bug)"),
|
|
42
|
+
("merge", "分支合并及冲突解决"),
|
|
43
|
+
*/
|
|
44
|
+
import { readFileSync } from 'node:fs';
|
|
45
|
+
import colors from 'picocolors';
|
|
46
|
+
const msgPath = process.argv[2];
|
|
47
|
+
const msg = readFileSync(msgPath, 'utf-8').trim();
|
|
48
|
+
const oldCommitRE = /^(revert: )?(feature|bugfix|minor|optimization|sprintfix|merge)(\(.+\))?: .{1,50}/;
|
|
49
|
+
const newCommitRE = /^(revert: )?(feat|fix|docs|style|refactor|perf|test|chore)(\(.+\))?: .{1,50}/;
|
|
50
|
+
if (!(oldCommitRE.test(msg) || newCommitRE.test(msg)) && !msg.includes('Merge branch')) {
|
|
51
|
+
console.log(msg);
|
|
52
|
+
console.log('\n');
|
|
53
|
+
console.error(
|
|
54
|
+
` ${colors.bgRed(colors.white(' ERROR '))} ${colors.red('invalid commit message format.')}\n\n${colors.red(' Proper commit message format is required for automated changelog generation. Examples:\n\n')} ${colors.green("feature: add 'comments' option")}\n` +
|
|
55
|
+
` ${colors.green('bugfix: handle events on blur (close #28)')}\n}`,
|
|
56
|
+
);
|
|
57
|
+
process.exit(1);
|
|
58
|
+
}
|