mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 07:32:01 +00:00
fix(nuxi): updated rmdir to rm and checked paths exists (#2968)
This commit is contained in:
parent
d73e11777e
commit
88da7197ba
@ -1,5 +1,5 @@
|
|||||||
import { execSync } from 'child_process'
|
import { execSync } from 'child_process'
|
||||||
import { promises as fsp } from 'fs'
|
import { promises as fsp, existsSync } from 'fs'
|
||||||
import consola from 'consola'
|
import consola from 'consola'
|
||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
import { resolveModule } from '../utils/cjs'
|
import { resolveModule } from '../utils/cjs'
|
||||||
@ -44,9 +44,9 @@ export default defineNuxtCommand({
|
|||||||
execSync(`${packageManager} install`, { stdio: 'inherit' })
|
execSync(`${packageManager} install`, { stdio: 'inherit' })
|
||||||
} else {
|
} else {
|
||||||
consola.info('Upgrading nuxt...')
|
consola.info('Upgrading nuxt...')
|
||||||
await fsp.rmdir('node_modules/.cache', { recursive: true })
|
await Promise.all(['node_modules/.cache', resolve(rootDir, '.nuxt'), 'node_modules/.vite'].map((path) => {
|
||||||
await fsp.rmdir(resolve(rootDir, '.nuxt'), { recursive: true })
|
return existsSync(path) ? fsp.rm(path, { recursive: true }) : undefined
|
||||||
await fsp.rmdir('node_modules/.vite', { recursive: true })
|
}))
|
||||||
execSync(`${packageManager} ${packageManager === 'yarn' ? 'add' : 'install'} -D nuxt3@latest`, { stdio: 'inherit' })
|
execSync(`${packageManager} ${packageManager === 'yarn' ? 'add' : 'install'} -D nuxt3@latest`, { stdio: 'inherit' })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user