mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
feat(nuxi): support pnpm for nuxi upgrade (#1516)
This commit is contained in:
parent
4374277bfa
commit
0c1860a056
@ -25,10 +25,12 @@ export default defineNuxtCommand({
|
|||||||
|
|
||||||
const yarnLock = 'yarn.lock'
|
const yarnLock = 'yarn.lock'
|
||||||
const npmLock = 'package-lock.json'
|
const npmLock = 'package-lock.json'
|
||||||
|
const pnpmLock = 'pnpm-lock.yaml'
|
||||||
|
|
||||||
const isYarn = existsSync(resolve(rootDir, yarnLock))
|
const isYarn = existsSync(resolve(rootDir, yarnLock))
|
||||||
const isNpm = existsSync(resolve(rootDir, npmLock))
|
const isNpm = existsSync(resolve(rootDir, npmLock))
|
||||||
const packageManager = isYarn ? 'yarn' : isNpm ? 'npm' : null
|
const isPnpm = existsSync(resolve(rootDir, pnpmLock))
|
||||||
|
const packageManager = isPnpm ? 'pnpm' : isYarn ? 'yarn' : isNpm ? 'npm' : null
|
||||||
if (!packageManager) {
|
if (!packageManager) {
|
||||||
console.error('Cannot detect Package Manager in', rootDir)
|
console.error('Cannot detect Package Manager in', rootDir)
|
||||||
process.exit(1)
|
process.exit(1)
|
||||||
@ -42,7 +44,7 @@ export default defineNuxtCommand({
|
|||||||
if (args.force || args.f) {
|
if (args.force || args.f) {
|
||||||
consola.info('Removing lock-file and node_modules...')
|
consola.info('Removing lock-file and node_modules...')
|
||||||
await Promise.all([
|
await Promise.all([
|
||||||
fsp.rm(isYarn ? yarnLock : npmLock),
|
fsp.rm(isPnpm ? pnpmLock : isYarn ? yarnLock : npmLock),
|
||||||
fsp.rmdir('node_modules', { recursive: true })
|
fsp.rmdir('node_modules', { recursive: true })
|
||||||
])
|
])
|
||||||
execSync(`${packageManager} install`, { stdio: 'inherit' })
|
execSync(`${packageManager} install`, { stdio: 'inherit' })
|
||||||
|
Loading…
Reference in New Issue
Block a user