chore: use consola to log out compatibility info (#28854)

This commit is contained in:
Daniel Roe 2024-09-05 17:27:16 +02:00
parent 3c4979f2c7
commit 126041b121
No known key found for this signature in database
GPG Key ID: 3714AB03996F442B

View File

@ -103,8 +103,7 @@ async function initNuxt (nuxt: Nuxt) {
const shouldShowPrompt = nuxt.options.dev && hasTTY && !isCI
if (!shouldShowPrompt) {
// eslint-disable-next-line no-console
console.log(`Using \`${fallbackCompatibilityDate}\` as fallback compatibility date.`)
logger.info(`Using \`${fallbackCompatibilityDate}\` as fallback compatibility date.`)
}
async function promptAndUpdate () {
@ -113,8 +112,7 @@ async function initNuxt (nuxt: Nuxt) {
default: true,
})
if (result !== true) {
// eslint-disable-next-line no-console
console.log(`Using \`${fallbackCompatibilityDate}\` as fallback compatibility date.`)
logger.info(`Using \`${fallbackCompatibilityDate}\` as fallback compatibility date.`)
return
}
@ -148,8 +146,7 @@ async function initNuxt (nuxt: Nuxt) {
consola.error(`Failed to update config: ${message}`)
}
// eslint-disable-next-line no-console
console.log(`Using \`${fallbackCompatibilityDate}\` as fallback compatibility date.`)
logger.info(`Using \`${fallbackCompatibilityDate}\` as fallback compatibility date.`)
}
nuxt.hooks.hookOnce('nitro:init', (nitro) => {
@ -158,8 +155,7 @@ async function initNuxt (nuxt: Nuxt) {
nitro.hooks.hookOnce('compiled', () => {
warnedAboutCompatDate = true
// Print warning
// eslint-disable-next-line no-console
console.info(`Nuxt now supports pinning the behavior of provider and deployment presets with a compatibility date. We recommend you specify a \`compatibilityDate\` in your \`nuxt.config\` file, or set an environment variable, such as \`COMPATIBILITY_DATE=${todaysDate}\`.`)
logger.info(`Nuxt now supports pinning the behavior of provider and deployment presets with a compatibility date. We recommend you specify a \`compatibilityDate\` in your \`nuxt.config\` file, or set an environment variable, such as \`COMPATIBILITY_DATE=${todaysDate}\`.`)
if (shouldShowPrompt) { promptAndUpdate() }
})
})
@ -669,8 +665,7 @@ async function initNuxt (nuxt: Nuxt) {
// Show compatibility version banner when Nuxt is running with a compatibility version
// that is different from the current major version
if (!(satisfies(nuxt._version, nuxt.options.future.compatibilityVersion + '.x'))) {
// eslint-disable-next-line no-console
console.info(`Running with compatibility version \`${nuxt.options.future.compatibilityVersion}\``)
logger.info(`Running with compatibility version \`${nuxt.options.future.compatibilityVersion}\``)
}
await nuxt.callHook('ready', nuxt)