mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-29 09:02:03 +00:00
fix(nuxi): properly detect hash and tag for upgrade changelog (#6708)
This commit is contained in:
parent
e93f88c1e4
commit
99c960fb05
@ -4,7 +4,7 @@ import { resolve } from 'pathe'
|
||||
import { readPackageJSON } from 'pkg-types'
|
||||
import { getPackageManager, packageManagerLocks } from '../utils/packageManagers'
|
||||
import { rmRecursive, touchFile } from '../utils/fs'
|
||||
import { cleanupNuxtDirs } from '../utils/nuxt'
|
||||
import { cleanupNuxtDirs, nuxtVersionToGitIdentifier } from '../utils/nuxt'
|
||||
import { defineNuxtCommand } from './index'
|
||||
|
||||
async function getNuxtVersion (path: string): Promise<string|null> {
|
||||
@ -64,8 +64,8 @@ export default defineNuxtCommand({
|
||||
consola.success('You\'re already using the latest version of nuxt.')
|
||||
} else {
|
||||
consola.success('Successfully upgraded nuxt from', currentVersion, 'to', upgradedVersion)
|
||||
const commitA = currentVersion.split('.').pop()
|
||||
const commitB = upgradedVersion.split('.').pop()
|
||||
const commitA = nuxtVersionToGitIdentifier(currentVersion)
|
||||
const commitB = nuxtVersionToGitIdentifier(upgradedVersion)
|
||||
if (commitA && commitB) {
|
||||
consola.info('Changelog:', `https://github.com/nuxt/framework/compare/${commitA}...${commitB}`)
|
||||
}
|
||||
|
@ -27,6 +27,16 @@ export async function cleanupNuxtDirs (rootDir: string) {
|
||||
].map(dir => resolve(rootDir, dir)))
|
||||
}
|
||||
|
||||
export function nuxtVersionToGitIdentifier (version: string) {
|
||||
// match the git identifier in the release, for example: 3.0.0-rc.8-27677607.a3a8706
|
||||
const id = /\.([0-9a-f]{7})$/.exec(version)
|
||||
if (id?.[1]) {
|
||||
return id[1]
|
||||
}
|
||||
// match github tag, for example 3.0.0-rc.8
|
||||
return `v${version}`
|
||||
}
|
||||
|
||||
export function resolveNuxtManifest (nuxt: Nuxt): NuxtProjectManifest {
|
||||
const manifest: NuxtProjectManifest = {
|
||||
_hash: null,
|
||||
|
Loading…
Reference in New Issue
Block a user