@semi-kit/config 1.0.2 → 1.0.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/lib/commitlint.cjs +181 -0
- package/lib/prettier.mjs +22 -0
- package/package.json +3 -3
- package/dist/_utils/index.mjs +0 -13
- package/dist/package.mjs +0 -166
|
@@ -0,0 +1,181 @@
|
|
|
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
|
+
};
|
package/lib/prettier.mjs
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
const config = {
|
|
2
|
+
plugins: ["@prettier/plugin-oxc"],
|
|
3
|
+
printWidth: 120,
|
|
4
|
+
tabWidth: 2,
|
|
5
|
+
tabs: true,
|
|
6
|
+
semi: true,
|
|
7
|
+
singleQuote: true,
|
|
8
|
+
quoteProps: "preserve",
|
|
9
|
+
bracketSpacing: true,
|
|
10
|
+
jsxBracketSameLine: false,
|
|
11
|
+
trailingComma: "none",
|
|
12
|
+
useTabs: false,
|
|
13
|
+
jsxSingleQuote: false,
|
|
14
|
+
arrowParens: "avoid",
|
|
15
|
+
rangeStart: 0,
|
|
16
|
+
proseWrap: "always",
|
|
17
|
+
endOfLine: "auto",
|
|
18
|
+
vueIndentScriptAndStyle: false
|
|
19
|
+
};
|
|
20
|
+
var prettier_default = config;
|
|
21
|
+
|
|
22
|
+
export { prettier_default as default };
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@semi-kit/config",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Shared development configuration toolkit",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"author": "lijiaheng <jahnli@163.com>",
|
|
8
8
|
"files": [
|
|
9
|
-
"
|
|
9
|
+
"lib"
|
|
10
10
|
],
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
@@ -37,4 +37,4 @@
|
|
|
37
37
|
"@prettier/plugin-oxc": "*",
|
|
38
38
|
"chalk": "*"
|
|
39
39
|
}
|
|
40
|
-
}
|
|
40
|
+
}
|
package/dist/_utils/index.mjs
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import chalk from "chalk";
|
|
2
|
-
import { exit } from "process";
|
|
3
|
-
|
|
4
|
-
//#region src/_utils/index.js
|
|
5
|
-
const log = (...msg) => console.log(...msg);
|
|
6
|
-
const logError = (...msg) => console.log(chalk.red(...msg));
|
|
7
|
-
const exit$1 = (msg) => {
|
|
8
|
-
logError(`> Error: ${msg}`);
|
|
9
|
-
exit(1);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
//#endregion
|
|
13
|
-
export { exit$1 as exit, log };
|
package/dist/package.mjs
DELETED
|
@@ -1,166 +0,0 @@
|
|
|
1
|
-
import { exit, log } from "./_utils/index.mjs";
|
|
2
|
-
import { readFileSync } from "fs";
|
|
3
|
-
|
|
4
|
-
//#region src/package.mjs
|
|
5
|
-
function readPackageFile() {
|
|
6
|
-
try {
|
|
7
|
-
log("inspect-package");
|
|
8
|
-
const file = readFileSync("package.json");
|
|
9
|
-
const packageJson = JSON.parse(file);
|
|
10
|
-
checkDependencies(packageJson);
|
|
11
|
-
checkDevDependencies(packageJson);
|
|
12
|
-
checkUnnecessaryDencies(packageJson);
|
|
13
|
-
} catch (error) {
|
|
14
|
-
exit("read package.json file error");
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
function checkDependencies(packageJson) {
|
|
18
|
-
const dependencies = [
|
|
19
|
-
"@intlify/unplugin-vue-i18n",
|
|
20
|
-
"@semi-kit/hooks",
|
|
21
|
-
"@semi-kit/utils",
|
|
22
|
-
"@semi-kit/vars",
|
|
23
|
-
"@vueuse/core",
|
|
24
|
-
"@vueuse/integrations",
|
|
25
|
-
"es-toolkit",
|
|
26
|
-
"pinia",
|
|
27
|
-
"pinia-plugin-persistedstate",
|
|
28
|
-
"vue",
|
|
29
|
-
"vue-i18n",
|
|
30
|
-
"vue-router"
|
|
31
|
-
];
|
|
32
|
-
const depends = packageJson.dependencies;
|
|
33
|
-
if (!depends) exit(`package.json 文件中缺少 dependencies 字段`);
|
|
34
|
-
for (let i = 0; i < dependencies.length; i++) {
|
|
35
|
-
const dep = dependencies[i];
|
|
36
|
-
if (!depends[dep]) exit(`dependencies 中缺少 ${dep} , 运行 "npm i - ${dep}" 或 "pnpm i ${dep}" 安装`);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
function checkDevDependencies(packageJson) {
|
|
40
|
-
const devDependencies = [
|
|
41
|
-
"@antfu/eslint-config",
|
|
42
|
-
"@commitlint/cli",
|
|
43
|
-
"@iconify-json/carbon",
|
|
44
|
-
"@types/node",
|
|
45
|
-
"@vitejs/plugin-vue",
|
|
46
|
-
"@vitejs/plugin-vue-jsx",
|
|
47
|
-
"@vue/tsconfig",
|
|
48
|
-
"commitizen",
|
|
49
|
-
"cz-git",
|
|
50
|
-
"eslint",
|
|
51
|
-
"eslint-plugin-standard-semi",
|
|
52
|
-
"simple-git-hooks",
|
|
53
|
-
"less",
|
|
54
|
-
"lint-staged",
|
|
55
|
-
"@semi-kit/config",
|
|
56
|
-
"unocss",
|
|
57
|
-
"typescript",
|
|
58
|
-
"unplugin-auto-import",
|
|
59
|
-
"unplugin-vue-components",
|
|
60
|
-
"vite",
|
|
61
|
-
"vue-tsc"
|
|
62
|
-
];
|
|
63
|
-
const depends = packageJson.devDependencies;
|
|
64
|
-
if (!depends) exit(`package.json 文件中缺少 devDependencies 字段`);
|
|
65
|
-
for (let i = 0; i < devDependencies.length; i++) {
|
|
66
|
-
const dep = devDependencies[i];
|
|
67
|
-
if (!depends[dep]) exit(`devDependencies 中缺少 ${dep} , 运行 "npm i - ${dep}" 或 "pnpm i -D ${dep}" 安装它`);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
function checkUnnecessaryDencies(packageJson) {
|
|
71
|
-
const unnecessaryDencies = {
|
|
72
|
-
fetch: "axios",
|
|
73
|
-
superagent: "axios",
|
|
74
|
-
"vue-cropper": "cropperjs",
|
|
75
|
-
"vue-cropperjs": "cropperjs",
|
|
76
|
-
"vue-advanced-cropper": "cropperjs",
|
|
77
|
-
"vue-image-crop-upload": "cropperjs",
|
|
78
|
-
highcharts: "echarts",
|
|
79
|
-
"chart.js": "echarts",
|
|
80
|
-
d3: "echarts",
|
|
81
|
-
"lodash-es": "es-toolkit",
|
|
82
|
-
underscore: "es-toolkit",
|
|
83
|
-
lodash: "es-toolkit",
|
|
84
|
-
nprogress: "Naive UI Progress Component",
|
|
85
|
-
"pace-js": "Naive UI Progress Component",
|
|
86
|
-
vuex: "pinia",
|
|
87
|
-
"pinia-plugin-persist": "pinia-plugin-persistedstate",
|
|
88
|
-
"pinia-plugin-persistedstate-2": "pinia-plugin-persistedstate",
|
|
89
|
-
"pinia-persists": "pinia-plugin-persistedstate",
|
|
90
|
-
qrcodejs: "Naive UI QRcode Conponent",
|
|
91
|
-
"vue-qrcode-reader": "Naive UI QRcode Conponent",
|
|
92
|
-
"vue-qrcode-component": "Naive UI QRcode Conponent",
|
|
93
|
-
"@chenfengyuan/vue-qrcode": "Naive UI QRcode Conponent",
|
|
94
|
-
"tinymce-vue": "wangEditor or tinymce",
|
|
95
|
-
"@tiptap/pm": "wangEditor or tinymce",
|
|
96
|
-
"@tiptap/vue-3": "wangEditor or tinymce",
|
|
97
|
-
"@tiptap/core": "wangEditor or tinymce",
|
|
98
|
-
"@toast-ui/vue-editor": "wangEditor or tinymce",
|
|
99
|
-
quill: "wangEditor or tinymce",
|
|
100
|
-
"editor.js": "wangEditor or tinymce",
|
|
101
|
-
"mavon-editor": "vditor",
|
|
102
|
-
bytemd: "vditor",
|
|
103
|
-
"@bytemd/vue": "vditor",
|
|
104
|
-
"md-editor-v3": "vditor",
|
|
105
|
-
"@kangc/v-md-editor@next": "vditor",
|
|
106
|
-
i18next: "vue-i18n",
|
|
107
|
-
"@icon-park/vue-next": "@unocss/preset-icons & @iconify-json/carbon",
|
|
108
|
-
"iconify-icon": "@unocss/preset-icons & @iconify-json/carbon",
|
|
109
|
-
"@iconify/vue": "@unocss/preset-icons & @iconify-json/carbon",
|
|
110
|
-
"unplugin-icons": "@unocss/preset-icons & @iconify-json/carbon",
|
|
111
|
-
"vue-material-design-icons": "@unocss/preset-icons & @iconify-json/carbon",
|
|
112
|
-
"@fortawesome/fontawesome-svg-core": "@unocss/preset-icons & @iconify-json/carbon",
|
|
113
|
-
"@fortawesome/vue-fontawesome": "@unocss/preset-icons & @iconify-json/carbon",
|
|
114
|
-
"@mdi/js": "@unocss/preset-icons & @iconify-json/carbon",
|
|
115
|
-
"@mdi/svg": "@unocss/preset-icons & @iconify-json/carbon",
|
|
116
|
-
"@vicons/fluent": "@unocss/preset-icons & @iconify-json/carbon",
|
|
117
|
-
"@vicons/ionicons4": "@unocss/preset-icons & @iconify-json/carbon",
|
|
118
|
-
"@vicons/ionicons5": "@unocss/preset-icons & @iconify-json/carbon",
|
|
119
|
-
"@vicons/antd": "@unocss/preset-icons & @iconify-json/carbon",
|
|
120
|
-
"@vicons/material": "@unocss/preset-icons & @iconify-json/carbon",
|
|
121
|
-
"@vicons/fa": "@unocss/preset-icons & @iconify-json/carbon",
|
|
122
|
-
"@vicons/tabler": "@unocss/preset-icons & @iconify-json/carbon",
|
|
123
|
-
"@vicons/carbon": "@unocss/preset-icons & @iconify-json/carbon",
|
|
124
|
-
"element-plus": "Naive UI",
|
|
125
|
-
"ant-design-vue": "Naive UI",
|
|
126
|
-
"@arco-design/web-vue": "Naive UI",
|
|
127
|
-
"balm-ui": "Naive UI",
|
|
128
|
-
quasar: "Naive UI",
|
|
129
|
-
primevue: "Naive UI",
|
|
130
|
-
"tdesign-vue-next": "Naive UI",
|
|
131
|
-
"@idux/components": "Naive UI",
|
|
132
|
-
"vue-devui": "Naive UI",
|
|
133
|
-
"vuestic-ui": "Naive UI",
|
|
134
|
-
"view-ui-plus": "Naive UI",
|
|
135
|
-
"@headlessui/vue": "Naive UI",
|
|
136
|
-
sass: "less",
|
|
137
|
-
stylus: "less",
|
|
138
|
-
tinykeys: "Vue Use",
|
|
139
|
-
pdfkit: "jspdf",
|
|
140
|
-
"pdf-lib": "jspdf",
|
|
141
|
-
pdfvuer: "pdf.js or html2pdf.js",
|
|
142
|
-
"vue-pdf-embed": "pdf.js or html2pdf.js",
|
|
143
|
-
babylonjs: "three",
|
|
144
|
-
"two.js": "fabric",
|
|
145
|
-
paper: "fabric",
|
|
146
|
-
p5: "fabric",
|
|
147
|
-
vuedraggable: "sortablejs",
|
|
148
|
-
"vue-drag-resize": "sortablejs",
|
|
149
|
-
"vue3-draggable-resizable": "sortablejs",
|
|
150
|
-
"@braks/revue-draggable": "sortablejs",
|
|
151
|
-
"vue-print-nb": "print-js",
|
|
152
|
-
"@soerenmartius/vue3-clipboard": "clipboard.js"
|
|
153
|
-
};
|
|
154
|
-
const depends = {
|
|
155
|
-
...packageJson.dependencies,
|
|
156
|
-
...packageJson.devDependencies
|
|
157
|
-
};
|
|
158
|
-
for (let i = 0; i < Object.keys(unnecessaryDencies).length; i++) {
|
|
159
|
-
const dep = Object.keys(unnecessaryDencies)[i];
|
|
160
|
-
if (depends[dep]) exit(`不建议使用 ${dep}, 使用 ${unnecessaryDencies[dep]} 替代`);
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
readPackageFile();
|
|
164
|
-
|
|
165
|
-
//#endregion
|
|
166
|
-
export { };
|