create-vue3-enterprise 1.0.31 → 1.0.33

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.
Files changed (2) hide show
  1. package/dist/index.js +10 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -141,6 +141,7 @@ async function main() {
141
141
  return;
142
142
  }
143
143
  let targetDir = argv._[0];
144
+ let selectedTemplate = "";
144
145
  const promptResult = await prompts([
145
146
  {
146
147
  type: targetDir ? null : "text",
@@ -162,28 +163,21 @@ async function main() {
162
163
  title: "Vue3 + TypeScript + Vite + Pinia + Vue Router",
163
164
  value: "vue3-ts-full"
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
167
  },
174
- // 询问 Router:仅当模板不是全量模板时显示
175
168
  {
176
- type: (prev) => {
177
- return ["vue3-ts", "vue3-ts-pinia"].includes(prev.template) ? "confirm" : null;
169
+ type: () => {
170
+ console.log(yellow(`\n[调试] needsRouter 阶段 模板值 = ${selectedTemplate}`));
171
+ return ["vue3-ts", "vue3-ts-pinia"].includes(selectedTemplate) ? "confirm" : null;
178
172
  },
179
173
  name: "needsRouter",
180
174
  message: "添加 Vue Router?",
181
175
  initial: true
182
176
  },
183
- // 询问 Pinia:仅当模板是基础模板(vue3-ts)时显示
184
177
  {
185
- type: (prev) => {
186
- return prev.template === "vue3-ts" ? "confirm" : null;
178
+ type: () => {
179
+ console.log(yellow(`\n[调试] needsPinia 阶段 模板值 = ${selectedTemplate}`));
180
+ return selectedTemplate === "vue3-ts" ? "confirm" : null;
187
181
  },
188
182
  name: "needsPinia",
189
183
  message: "添加 Pinia (状态管理)?",
@@ -207,12 +201,9 @@ async function main() {
207
201
  ]
208
202
  },
209
203
  {
210
- type: (prev) => {
211
- // 仅当目录存在且非空时,才显示确认覆盖的选项
212
- return targetDir && fs.existsSync(targetDir) && fs.readdirSync(targetDir).length > 0 ? "confirm" : null;
213
- },
204
+ type: "confirm",
214
205
  name: "overwrite",
215
- message: `目录 "${targetDir}" 已存在且不为空。是否覆盖?`,
206
+ message: targetDir && fs.existsSync(targetDir) && fs.readdirSync(targetDir).length > 0 ? `目录 "${targetDir}" 已存在且不为空。是否覆盖?` : "",
216
207
  initial: false
217
208
  }
218
209
  ], {
@@ -221,8 +212,6 @@ async function main() {
221
212
  process.exit(1);
222
213
  }
223
214
  });
224
- // 可选:在所有交互完成后,也可以输出最终选中的模板值(二次确认)
225
- console.log(green(`\n📌 最终确认:你选择的模板值是: ${promptResult.template}`));
226
215
  if (promptResult.overwrite === false) {
227
216
  console.log(red("✖ 操作已取消"));
228
217
  process.exit(1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-vue3-enterprise",
3
- "version": "1.0.31",
3
+ "version": "1.0.33",
4
4
  "description": "Vue3 + TypeScript + Vite 企业级项目脚手架",
5
5
  "type": "module",
6
6
  "bin": {