feat: upgrade to consola v3.x prerelease (#20141)

This commit is contained in:
Daniel Roe 2023-04-08 11:16:06 +01:00 committed by GitHub
parent 9878c5b6e4
commit ea4b5220a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 33 additions and 30 deletions

View File

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

View File

@ -1,7 +1,7 @@
import consola from 'consola'
import { consola } from 'consola'
export const logger = consola
export function useLogger (scope?: string) {
return scope ? logger.withScope(scope) : logger
export function useLogger (tag?: string) {
return tag ? logger.withTag(tag) : logger
}

View File

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

View File

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

View File

@ -1,6 +1,6 @@
import { existsSync, promises as fsp } from 'node:fs'
import { dirname, resolve } from 'pathe'
import consola from 'consola'
import { consola } from 'consola'
import { loadKit } from '../utils/kit'
import { templates } from '../utils/templates'
import { defineNuxtCommand } from './index'

View File

@ -1,5 +1,5 @@
import { execa } from 'execa'
import consola from 'consola'
import { consola } from 'consola'
import { resolve } from 'pathe'
import { tryResolveModule } from '../utils/esm'
import { defineNuxtCommand } from './index'

View File

@ -1,5 +1,5 @@
import { relative, resolve } from 'pathe'
import consola from 'consola'
import { consola } from 'consola'
import { writeTypes } from '../utils/prepare'
import { loadKit } from '../utils/kit'
import { clearDir } from '../utils/fs'

View File

@ -4,7 +4,7 @@ import { relative, resolve } from 'pathe'
import chokidar from 'chokidar'
import { debounce } from 'perfect-debounce'
import type { Nuxt } from '@nuxt/schema'
import consola from 'consola'
import { consola } from 'consola'
import { withTrailingSlash } from 'ufo'
import { setupDotenv } from 'c12'
import { showBanner, showVersions } from '../utils/banner'

View File

@ -1,7 +1,7 @@
import { writeFile } from 'node:fs/promises'
import { downloadTemplate, startShell } from 'giget'
import { relative } from 'pathe'
import consola from 'consola'
import { consola } from 'consola'
import { defineNuxtCommand } from './index'
const rpath = (p: string) => relative(process.cwd(), p)

View File

@ -1,6 +1,6 @@
import { buildNuxt } from '@nuxt/kit'
import { relative, resolve } from 'pathe'
import consola from 'consola'
import { consola } from 'consola'
import { clearDir } from '../utils/fs'
import { loadKit } from '../utils/kit'
import { writeTypes } from '../utils/prepare'

View File

@ -3,7 +3,7 @@ import { dirname, relative } from 'node:path'
import { execa } from 'execa'
import { setupDotenv } from 'c12'
import { resolve } from 'pathe'
import consola from 'consola'
import { consola } from 'consola'
import { loadKit } from '../utils/kit'
import { defineNuxtCommand } from './index'

View File

@ -1,5 +1,5 @@
import { execSync } from 'node:child_process'
import consola from 'consola'
import { consola } from 'consola'
import { resolve } from 'pathe'
import { readPackageJSON } from 'pkg-types'
import { getPackageManager, packageManagerLocks } from '../utils/packageManagers'
@ -7,7 +7,7 @@ import { rmRecursive, touchFile } from '../utils/fs'
import { cleanupNuxtDirs, nuxtVersionToGitIdentifier } from '../utils/nuxt'
import { defineNuxtCommand } from './index'
async function getNuxtVersion (path: string): Promise<string|null> {
async function getNuxtVersion (path: string): Promise<string | null> {
try {
const pkg = await readPackageJSON('nuxt', { url: path })
if (!pkg.version) {

View File

@ -1,6 +1,6 @@
import { promises as fsp } from 'node:fs'
import { dirname } from 'pathe'
import consola from 'consola'
import { consola } from 'consola'
// Check if a file exists
export async function exists (path: string) {

View File

@ -1,6 +1,6 @@
import { promises as fsp } from 'node:fs'
import { dirname, resolve } from 'pathe'
import consola from 'consola'
import { consola } from 'consola'
import { hash } from 'ohash'
import type { Nuxt } from '@nuxt/schema'
import { rmRecursive } from './fs'

View File

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

View File

@ -1,4 +1,4 @@
import consola from 'consola'
import { consola } from 'consola'
import { useTestContext } from './context'
export function mockFn () {

View File

@ -1,7 +1,7 @@
import { performance } from 'node:perf_hooks'
import { createError } from 'h3'
import { ViteNodeRunner } from 'vite-node/client'
import consola from 'consola'
import { consola } from 'consola'
import { viteNodeFetch, viteNodeOptions } from './vite-node-shared.mjs'
const runner = createRunner()

View File

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

View File

@ -1,5 +1,5 @@
import Crawler from 'crawler'
import consola from 'consola'
import { consola } from 'consola'
import { parseURL, withoutTrailingSlash } from 'ufo'
import chalk from 'chalk'
import * as actions from '@actions/core'