Skip to content

Commit

Permalink
fix(upgrade): avoid printing info when versions are unknown
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Oct 22, 2024
1 parent 40877ae commit 019a6f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion playground/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
"nuxi": "node ../bin/nuxi.mjs"
},
"dependencies": {
"nuxt": "latest"
"nuxt": "npm:[email protected]"
}
}
7 changes: 7 additions & 0 deletions src/commands/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ export default defineCommand({
const upgradedVersion = (await getNuxtVersion(cwd)) || '[unknown]'
consola.info('Upgraded Nuxt version:', upgradedVersion)

if (upgradedVersion === '[unknown]') {
return
}

if (upgradedVersion === currentVersion) {
consola.success('You\'re already using the latest version of Nuxt.')
}
Expand All @@ -182,6 +186,9 @@ export default defineCommand({
'to',
upgradedVersion,
)
if (currentVersion === '[unknown]') {
return
}
const commitA = nuxtVersionToGitIdentifier(currentVersion)
const commitB = nuxtVersionToGitIdentifier(upgradedVersion)
if (commitA && commitB) {
Expand Down

0 comments on commit 019a6f8

Please sign in to comment.