mirror of
https://github.com/pengzhanbo/vuepress-theme-plume.git
synced 2026-04-23 10:58:13 +08:00
fix(cli): incorrect exec context
This commit is contained in:
parent
447aa4647c
commit
233ae3337f
@ -1,3 +1,5 @@
|
||||
import process from 'node:process'
|
||||
import path from 'node:path'
|
||||
import { intro, outro, spinner } from '@clack/prompts'
|
||||
import { execaCommand } from 'execa'
|
||||
import colors from 'picocolors'
|
||||
@ -19,16 +21,17 @@ export async function run(mode: Mode, root?: string) {
|
||||
|
||||
await generate(mode, data)
|
||||
|
||||
const cwd = path.join(process.cwd(), data.root)
|
||||
if (data.git) {
|
||||
progress.message(t('spinner.git'))
|
||||
await execaCommand('git init')
|
||||
await execaCommand('git init', { cwd })
|
||||
}
|
||||
|
||||
const pm = data.packageManager
|
||||
|
||||
if (data.install) {
|
||||
progress.message(t('spinner.install'))
|
||||
await execaCommand(pm === 'yarn' ? 'yarn' : `${pm} install`)
|
||||
await execaCommand(pm === 'yarn' ? 'yarn' : `${pm} install`, { cwd })
|
||||
}
|
||||
|
||||
const cdCommand = mode === Mode.create ? colors.green(`cd ${data.root}`) : ''
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user