Skip to content

Commit

Permalink
codemod: polish end message (vercel#71259)
Browse files Browse the repository at this point in the history
  • Loading branch information
huozhi authored Oct 14, 2024
1 parent c71b4f7 commit b30ae4e
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions packages/next-codemod/bin/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,22 @@ async function loadHighestNPMVersionMatching(query: string) {
return versionOrVersions
}

function endMessage() {
console.log()
console.log(
pc.white(
pc.bold(
`Please review the local changes and read the Next.js 15 migration guide to complete the migration.`
)
)
)
console.log(
pc.underline(
'https://nextjs.org/docs/canary/app/building-your-application/upgrading/version-15'
)
)
}

export async function runUpgrade(
revision: string | undefined,
options: { verbose: boolean }
Expand Down Expand Up @@ -65,20 +81,23 @@ export async function runUpgrade(

const installedNextVersion = getInstalledNextVersion()

console.log(`Current Next.js version: v${installedNextVersion}`)
// Align the prefix spaces
console.log(` Current Next.js version: v${installedNextVersion}`)

const targetNextVersion = targetNextPackageJson.version

if (compareVersions(installedNextVersion, targetNextVersion) === 0) {
console.log(
`${pc.green('✓')} Current Next.js version is already on the target version "v${targetNextVersion}".`
)
endMessage()
return
}
if (compareVersions(installedNextVersion, targetNextVersion) > 0) {
console.log(
`${pc.green('✓')} Current Next.js version is higher than the target version "v${targetNextVersion}".`
)
endMessage()
return
}

Expand Down Expand Up @@ -224,9 +243,7 @@ export async function runUpgrade(
if (codemods.length > 0) {
console.log(`${pc.green('✔')} Codemods have been applied successfully.`)
}
console.log(
`Please review the local changes and read the Next.js 15 migration guide to complete the migration. https://nextjs.org/docs/canary/app/building-your-application/upgrading/version-15`
)
endMessage()
}

function getInstalledNextVersion(): string {
Expand Down

0 comments on commit b30ae4e

Please sign in to comment.