create-project-template-cli 1.0.0
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 +5 -0
- package/index.js +133 -0
- package/package.json +33 -0
- package/template/react-shadcn/.husky/commit-msg +4 -0
- package/template/react-shadcn/.husky/pre-commit +1 -0
- package/template/react-shadcn/.stylelintignore +20 -0
- package/template/react-shadcn/.stylelintrc.cjs +258 -0
- package/template/react-shadcn/.vscode/extensions.json +7 -0
- package/template/react-shadcn/README.md +75 -0
- package/template/react-shadcn/commitlint.config.cjs +90 -0
- package/template/react-shadcn/components.json +22 -0
- package/template/react-shadcn/eslint.config.js +58 -0
- package/template/react-shadcn/index.html +13 -0
- package/template/react-shadcn/lint-staged.config.cjs +4 -0
- package/template/react-shadcn/package.json +62 -0
- package/template/react-shadcn/pnpm-lock.yaml +4514 -0
- package/template/react-shadcn/public/vite.svg +1 -0
- package/template/react-shadcn/src/App.css +23 -0
- package/template/react-shadcn/src/App.tsx +20 -0
- package/template/react-shadcn/src/assets/css/tailwindcss.css +120 -0
- package/template/react-shadcn/src/assets/react.svg +1 -0
- package/template/react-shadcn/src/components/ui/button.tsx +58 -0
- package/template/react-shadcn/src/components/ui/card.tsx +92 -0
- package/template/react-shadcn/src/components/ui/input.tsx +21 -0
- package/template/react-shadcn/src/components/ui/label.tsx +22 -0
- package/template/react-shadcn/src/components/ui/navigation-menu.tsx +168 -0
- package/template/react-shadcn/src/lib/utils.ts +6 -0
- package/template/react-shadcn/src/main.tsx +11 -0
- package/template/react-shadcn/src/router/index.tsx +71 -0
- package/template/react-shadcn/src/views/404/index.scss +133 -0
- package/template/react-shadcn/src/views/404/index.tsx +27 -0
- package/template/react-shadcn/src/views/Index/index.tsx +8 -0
- package/template/react-shadcn/src/views/index.tsx +59 -0
- package/template/react-shadcn/tsconfig.app.json +33 -0
- package/template/react-shadcn/tsconfig.json +13 -0
- package/template/react-shadcn/tsconfig.node.json +32 -0
- package/template/react-shadcn/vite.config.ts +36 -0
- package/template/vue-tailwindcss/.editorconfig +8 -0
- package/template/vue-tailwindcss/.eslintrc-auto-import.json +76 -0
- package/template/vue-tailwindcss/.gitattributes +1 -0
- package/template/vue-tailwindcss/.prettierrc.json +6 -0
- package/template/vue-tailwindcss/.vscode/extensions.json +9 -0
- package/template/vue-tailwindcss/README.md +2 -0
- package/template/vue-tailwindcss/env.d.ts +1 -0
- package/template/vue-tailwindcss/eslint.config.ts +90 -0
- package/template/vue-tailwindcss/index.html +13 -0
- package/template/vue-tailwindcss/package.json +53 -0
- package/template/vue-tailwindcss/pnpm-lock.yaml +5021 -0
- package/template/vue-tailwindcss/public/favicon.ico +0 -0
- package/template/vue-tailwindcss/src/App.vue +83 -0
- package/template/vue-tailwindcss/src/assets/base.css +86 -0
- package/template/vue-tailwindcss/src/assets/logo.svg +1 -0
- package/template/vue-tailwindcss/src/assets/main.css +10 -0
- package/template/vue-tailwindcss/src/auto-import.d.ts +71 -0
- package/template/vue-tailwindcss/src/axios/index.ts +107 -0
- package/template/vue-tailwindcss/src/components.d.ts +22 -0
- package/template/vue-tailwindcss/src/main.ts +14 -0
- package/template/vue-tailwindcss/src/router/index.ts +23 -0
- package/template/vue-tailwindcss/src/stores/counter.ts +12 -0
- package/template/vue-tailwindcss/src/views/AboutView.vue +15 -0
- package/template/vue-tailwindcss/src/views/HomeView.vue +7 -0
- package/template/vue-tailwindcss/src/vite-env.d.ts +6 -0
- package/template/vue-tailwindcss/tsconfig.app.json +14 -0
- package/template/vue-tailwindcss/tsconfig.json +14 -0
- package/template/vue-tailwindcss/tsconfig.node.json +34 -0
- package/template/vue-tailwindcss/tsconfig.vitest.json +11 -0
- package/template/vue-tailwindcss/vite.config.ts +33 -0
- package/template/vue-tailwindcss/vitest.config.ts +14 -0
- package/utils.js +73 -0
package/README.md
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// commander
|
|
4
|
+
import { program } from "commander";
|
|
5
|
+
// inquirer (v9+ 支持ESM)
|
|
6
|
+
import inquirer from "inquirer";
|
|
7
|
+
// fs (Node.js内置模块,ESM使用命名导入)
|
|
8
|
+
import fs from "fs";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
import { dirname } from "path";
|
|
11
|
+
// path (Node.js内置模块)
|
|
12
|
+
import path from "path";
|
|
13
|
+
// chalk (v5+ 是ESM)
|
|
14
|
+
import chalk from "chalk";
|
|
15
|
+
import ora from "ora";
|
|
16
|
+
|
|
17
|
+
// fs-extra
|
|
18
|
+
import fsExtra from "fs-extra";
|
|
19
|
+
|
|
20
|
+
import packageJson from "./package.json" with { type: "json" };
|
|
21
|
+
import { getTemplateList ,downloadCustomTemplate} from "./utils.js";
|
|
22
|
+
// 设置版本号
|
|
23
|
+
program.version(packageJson.version);
|
|
24
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
25
|
+
const __dirname = dirname(__filename);
|
|
26
|
+
const TEMPLATES_DIR = path.resolve(__dirname, "./template");
|
|
27
|
+
|
|
28
|
+
// 类型
|
|
29
|
+
const TEMPLATE_TYPE = {
|
|
30
|
+
CUSTOM: "custom",
|
|
31
|
+
}
|
|
32
|
+
// 定义命令行参数
|
|
33
|
+
program
|
|
34
|
+
.description("自定义项目模板工具")
|
|
35
|
+
.argument("[project-name]", "项目名称")
|
|
36
|
+
.action(async (projectName) => {
|
|
37
|
+
try {
|
|
38
|
+
if (!projectName) {
|
|
39
|
+
const answers = await inquirer.prompt([
|
|
40
|
+
{
|
|
41
|
+
type: "input",
|
|
42
|
+
name: "projectName",
|
|
43
|
+
message: "请输入项目名称",
|
|
44
|
+
default: "project-template",
|
|
45
|
+
},
|
|
46
|
+
]);
|
|
47
|
+
projectName = answers.projectName;
|
|
48
|
+
// 检查项目名称是否已存在
|
|
49
|
+
if (fs.existsSync(projectName)) {
|
|
50
|
+
console.log(chalk.red("项目名称已存在"));
|
|
51
|
+
// 退出
|
|
52
|
+
process.exit(1);
|
|
53
|
+
|
|
54
|
+
}
|
|
55
|
+
// 选择模板
|
|
56
|
+
const templatesName = await inquirer.prompt([
|
|
57
|
+
{
|
|
58
|
+
type: "list",
|
|
59
|
+
name: "template",
|
|
60
|
+
message: "请选择项目模板",
|
|
61
|
+
choices: await getTemplateList(),
|
|
62
|
+
},
|
|
63
|
+
]);
|
|
64
|
+
|
|
65
|
+
const {template} = templatesName;
|
|
66
|
+
// 创建的项目地址
|
|
67
|
+
const projectPath = path.resolve(process.cwd(), projectName);
|
|
68
|
+
// 如果不是自定义
|
|
69
|
+
if (template !== TEMPLATE_TYPE.CUSTOM) {
|
|
70
|
+
// 创建项目目录
|
|
71
|
+
const spinner = ora('正在创建项目...').start();
|
|
72
|
+
// 创建文件夹
|
|
73
|
+
fsExtra.mkdirSync(projectPath, { recursive: true });
|
|
74
|
+
// 模板地址
|
|
75
|
+
const templatePath = path.join(TEMPLATES_DIR, template);
|
|
76
|
+
await createFile(templatePath, projectPath);
|
|
77
|
+
spinner.succeed('项目创建成功');
|
|
78
|
+
return
|
|
79
|
+
}else {
|
|
80
|
+
await custom(projectName);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
} catch (error) {
|
|
84
|
+
console.log(chalk.red("创建项目失败"));
|
|
85
|
+
// console.log(chalk.red(error.message));
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
// 处理自定义模板
|
|
91
|
+
async function custom(projectPath, ) {
|
|
92
|
+
|
|
93
|
+
// 输入github或者gitee地址
|
|
94
|
+
const answers = await inquirer.prompt([
|
|
95
|
+
{
|
|
96
|
+
type: "input",
|
|
97
|
+
name: "customTemplate",
|
|
98
|
+
message: "请输入项目模板gitee或者github地址",
|
|
99
|
+
},
|
|
100
|
+
]);
|
|
101
|
+
|
|
102
|
+
const {customTemplate} = answers;
|
|
103
|
+
console.log(customTemplate)
|
|
104
|
+
// 下载项目模板
|
|
105
|
+
await downloadCustomTemplate(customTemplate, projectPath);
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
}
|
|
109
|
+
// 创建文件 非自定义的
|
|
110
|
+
async function createFile(templatePath, projectPath) {
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
const entries = await fsExtra.readdir(templatePath, { withFileTypes: true });
|
|
114
|
+
for (const entry of entries) {
|
|
115
|
+
const srcPath = path.join(templatePath, entry.name);
|
|
116
|
+
const destPath = path.join(projectPath, entry.name);
|
|
117
|
+
// 处理目录
|
|
118
|
+
if (entry.isDirectory()) {
|
|
119
|
+
await fsExtra.mkdir(destPath, { recursive: true });
|
|
120
|
+
await createFile(srcPath, destPath);
|
|
121
|
+
}
|
|
122
|
+
// 复制其他文件
|
|
123
|
+
else {
|
|
124
|
+
await fsExtra.copyFile(srcPath, destPath);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
program.parse(process.argv);
|
package/package.json
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "create-project-template-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "模板快速创建",
|
|
5
|
+
"main": "index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"create-template": "./index.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"index.js",
|
|
12
|
+
"template/*",
|
|
13
|
+
"utils.js"
|
|
14
|
+
],
|
|
15
|
+
"keywords": [
|
|
16
|
+
"project-template",
|
|
17
|
+
"template",
|
|
18
|
+
"create-template"
|
|
19
|
+
],
|
|
20
|
+
"author": "",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"chalk": "^5.6.2",
|
|
24
|
+
"commander": "^14.0.1",
|
|
25
|
+
"download-git-repo": "^3.0.2",
|
|
26
|
+
"fs-extra": "^11.3.2",
|
|
27
|
+
"inquirer": "^12.9.6",
|
|
28
|
+
"ora": "^9.0.0"
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
npx lint-staged
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
extends: [
|
|
3
|
+
"stylelint-config-standard",
|
|
4
|
+
"stylelint-config-standard-scss",
|
|
5
|
+
"stylelint-config-recommended-scss",
|
|
6
|
+
],
|
|
7
|
+
plugins: ["stylelint-scss", "stylelint-order"],
|
|
8
|
+
rules: {
|
|
9
|
+
"no-irregular-whitespace": true,
|
|
10
|
+
// 指定样式的排序
|
|
11
|
+
"order/properties-order": [
|
|
12
|
+
[
|
|
13
|
+
"content",
|
|
14
|
+
"position",
|
|
15
|
+
"top",
|
|
16
|
+
"right",
|
|
17
|
+
"bottom",
|
|
18
|
+
"left",
|
|
19
|
+
"z-index",
|
|
20
|
+
"display",
|
|
21
|
+
"vertical-align",
|
|
22
|
+
"flex",
|
|
23
|
+
"flex-grow",
|
|
24
|
+
"flex-shrink",
|
|
25
|
+
"flex-basis",
|
|
26
|
+
"flex-direction",
|
|
27
|
+
"flex-flow",
|
|
28
|
+
"flex-wrap",
|
|
29
|
+
"grid",
|
|
30
|
+
"grid-area",
|
|
31
|
+
"grid-template",
|
|
32
|
+
"grid-template-areas",
|
|
33
|
+
"grid-template-rows",
|
|
34
|
+
"grid-template-columns",
|
|
35
|
+
"grid-row",
|
|
36
|
+
"grid-row-start",
|
|
37
|
+
"grid-row-end",
|
|
38
|
+
"grid-column",
|
|
39
|
+
"grid-column-start",
|
|
40
|
+
"grid-column-end",
|
|
41
|
+
"grid-auto-rows",
|
|
42
|
+
"grid-auto-columns",
|
|
43
|
+
"grid-auto-flow",
|
|
44
|
+
"grid-gap",
|
|
45
|
+
"grid-row-gap",
|
|
46
|
+
"grid-column-gap",
|
|
47
|
+
"gap",
|
|
48
|
+
"row-gap",
|
|
49
|
+
"column-gap",
|
|
50
|
+
"align-content",
|
|
51
|
+
"align-items",
|
|
52
|
+
"align-self",
|
|
53
|
+
"justify-content",
|
|
54
|
+
"justify-items",
|
|
55
|
+
"justify-self",
|
|
56
|
+
"order",
|
|
57
|
+
"float",
|
|
58
|
+
"clear",
|
|
59
|
+
"object-fit",
|
|
60
|
+
"overflow",
|
|
61
|
+
"overflow-x",
|
|
62
|
+
"overflow-y",
|
|
63
|
+
"overflow-scrolling",
|
|
64
|
+
"clip",
|
|
65
|
+
|
|
66
|
+
//
|
|
67
|
+
"box-sizing",
|
|
68
|
+
"width",
|
|
69
|
+
"min-width",
|
|
70
|
+
"max-width",
|
|
71
|
+
"height",
|
|
72
|
+
"min-height",
|
|
73
|
+
"max-height",
|
|
74
|
+
"margin",
|
|
75
|
+
"margin-top",
|
|
76
|
+
"margin-right",
|
|
77
|
+
"margin-bottom",
|
|
78
|
+
"margin-left",
|
|
79
|
+
"padding",
|
|
80
|
+
"padding-top",
|
|
81
|
+
"padding-right",
|
|
82
|
+
"padding-bottom",
|
|
83
|
+
"padding-left",
|
|
84
|
+
"border",
|
|
85
|
+
"border-spacing",
|
|
86
|
+
"border-collapse",
|
|
87
|
+
"border-width",
|
|
88
|
+
"border-style",
|
|
89
|
+
"border-color",
|
|
90
|
+
"border-top",
|
|
91
|
+
"border-top-width",
|
|
92
|
+
"border-top-style",
|
|
93
|
+
"border-top-color",
|
|
94
|
+
"border-right",
|
|
95
|
+
"border-right-width",
|
|
96
|
+
"border-right-style",
|
|
97
|
+
"border-right-color",
|
|
98
|
+
"border-bottom",
|
|
99
|
+
"border-bottom-width",
|
|
100
|
+
"border-bottom-style",
|
|
101
|
+
"border-bottom-color",
|
|
102
|
+
"border-left",
|
|
103
|
+
"border-left-width",
|
|
104
|
+
"border-left-style",
|
|
105
|
+
"border-left-color",
|
|
106
|
+
"border-radius",
|
|
107
|
+
"border-top-left-radius",
|
|
108
|
+
"border-top-right-radius",
|
|
109
|
+
"border-bottom-right-radius",
|
|
110
|
+
"border-bottom-left-radius",
|
|
111
|
+
"border-image",
|
|
112
|
+
"border-image-source",
|
|
113
|
+
"border-image-slice",
|
|
114
|
+
"border-image-width",
|
|
115
|
+
"border-image-outset",
|
|
116
|
+
"border-image-repeat",
|
|
117
|
+
"border-top-image",
|
|
118
|
+
"border-right-image",
|
|
119
|
+
"border-bottom-image",
|
|
120
|
+
"border-left-image",
|
|
121
|
+
"border-corner-image",
|
|
122
|
+
"border-top-left-image",
|
|
123
|
+
"border-top-right-image",
|
|
124
|
+
"border-bottom-right-image",
|
|
125
|
+
"border-bottom-left-image",
|
|
126
|
+
|
|
127
|
+
//
|
|
128
|
+
"background",
|
|
129
|
+
"background-color",
|
|
130
|
+
"background-image",
|
|
131
|
+
"background-attachment",
|
|
132
|
+
"background-position",
|
|
133
|
+
"background-position-x",
|
|
134
|
+
"background-position-y",
|
|
135
|
+
"background-clip",
|
|
136
|
+
"background-origin",
|
|
137
|
+
"background-size",
|
|
138
|
+
"background-repeat",
|
|
139
|
+
"color",
|
|
140
|
+
"box-decoration-break",
|
|
141
|
+
"box-shadow",
|
|
142
|
+
"outline",
|
|
143
|
+
"outline-width",
|
|
144
|
+
"outline-style",
|
|
145
|
+
"outline-color",
|
|
146
|
+
"outline-offset",
|
|
147
|
+
"table-layout",
|
|
148
|
+
"caption-side",
|
|
149
|
+
"empty-cells",
|
|
150
|
+
"list-style",
|
|
151
|
+
"list-style-position",
|
|
152
|
+
"list-style-type",
|
|
153
|
+
"list-style-image",
|
|
154
|
+
|
|
155
|
+
//
|
|
156
|
+
"font",
|
|
157
|
+
"font-weight",
|
|
158
|
+
"font-style",
|
|
159
|
+
"font-variant",
|
|
160
|
+
"font-size-adjust",
|
|
161
|
+
"font-stretch",
|
|
162
|
+
"font-size",
|
|
163
|
+
"font-family",
|
|
164
|
+
"src",
|
|
165
|
+
"line-height",
|
|
166
|
+
"letter-spacing",
|
|
167
|
+
"quotes",
|
|
168
|
+
"counter-increment",
|
|
169
|
+
"counter-reset",
|
|
170
|
+
"-ms-writing-mode",
|
|
171
|
+
"text-align",
|
|
172
|
+
"text-align-last",
|
|
173
|
+
"text-decoration",
|
|
174
|
+
"text-emphasis",
|
|
175
|
+
"text-emphasis-position",
|
|
176
|
+
"text-emphasis-style",
|
|
177
|
+
"text-emphasis-color",
|
|
178
|
+
"text-indent",
|
|
179
|
+
"text-justify",
|
|
180
|
+
"text-outline",
|
|
181
|
+
"text-transform",
|
|
182
|
+
"text-wrap",
|
|
183
|
+
"text-overflow",
|
|
184
|
+
"text-overflow-ellipsis",
|
|
185
|
+
"text-overflow-mode",
|
|
186
|
+
"text-shadow",
|
|
187
|
+
"white-space",
|
|
188
|
+
"word-spacing",
|
|
189
|
+
"word-wrap",
|
|
190
|
+
"word-break",
|
|
191
|
+
"overflow-wrap",
|
|
192
|
+
"tab-size",
|
|
193
|
+
"hyphens",
|
|
194
|
+
"interpolation-mode",
|
|
195
|
+
|
|
196
|
+
//
|
|
197
|
+
"opacity",
|
|
198
|
+
"visibility",
|
|
199
|
+
"filter",
|
|
200
|
+
"resize",
|
|
201
|
+
"cursor",
|
|
202
|
+
"pointer-events",
|
|
203
|
+
"user-select",
|
|
204
|
+
|
|
205
|
+
//
|
|
206
|
+
"unicode-bidi",
|
|
207
|
+
"direction",
|
|
208
|
+
"columns",
|
|
209
|
+
"column-span",
|
|
210
|
+
"column-width",
|
|
211
|
+
"column-count",
|
|
212
|
+
"column-fill",
|
|
213
|
+
"column-gap",
|
|
214
|
+
"column-rule",
|
|
215
|
+
"column-rule-width",
|
|
216
|
+
"column-rule-style",
|
|
217
|
+
"column-rule-color",
|
|
218
|
+
"break-before",
|
|
219
|
+
"break-inside",
|
|
220
|
+
"break-after",
|
|
221
|
+
"page-break-before",
|
|
222
|
+
"page-break-inside",
|
|
223
|
+
"page-break-after",
|
|
224
|
+
"orphans",
|
|
225
|
+
"widows",
|
|
226
|
+
"zoom",
|
|
227
|
+
"max-zoom",
|
|
228
|
+
"min-zoom",
|
|
229
|
+
"user-zoom",
|
|
230
|
+
"orientation",
|
|
231
|
+
"fill",
|
|
232
|
+
"stroke",
|
|
233
|
+
|
|
234
|
+
//
|
|
235
|
+
"transition",
|
|
236
|
+
"transition-delay",
|
|
237
|
+
"transition-timing-function",
|
|
238
|
+
"transition-duration",
|
|
239
|
+
"transition-property",
|
|
240
|
+
"transform",
|
|
241
|
+
"transform-origin",
|
|
242
|
+
"animation",
|
|
243
|
+
"animation-name",
|
|
244
|
+
"animation-duration",
|
|
245
|
+
"animation-play-state",
|
|
246
|
+
"animation-timing-function",
|
|
247
|
+
"animation-delay",
|
|
248
|
+
"animation-iteration-count",
|
|
249
|
+
"animation-direction",
|
|
250
|
+
"animation-fill-mode",
|
|
251
|
+
],
|
|
252
|
+
{
|
|
253
|
+
unspecified: "bottom",
|
|
254
|
+
severity: "error",
|
|
255
|
+
},
|
|
256
|
+
],
|
|
257
|
+
},
|
|
258
|
+
};
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# React + TypeScript + Vite
|
|
2
|
+
|
|
3
|
+
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
|
|
4
|
+
|
|
5
|
+
Currently, two official plugins are available:
|
|
6
|
+
|
|
7
|
+
- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Babel](https://babeljs.io/) for Fast Refresh
|
|
8
|
+
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/) for Fast Refresh
|
|
9
|
+
|
|
10
|
+
## React Compiler
|
|
11
|
+
|
|
12
|
+
The React Compiler is enabled on this template. See [this documentation](https://react.dev/learn/react-compiler) for more information.
|
|
13
|
+
|
|
14
|
+
Note: This will impact Vite dev & build performances.
|
|
15
|
+
|
|
16
|
+
## Expanding the ESLint configuration
|
|
17
|
+
|
|
18
|
+
If you are developing a production application, we recommend updating the configuration to enable type-aware lint rules:
|
|
19
|
+
|
|
20
|
+
```js
|
|
21
|
+
export default defineConfig([
|
|
22
|
+
globalIgnores(['dist']),
|
|
23
|
+
{
|
|
24
|
+
files: ['**/*.{ts,tsx}'],
|
|
25
|
+
extends: [
|
|
26
|
+
// Other configs...
|
|
27
|
+
|
|
28
|
+
// Remove tseslint.configs.recommended and replace with this
|
|
29
|
+
tseslint.configs.recommendedTypeChecked,
|
|
30
|
+
// Alternatively, use this for stricter rules
|
|
31
|
+
tseslint.configs.strictTypeChecked,
|
|
32
|
+
// Optionally, add this for stylistic rules
|
|
33
|
+
tseslint.configs.stylisticTypeChecked,
|
|
34
|
+
|
|
35
|
+
// Other configs...
|
|
36
|
+
],
|
|
37
|
+
languageOptions: {
|
|
38
|
+
parserOptions: {
|
|
39
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
40
|
+
tsconfigRootDir: import.meta.dirname,
|
|
41
|
+
},
|
|
42
|
+
// other options...
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
])
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
You can also install [eslint-plugin-react-x](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-x) and [eslint-plugin-react-dom](https://github.com/Rel1cx/eslint-react/tree/main/packages/plugins/eslint-plugin-react-dom) for React-specific lint rules:
|
|
49
|
+
|
|
50
|
+
```js
|
|
51
|
+
// eslint.config.js
|
|
52
|
+
import reactX from 'eslint-plugin-react-x'
|
|
53
|
+
import reactDom from 'eslint-plugin-react-dom'
|
|
54
|
+
|
|
55
|
+
export default defineConfig([
|
|
56
|
+
globalIgnores(['dist']),
|
|
57
|
+
{
|
|
58
|
+
files: ['**/*.{ts,tsx}'],
|
|
59
|
+
extends: [
|
|
60
|
+
// Other configs...
|
|
61
|
+
// Enable lint rules for React
|
|
62
|
+
reactX.configs['recommended-typescript'],
|
|
63
|
+
// Enable lint rules for React DOM
|
|
64
|
+
reactDom.configs.recommended,
|
|
65
|
+
],
|
|
66
|
+
languageOptions: {
|
|
67
|
+
parserOptions: {
|
|
68
|
+
project: ['./tsconfig.node.json', './tsconfig.app.json'],
|
|
69
|
+
tsconfigRootDir: import.meta.dirname,
|
|
70
|
+
},
|
|
71
|
+
// other options...
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
])
|
|
75
|
+
```
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/** @type {import('cz-git').UserConfig} */
|
|
2
|
+
module.exports = {
|
|
3
|
+
ignores: [(commit) => commit.includes("init")],
|
|
4
|
+
extends: ["@commitlint/config-conventional"],
|
|
5
|
+
rules: {
|
|
6
|
+
"body-leading-blank": [2, "always"],
|
|
7
|
+
"footer-leading-blank": [1, "always"],
|
|
8
|
+
"header-max-length": [2, "always", 108],
|
|
9
|
+
"subject-empty": [2, "never"],
|
|
10
|
+
"type-empty": [2, "never"],
|
|
11
|
+
"subject-case": [0],
|
|
12
|
+
"type-enum": [
|
|
13
|
+
2,
|
|
14
|
+
"always",
|
|
15
|
+
[
|
|
16
|
+
"feat",
|
|
17
|
+
"fix",
|
|
18
|
+
"docs",
|
|
19
|
+
"style",
|
|
20
|
+
"refactor",
|
|
21
|
+
"perf",
|
|
22
|
+
"test",
|
|
23
|
+
"build",
|
|
24
|
+
"ci",
|
|
25
|
+
"chore",
|
|
26
|
+
"revert",
|
|
27
|
+
"wip",
|
|
28
|
+
"workflow",
|
|
29
|
+
"types",
|
|
30
|
+
"release",
|
|
31
|
+
],
|
|
32
|
+
],
|
|
33
|
+
},
|
|
34
|
+
prompt: {
|
|
35
|
+
messages: {
|
|
36
|
+
type: "选择你要提交的类型 :",
|
|
37
|
+
scope: "选择一个提交范围[可选]:",
|
|
38
|
+
customScope: "请输入自定义的提交范围 :",
|
|
39
|
+
subject: "请简要描述提交 :\n",
|
|
40
|
+
body: '填写更加详细的变更描述[可选]。使用 "|" 换行 :\n',
|
|
41
|
+
breaking: '列举非兼容性重大的变更[可选]。使用 "|" 换行 :\n',
|
|
42
|
+
footerPrefixsSelect: "选择关联issue前缀[可选]:",
|
|
43
|
+
customFooterPrefixs: "输入自定义issue前缀 :",
|
|
44
|
+
footer: "列举关联issue [可选] 例如: #31, #I3244 :\n",
|
|
45
|
+
confirmCommit: "是否提交或修改commit ?",
|
|
46
|
+
},
|
|
47
|
+
types: [
|
|
48
|
+
{ value: "feat", name: "feat: ✨ 新增功能", emoji: "✨" },
|
|
49
|
+
{ value: "fix", name: "fix: 🐛 修复缺陷", emoji: "🐛" },
|
|
50
|
+
{ value: "docs", name: "docs: 📝 文档变更", emoji: "📝" },
|
|
51
|
+
{
|
|
52
|
+
value: "style",
|
|
53
|
+
name: "style: 💄 代码格式",
|
|
54
|
+
emoji: "💄",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
value: "refactor",
|
|
58
|
+
name: "refactor: 🔨 代码重构",
|
|
59
|
+
emoji: "🔨",
|
|
60
|
+
},
|
|
61
|
+
{ value: "perf", name: "perf: ⚡️ 性能优化", emoji: "⚡️" },
|
|
62
|
+
{
|
|
63
|
+
value: "test",
|
|
64
|
+
name: "test: ✅ 测试",
|
|
65
|
+
emoji: "✅",
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
value: "build",
|
|
69
|
+
name: "build: 📦️ 打包构建",
|
|
70
|
+
emoji: "📦️",
|
|
71
|
+
},
|
|
72
|
+
{ value: "ci", name: "ci: 👷 CI 配置变更", emoji: "👷" },
|
|
73
|
+
{ value: "revert", name: "revert: ⏪️ 代码回退", emoji: "⏪️" },
|
|
74
|
+
{
|
|
75
|
+
value: "chore",
|
|
76
|
+
name: "chore: 🚀 构建/工程依赖/工具",
|
|
77
|
+
emoji: "🚀",
|
|
78
|
+
},
|
|
79
|
+
{ value: "wip", name: "wip: 🚧 正在开发中", emoji: "🚧" },
|
|
80
|
+
{ value: "workflow", name: "workflow: 🎯 工作流程改进", emoji: "🎯" },
|
|
81
|
+
],
|
|
82
|
+
useEmoji: true,
|
|
83
|
+
scopes: [],
|
|
84
|
+
customScopesAlign: "bottom",
|
|
85
|
+
emptyScopesAlias: "empty",
|
|
86
|
+
customScopesAlias: "custom",
|
|
87
|
+
allowBreakingChanges: ["feat", "fix"],
|
|
88
|
+
skipQuestions: ["scope", "body", "breaking", "footerPrefix", "footer"], // 自定义选择指定的问题不显示
|
|
89
|
+
},
|
|
90
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ui.shadcn.com/schema.json",
|
|
3
|
+
"style": "new-york",
|
|
4
|
+
"rsc": false,
|
|
5
|
+
"tsx": true,
|
|
6
|
+
"tailwind": {
|
|
7
|
+
"config": "",
|
|
8
|
+
"css": "src/assets/css/tailwindcss.css",
|
|
9
|
+
"baseColor": "slate",
|
|
10
|
+
"cssVariables": true,
|
|
11
|
+
"prefix": ""
|
|
12
|
+
},
|
|
13
|
+
"iconLibrary": "lucide",
|
|
14
|
+
"aliases": {
|
|
15
|
+
"components": "@/components",
|
|
16
|
+
"utils": "@/lib/utils",
|
|
17
|
+
"ui": "@/components/ui",
|
|
18
|
+
"lib": "@/lib",
|
|
19
|
+
"hooks": "@/hooks"
|
|
20
|
+
},
|
|
21
|
+
"registries": {}
|
|
22
|
+
}
|