create-vite-vue 1.5.4 → 1.5.5
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/bin/index.js +22 -22
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -34,6 +34,27 @@ if(compareVersion(currentVersion, requiredVersion) < 0) {
|
|
|
34
34
|
const __filename = fileURLToPath(import.meta.url)
|
|
35
35
|
const __dirname = path.dirname(__filename)
|
|
36
36
|
|
|
37
|
+
const pkgManager = detectPackageManager()
|
|
38
|
+
|
|
39
|
+
const pkgCommands = {
|
|
40
|
+
npm: {
|
|
41
|
+
install: 'npm install',
|
|
42
|
+
dev: 'npm run dev'
|
|
43
|
+
},
|
|
44
|
+
yarn: {
|
|
45
|
+
install: 'yarn',
|
|
46
|
+
dev: 'yarn dev'
|
|
47
|
+
},
|
|
48
|
+
pnpm: {
|
|
49
|
+
install: 'pnpm install',
|
|
50
|
+
dev: 'pnpm dev'
|
|
51
|
+
},
|
|
52
|
+
bun: {
|
|
53
|
+
install: 'bun install',
|
|
54
|
+
dev: 'bun run dev'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
37
58
|
; (async () => {
|
|
38
59
|
// 1️⃣ 输入项目名
|
|
39
60
|
let projectName
|
|
@@ -117,7 +138,7 @@ const __dirname = path.dirname(__filename)
|
|
|
117
138
|
const { runDev } = await prompts({
|
|
118
139
|
type: 'select',
|
|
119
140
|
name: 'runDev',
|
|
120
|
-
message:
|
|
141
|
+
message: `是否立即运行 ${pkgCommands[pkgManager].dev}?`,
|
|
121
142
|
choices: [{ title: 'Yes', value: true }, { title: 'No', value: false }]
|
|
122
143
|
})
|
|
123
144
|
|
|
@@ -366,8 +387,6 @@ export default createRouter({
|
|
|
366
387
|
// 1️⃣0️⃣ 安装依赖
|
|
367
388
|
console.log('📦 安装依赖中...')
|
|
368
389
|
|
|
369
|
-
const pkgManager = detectPackageManager()
|
|
370
|
-
|
|
371
390
|
let installCmd = ''
|
|
372
391
|
|
|
373
392
|
if(pkgManager === 'pnpm') {
|
|
@@ -380,25 +399,6 @@ export default createRouter({
|
|
|
380
399
|
|
|
381
400
|
execSync(installCmd, { cwd: targetDir, stdio: 'inherit' })
|
|
382
401
|
|
|
383
|
-
const pkgCommands = {
|
|
384
|
-
npm: {
|
|
385
|
-
install: 'npm install',
|
|
386
|
-
dev: 'npm run dev'
|
|
387
|
-
},
|
|
388
|
-
yarn: {
|
|
389
|
-
install: 'yarn',
|
|
390
|
-
dev: 'yarn dev'
|
|
391
|
-
},
|
|
392
|
-
pnpm: {
|
|
393
|
-
install: 'pnpm install',
|
|
394
|
-
dev: 'pnpm dev'
|
|
395
|
-
},
|
|
396
|
-
bun: {
|
|
397
|
-
install: 'bun install',
|
|
398
|
-
dev: 'bun run dev'
|
|
399
|
-
}
|
|
400
|
-
}
|
|
401
|
-
|
|
402
402
|
// 1️⃣1️⃣ 运行 dev
|
|
403
403
|
if(runDev) {
|
|
404
404
|
console.log('🚀 启动开发服务器...')
|