create-vue3-enterprise 1.0.30 → 1.0.31
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 +13 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -162,8 +162,16 @@ async function main() {
|
|
|
162
162
|
title: "Vue3 + TypeScript + Vite + Pinia + Vue Router",
|
|
163
163
|
value: "vue3-ts-full"
|
|
164
164
|
}
|
|
165
|
-
]
|
|
165
|
+
],
|
|
166
|
+
// 新增:选中模板后立即输出 value 到终端
|
|
167
|
+
onState: (state) => {
|
|
168
|
+
const selectedTemplate = state.value;
|
|
169
|
+
if (selectedTemplate) {
|
|
170
|
+
console.log(green(`✔ 你选择的模板值: ${selectedTemplate}`));
|
|
171
|
+
}
|
|
172
|
+
}
|
|
166
173
|
},
|
|
174
|
+
// 询问 Router:仅当模板不是全量模板时显示
|
|
167
175
|
{
|
|
168
176
|
type: (prev) => {
|
|
169
177
|
return ["vue3-ts", "vue3-ts-pinia"].includes(prev.template) ? "confirm" : null;
|
|
@@ -172,6 +180,7 @@ async function main() {
|
|
|
172
180
|
message: "添加 Vue Router?",
|
|
173
181
|
initial: true
|
|
174
182
|
},
|
|
183
|
+
// 询问 Pinia:仅当模板是基础模板(vue3-ts)时显示
|
|
175
184
|
{
|
|
176
185
|
type: (prev) => {
|
|
177
186
|
return prev.template === "vue3-ts" ? "confirm" : null;
|
|
@@ -199,6 +208,7 @@ async function main() {
|
|
|
199
208
|
},
|
|
200
209
|
{
|
|
201
210
|
type: (prev) => {
|
|
211
|
+
// 仅当目录存在且非空时,才显示确认覆盖的选项
|
|
202
212
|
return targetDir && fs.existsSync(targetDir) && fs.readdirSync(targetDir).length > 0 ? "confirm" : null;
|
|
203
213
|
},
|
|
204
214
|
name: "overwrite",
|
|
@@ -211,6 +221,8 @@ async function main() {
|
|
|
211
221
|
process.exit(1);
|
|
212
222
|
}
|
|
213
223
|
});
|
|
224
|
+
// 可选:在所有交互完成后,也可以输出最终选中的模板值(二次确认)
|
|
225
|
+
console.log(green(`\n📌 最终确认:你选择的模板值是: ${promptResult.template}`));
|
|
214
226
|
if (promptResult.overwrite === false) {
|
|
215
227
|
console.log(red("✖ 操作已取消"));
|
|
216
228
|
process.exit(1);
|