Skip to content

Commit

Permalink
refactor(upgrade): move channel prompt before lockfile prompt
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Oct 22, 2024
1 parent 019a6f8 commit b3f31de
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/commands/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,12 @@ export default defineCommand({

// Check if Nuxt is a dependency or devDependency
const nuxtDependencyType = pkg ? await checkNuxtDependencyType(pkg) : 'dependencies'
const corePackages = ['@nuxt/kit', '@nuxt/schema', '@nuxt/vite-builder', '@nuxt/webpack-builder', '@nuxt/rspack-builder']

const packagesToUpdate = pkg ? corePackages.filter(p => pkg.dependencies?.[p] || pkg.devDependencies?.[p]) : []

// Install latest version
const { npmPackages, nuxtVersion } = await getRequiredNewVersion(['nuxt', ...packagesToUpdate], ctx.args.channel)

// Force install
const pmLockFile = resolve(cwd, packageManagerLocks[packageManager])
Expand All @@ -138,11 +144,6 @@ export default defineCommand({
await touchFile(pmLockFile)
}

const packagesToUpdate = pkg ? ['@nuxt/kit', '@nuxt/schema', '@nuxt/vite-builder', '@nuxt/webpack-builder', '@nuxt/rspack-builder'].filter(p => pkg.dependencies?.[p] || pkg.devDependencies?.[p]) : []

// Install latest version
const { npmPackages, nuxtVersion } = await getRequiredNewVersion(['nuxt', ...packagesToUpdate], ctx.args.channel)

const versionType = ctx.args.channel === 'nightly' ? 'nightly' : 'latest stable'
consola.info(`Installing ${versionType} Nuxt ${nuxtVersion} release...`)

Expand Down

0 comments on commit b3f31de

Please sign in to comment.