chore: upgrade to consola v3 (#20194)

This commit is contained in:
Daniel Roe 2023-04-11 11:07:39 +01:00 committed by GitHub
parent d6c3c2439a
commit f951a15232
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 16 deletions

View File

@ -22,7 +22,7 @@
"dependencies": { "dependencies": {
"@nuxt/schema": "workspace:../schema", "@nuxt/schema": "workspace:../schema",
"c12": "^1.2.0", "c12": "^1.2.0",
"consola": "^3.0.0-3", "consola": "^3.0.1",
"defu": "^6.1.2", "defu": "^6.1.2",
"globby": "^13.1.3", "globby": "^13.1.3",
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",

View File

@ -29,7 +29,7 @@
"clear": "^0.1.0", "clear": "^0.1.0",
"clipboardy": "^3.0.0", "clipboardy": "^3.0.0",
"colorette": "^2.0.19", "colorette": "^2.0.19",
"consola": "^3.0.0-3", "consola": "^3.0.1",
"deep-object-diff": "^1.1.9", "deep-object-diff": "^1.1.9",
"destr": "^1.2.2", "destr": "^1.2.2",
"execa": "^7.1.1", "execa": "^7.1.1",

View File

@ -1,6 +1,6 @@
import mri from 'mri' import mri from 'mri'
import { red } from 'colorette' import { red } from 'colorette'
import type { Consola } from 'consola' import type { ConsolaReporter } from 'consola'
import { consola } from 'consola' import { consola } from 'consola'
import { checkEngines } from './utils/engines' import { checkEngines } from './utils/engines'
import type { Command, NuxtCommand } from './commands' import type { Command, NuxtCommand } from './commands'
@ -45,8 +45,7 @@ consola.wrapAll()
// Filter out unwanted logs // Filter out unwanted logs
// TODO: Use better API from consola for intercepting logs // TODO: Use better API from consola for intercepting logs
// TODO: export type from Consola const wrapReporter = (reporter: ConsolaReporter) => ({
const wrapReporter = (reporter: Consola['_reporters'][0]) => <Consola['_reporters'][0]> {
log (logObj, ctx) { log (logObj, ctx) {
if (!logObj.args || !logObj.args.length) { return } if (!logObj.args || !logObj.args.length) { return }
const msg = logObj.args[0] const msg = logObj.args[0]
@ -62,8 +61,9 @@ const wrapReporter = (reporter: Consola['_reporters'][0]) => <Consola['_reporter
} }
return reporter.log(logObj, ctx) return reporter.log(logObj, ctx)
} }
} }) satisfies ConsolaReporter
consola._reporters = consola._reporters.map(wrapReporter)
consola.options.reporters = consola.options.reporters.map(wrapReporter)
process.on('unhandledRejection', err => consola.error('[unhandledRejection]', err)) process.on('unhandledRejection', err => consola.error('[unhandledRejection]', err))
process.on('uncaughtException', err => consola.error('[uncaughtException]', err)) process.on('uncaughtException', err => consola.error('[uncaughtException]', err))

View File

@ -24,7 +24,7 @@
"dependencies": { "dependencies": {
"@nuxt/kit": "workspace:../kit", "@nuxt/kit": "workspace:../kit",
"@nuxt/schema": "workspace:../schema", "@nuxt/schema": "workspace:../schema",
"consola": "^3.0.0-3", "consola": "^3.0.1",
"defu": "^6.1.2", "defu": "^6.1.2",
"execa": "^7.1.1", "execa": "^7.1.1",
"get-port-please": "^3.0.1", "get-port-please": "^3.0.1",

View File

@ -367,8 +367,8 @@ importers:
specifier: ^1.2.0 specifier: ^1.2.0
version: 1.2.0 version: 1.2.0
consola: consola:
specifier: ^3.0.0-3 specifier: ^3.0.1
version: 3.0.0-3 version: 3.0.1
defu: defu:
specifier: ^6.1.2 specifier: ^6.1.2
version: 6.1.2 version: 6.1.2
@ -465,8 +465,8 @@ importers:
specifier: ^2.0.19 specifier: ^2.0.19
version: 2.0.19 version: 2.0.19
consola: consola:
specifier: ^3.0.0-3 specifier: ^3.0.1
version: 3.0.0-3 version: 3.0.1
deep-object-diff: deep-object-diff:
specifier: ^1.1.9 specifier: ^1.1.9
version: 1.1.9 version: 1.1.9
@ -755,8 +755,8 @@ importers:
specifier: workspace:* specifier: workspace:*
version: link:../schema version: link:../schema
consola: consola:
specifier: ^3.0.0-3 specifier: ^3.0.1
version: 3.0.0-3 version: 3.0.1
defu: defu:
specifier: ^6.1.2 specifier: ^6.1.2
version: 6.1.2 version: 6.1.2
@ -3800,8 +3800,8 @@ packages:
/consola@2.15.3: /consola@2.15.3:
resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==} resolution: {integrity: sha512-9vAdYbHj6x2fLKC4+oPH0kFzY/orMZyG2Aj+kNylHxKGJ/Ed4dpNyAQYwJOdqO4zdM7XpVHmyejQDcQHrnuXbw==}
/consola@3.0.0-3: /consola@3.0.1:
resolution: {integrity: sha512-3vhBx7Qw5LlF1/QnaeoQSSA5fOohGr9xtHkQ1RFbNlr6kOTwtVz0FvUPx6CdobrDDSP19cj0uWwPtf+/+VBKQA==} resolution: {integrity: sha512-08E7bC2N6gaFdzPU/qtBi4ulVvJitYnfrDdxEiwElC3jSNICbOvkcE+8N56EfIrBoxp37O9Qnn5ZZPElov83UQ==}
/console-control-strings@1.1.0: /console-control-strings@1.1.0:
resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==} resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==}