Skip to content

Commit

Permalink
Print URL to changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
LichuAcu committed Sep 18, 2024
1 parent d87a1ef commit 57f7317
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions packages/next-upgrade/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,11 @@ async function run(): Promise<void> {
console.log(
`\n${chalk.green('✔')} Your Next.js project has been upgraded successfully. ${chalk.bold('Time to ship! 🚢')}`
)

const changelogUrl = await getChangelogUrl(targetNextPackageJson.version)
if (changelogUrl) {
console.log(`📝 Changelog: ${chalk.underline(changelogUrl)}`)
}
}

async function detectWorkspace(appPackageJson: any): Promise<void> {
Expand Down Expand Up @@ -365,4 +370,13 @@ async function suggestTurbopack(packageJson: any): Promise<void> {
responseCustomDevScript.customDevScript || devScript
}

async function getChangelogUrl(version: string): Promise<string | null> {
const url = `https://github.com/vercel/next.js/releases/tag/v${version}`
const res = await fetch(url)
if (res.status === 200) {
return url
}
return null
}

run().catch(console.error)

0 comments on commit 57f7317

Please sign in to comment.