create-vue3-enterprise 1.0.25 → 1.0.26
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/dist/index.js +23 -28
- package/package.json +1 -1
- package/template/.prettierrc +1 -1
package/dist/index.js
CHANGED
|
@@ -12,8 +12,8 @@ const argv = minimist(process.argv.slice(2), {
|
|
|
12
12
|
alias: {
|
|
13
13
|
h: "help",
|
|
14
14
|
t: "template",
|
|
15
|
-
f: "force"
|
|
16
|
-
}
|
|
15
|
+
f: "force"
|
|
16
|
+
}
|
|
17
17
|
});
|
|
18
18
|
const cwd = process.cwd();
|
|
19
19
|
const __filename = fileURLToPath(import.meta.url);
|
|
@@ -70,9 +70,7 @@ function copyDir(srcDir, destDir) {
|
|
|
70
70
|
}
|
|
71
71
|
async function generatePackageJson(targetDir, options) {
|
|
72
72
|
const pkg = {
|
|
73
|
-
name: isValidPackageName(targetDir)
|
|
74
|
-
? targetDir
|
|
75
|
-
: toValidPackageName(targetDir),
|
|
73
|
+
name: isValidPackageName(targetDir) ? targetDir : toValidPackageName(targetDir),
|
|
76
74
|
version: "0.0.0",
|
|
77
75
|
private: true,
|
|
78
76
|
type: "module",
|
|
@@ -87,17 +85,18 @@ async function generatePackageJson(targetDir, options) {
|
|
|
87
85
|
format: "prettier --write .",
|
|
88
86
|
"type-check": "vue-tsc --noEmit",
|
|
89
87
|
prepare: "husky install",
|
|
90
|
-
"lint-staged": "lint-staged"
|
|
88
|
+
"lint-staged": "lint-staged"
|
|
91
89
|
},
|
|
92
90
|
dependencies: {
|
|
93
|
-
vue: "^3.4.0"
|
|
91
|
+
vue: "^3.4.0"
|
|
94
92
|
},
|
|
95
93
|
devDependencies: {
|
|
96
94
|
"@vitejs/plugin-vue": "^5.0.0",
|
|
97
95
|
typescript: "^5.3.0",
|
|
98
96
|
vite: "^5.0.0",
|
|
99
97
|
"vue-tsc": "^1.8.0",
|
|
100
|
-
|
|
98
|
+
"@rushstack/eslint-patch": "^1.16.1"
|
|
99
|
+
}
|
|
101
100
|
};
|
|
102
101
|
if (options.needsRouter) {
|
|
103
102
|
pkg.dependencies["vue-router"] = "^4.2.0";
|
|
@@ -150,7 +149,7 @@ async function main() {
|
|
|
150
149
|
initial: "vue3-enterprise-project",
|
|
151
150
|
onState: (state) => {
|
|
152
151
|
targetDir = String(state.value).trim() || "vue3-enterprise-project";
|
|
153
|
-
}
|
|
152
|
+
}
|
|
154
153
|
},
|
|
155
154
|
{
|
|
156
155
|
type: "select",
|
|
@@ -161,9 +160,9 @@ async function main() {
|
|
|
161
160
|
{ title: "Vue3 + TypeScript + Vite + Pinia", value: "vue3-ts-pinia" },
|
|
162
161
|
{
|
|
163
162
|
title: "Vue3 + TypeScript + Vite + Pinia + Vue Router",
|
|
164
|
-
value: "vue3-ts-full"
|
|
165
|
-
}
|
|
166
|
-
]
|
|
163
|
+
value: "vue3-ts-full"
|
|
164
|
+
}
|
|
165
|
+
]
|
|
167
166
|
},
|
|
168
167
|
{
|
|
169
168
|
type: "multiselect",
|
|
@@ -175,46 +174,42 @@ async function main() {
|
|
|
175
174
|
{
|
|
176
175
|
title: "Playwright (E2E 测试)",
|
|
177
176
|
value: "playwright",
|
|
178
|
-
selected: true
|
|
177
|
+
selected: true
|
|
179
178
|
},
|
|
180
179
|
{ title: "Vue3 Enterprise MCP", value: "mcp", selected: true },
|
|
181
180
|
{ title: "CI/CD 工作流", value: "ci", selected: true },
|
|
182
|
-
{ title: "性能基准测试", value: "perf", selected: true }
|
|
183
|
-
]
|
|
181
|
+
{ title: "性能基准测试", value: "perf", selected: true }
|
|
182
|
+
]
|
|
184
183
|
},
|
|
185
184
|
{
|
|
186
185
|
type: "confirm",
|
|
187
186
|
name: "needsTypeScript",
|
|
188
187
|
message: "使用 TypeScript?",
|
|
189
|
-
initial: true
|
|
188
|
+
initial: true
|
|
190
189
|
},
|
|
191
190
|
{
|
|
192
191
|
type: "confirm",
|
|
193
192
|
name: "needsRouter",
|
|
194
193
|
message: "添加 Vue Router?",
|
|
195
|
-
initial: true
|
|
194
|
+
initial: true
|
|
196
195
|
},
|
|
197
196
|
{
|
|
198
197
|
type: "confirm",
|
|
199
198
|
name: "needsPinia",
|
|
200
199
|
message: "添加 Pinia (状态管理)?",
|
|
201
|
-
initial: true
|
|
200
|
+
initial: true
|
|
202
201
|
},
|
|
203
202
|
{
|
|
204
203
|
type: "confirm",
|
|
205
204
|
name: "overwrite",
|
|
206
|
-
message: targetDir &&
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
? `目录 "${targetDir}" 已存在且不为空。是否覆盖?`
|
|
210
|
-
: "",
|
|
211
|
-
initial: false,
|
|
212
|
-
},
|
|
205
|
+
message: targetDir && fs.existsSync(targetDir) && fs.readdirSync(targetDir).length > 0 ? `目录 "${targetDir}" 已存在且不为空。是否覆盖?` : "",
|
|
206
|
+
initial: false
|
|
207
|
+
}
|
|
213
208
|
], {
|
|
214
209
|
onCancel: () => {
|
|
215
210
|
console.log(red("✖ 操作已取消"));
|
|
216
211
|
process.exit(1);
|
|
217
|
-
}
|
|
212
|
+
}
|
|
218
213
|
});
|
|
219
214
|
if (promptResult.overwrite === false) {
|
|
220
215
|
console.log(red("✖ 操作已取消"));
|
|
@@ -240,7 +235,7 @@ async function main() {
|
|
|
240
235
|
const pkg = await generatePackageJson(targetDir, {
|
|
241
236
|
features: promptResult.features || [],
|
|
242
237
|
needsRouter: promptResult.needsRouter,
|
|
243
|
-
needsPinia: promptResult.needsPinia
|
|
238
|
+
needsPinia: promptResult.needsPinia
|
|
244
239
|
});
|
|
245
240
|
fs.writeFileSync(path.join(root, "package.json"), JSON.stringify(pkg, null, 2));
|
|
246
241
|
const featureDescriptions = {
|
|
@@ -249,7 +244,7 @@ async function main() {
|
|
|
249
244
|
playwright: "- 🎭 Playwright E2E 测试",
|
|
250
245
|
mcp: "- 🔍 Vue3 Enterprise MCP 代码审查",
|
|
251
246
|
ci: "- ⚡ CI/CD 自动化",
|
|
252
|
-
perf: "- 📊 性能基准测试"
|
|
247
|
+
perf: "- 📊 性能基准测试"
|
|
253
248
|
};
|
|
254
249
|
const readme = `# ${pkg.name}
|
|
255
250
|
|
package/package.json
CHANGED