@jackie_qian/create-vue-app 1.0.1 → 1.0.2

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/cli.js CHANGED
@@ -22,6 +22,7 @@ import {
22
22
  installCommand,
23
23
  pathExists,
24
24
  run,
25
+ runCreateVue,
25
26
  writeFileEnsureDir,
26
27
  } from "./utils/util.js";
27
28
  import {
@@ -164,7 +165,7 @@ export async function main() {
164
165
  if (features.has("router")) flags.push("--router");
165
166
  if (features.has("pinia")) flags.push("--pinia");
166
167
  if (flags.length === 2) flags.push("--default");
167
- run("pnpm", ["dlx", "create-vue@latest", ...flags, projectName], cwd);
168
+ runCreateVue([...flags, projectName], cwd);
168
169
  s.stop("基础项目已生成");
169
170
  } catch (e) {
170
171
  s.stop("生成失败");
@@ -186,3 +186,14 @@ export async function applyLatestStableRanges(pkg, cwd) {
186
186
  }
187
187
  }
188
188
  }
189
+ export function runCreateVue(flags, cwd) {
190
+ try {
191
+ run("pnpm", ["dlx", "create-vue@latest", ...flags], cwd);
192
+ return;
193
+ } catch {}
194
+ try {
195
+ run("npm", ["create", "vue@latest", ...flags], cwd);
196
+ return;
197
+ } catch {}
198
+ run("npx", ["--yes", "create-vue@latest", ...flags], cwd);
199
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jackie_qian/create-vue-app",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "type": "module",
5
5
  "description": "",
6
6
  "main": "dist/index.js",