create-vue3-enterprise 1.0.30 → 1.0.32
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 +18 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -162,18 +162,30 @@ async function main() {
|
|
|
162
162
|
title: "Vue3 + TypeScript + Vite + Pinia + Vue Router",
|
|
163
163
|
value: "vue3-ts-full"
|
|
164
164
|
}
|
|
165
|
-
]
|
|
165
|
+
],
|
|
166
|
+
onState: (state) => {
|
|
167
|
+
const selectedTemplate = state.value;
|
|
168
|
+
if (selectedTemplate) {
|
|
169
|
+
console.log(green(`✔ 你选择的模板值: ${selectedTemplate}`));
|
|
170
|
+
}
|
|
171
|
+
}
|
|
166
172
|
},
|
|
173
|
+
// 询问 Router:输出 prev.template 并判断显示
|
|
167
174
|
{
|
|
168
175
|
type: (prev) => {
|
|
176
|
+
// 调试输出:打印 prev.template 的值
|
|
177
|
+
console.log(yellow(`\n[调试] needsRouter 阶段 prev.template = ${prev.template}`));
|
|
169
178
|
return ["vue3-ts", "vue3-ts-pinia"].includes(prev.template) ? "confirm" : null;
|
|
170
179
|
},
|
|
171
180
|
name: "needsRouter",
|
|
172
181
|
message: "添加 Vue Router?",
|
|
173
182
|
initial: true
|
|
174
183
|
},
|
|
184
|
+
// 询问 Pinia:输出 prev.template 并判断显示
|
|
175
185
|
{
|
|
176
186
|
type: (prev) => {
|
|
187
|
+
// 调试输出:打印 prev.template 的值
|
|
188
|
+
console.log(yellow(`\n[调试] needsPinia 阶段 prev.template = ${prev.template}`));
|
|
177
189
|
return prev.template === "vue3-ts" ? "confirm" : null;
|
|
178
190
|
},
|
|
179
191
|
name: "needsPinia",
|
|
@@ -199,6 +211,9 @@ async function main() {
|
|
|
199
211
|
},
|
|
200
212
|
{
|
|
201
213
|
type: (prev) => {
|
|
214
|
+
// 调试输出:打印 prev.template 的值
|
|
215
|
+
console.log(yellow(`\n[调试] overwrite 阶段 prev.template = ${prev.template}`));
|
|
216
|
+
// 仅当目录存在且非空时,才显示确认覆盖的选项
|
|
202
217
|
return targetDir && fs.existsSync(targetDir) && fs.readdirSync(targetDir).length > 0 ? "confirm" : null;
|
|
203
218
|
},
|
|
204
219
|
name: "overwrite",
|
|
@@ -211,6 +226,8 @@ async function main() {
|
|
|
211
226
|
process.exit(1);
|
|
212
227
|
}
|
|
213
228
|
});
|
|
229
|
+
// 最终输出:确认所有交互完成后的 prev.template 最终值(即 promptResult.template)
|
|
230
|
+
console.log(green(`\n📌 最终确认:prev.template 的最终值是: ${promptResult.template}`));
|
|
214
231
|
if (promptResult.overwrite === false) {
|
|
215
232
|
console.log(red("✖ 操作已取消"));
|
|
216
233
|
process.exit(1);
|