This repository was archived by the owner on Apr 6, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import { resolve } from 'pathe'
4
4
import { readPackageJSON } from 'pkg-types'
5
5
import { getPackageManager , packageManagerLocks } from '../utils/packageManagers'
6
6
import { rmRecursive , touchFile } from '../utils/fs'
7
- import { cleanupNuxtDirs } from '../utils/nuxt'
7
+ import { cleanupNuxtDirs , nuxtVersionToGitIdentifier } from '../utils/nuxt'
8
8
import { defineNuxtCommand } from './index'
9
9
10
10
async function getNuxtVersion ( path : string ) : Promise < string | null > {
@@ -64,8 +64,8 @@ export default defineNuxtCommand({
64
64
consola . success ( 'You\'re already using the latest version of nuxt.' )
65
65
} else {
66
66
consola . success ( 'Successfully upgraded nuxt from' , currentVersion , 'to' , upgradedVersion )
67
- const commitA = currentVersion . split ( '.' ) . pop ( )
68
- const commitB = upgradedVersion . split ( '.' ) . pop ( )
67
+ const commitA = nuxtVersionToGitIdentifier ( currentVersion )
68
+ const commitB = nuxtVersionToGitIdentifier ( upgradedVersion )
69
69
if ( commitA && commitB ) {
70
70
consola . info ( 'Changelog:' , `https://github.com/nuxt/framework/compare/${ commitA } ...${ commitB } ` )
71
71
}
Original file line number Diff line number Diff line change @@ -27,6 +27,16 @@ export async function cleanupNuxtDirs (rootDir: string) {
27
27
] . map ( dir => resolve ( rootDir , dir ) ) )
28
28
}
29
29
30
+ export function nuxtVersionToGitIdentifier ( version : string ) {
31
+ // match the git identifier in the release, for example: 3.0.0-rc.8-27677607.a3a8706
32
+ const id = / \. ( [ 0 - 9 a - f ] { 7 } ) $ / . exec ( version )
33
+ if ( id ?. [ 1 ] ) {
34
+ return id [ 1 ]
35
+ }
36
+ // match github tag, for example 3.0.0-rc.8
37
+ return `v${ version } `
38
+ }
39
+
30
40
export function resolveNuxtManifest ( nuxt : Nuxt ) : NuxtProjectManifest {
31
41
const manifest : NuxtProjectManifest = {
32
42
_hash : null ,
You can’t perform that action at this time.
0 commit comments