Unverified Commit b30ae4e7 authored by Jiachi Liu's avatar Jiachi Liu Committed by GitHub

codemod: polish end message (#71259)

parent c71b4f7c
...@@ -35,6 +35,22 @@ async function loadHighestNPMVersionMatching(query: string) { ...@@ -35,6 +35,22 @@ async function loadHighestNPMVersionMatching(query: string) {
return versionOrVersions 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( export async function runUpgrade(
revision: string | undefined, revision: string | undefined,
options: { verbose: boolean } options: { verbose: boolean }
...@@ -65,7 +81,8 @@ export async function runUpgrade( ...@@ -65,7 +81,8 @@ export async function runUpgrade(
const installedNextVersion = getInstalledNextVersion() 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 const targetNextVersion = targetNextPackageJson.version
...@@ -73,12 +90,14 @@ export async function runUpgrade( ...@@ -73,12 +90,14 @@ export async function runUpgrade(
console.log( console.log(
`${pc.green('✓')} Current Next.js version is already on the target version "v${targetNextVersion}".` `${pc.green('✓')} Current Next.js version is already on the target version "v${targetNextVersion}".`
) )
endMessage()
return return
} }
if (compareVersions(installedNextVersion, targetNextVersion) > 0) { if (compareVersions(installedNextVersion, targetNextVersion) > 0) {
console.log( console.log(
`${pc.green('✓')} Current Next.js version is higher than the target version "v${targetNextVersion}".` `${pc.green('✓')} Current Next.js version is higher than the target version "v${targetNextVersion}".`
) )
endMessage()
return return
} }
...@@ -224,9 +243,7 @@ export async function runUpgrade( ...@@ -224,9 +243,7 @@ export async function runUpgrade(
if (codemods.length > 0) { if (codemods.length > 0) {
console.log(`${pc.green('✔')} Codemods have been applied successfully.`) console.log(`${pc.green('✔')} Codemods have been applied successfully.`)
} }
console.log( endMessage()
`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`
)
} }
function getInstalledNextVersion(): string { function getInstalledNextVersion(): string {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment