mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 05:35:13 +00:00
feat: upgrade to consola v3.x prerelease (#20141)
This commit is contained in:
parent
9878c5b6e4
commit
ea4b5220a4
@ -22,7 +22,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxt/schema": "workspace:../schema",
|
"@nuxt/schema": "workspace:../schema",
|
||||||
"c12": "^1.2.0",
|
"c12": "^1.2.0",
|
||||||
"consola": "^2.15.3",
|
"consola": "^3.0.0-3",
|
||||||
"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",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
|
|
||||||
export const logger = consola
|
export const logger = consola
|
||||||
|
|
||||||
export function useLogger (scope?: string) {
|
export function useLogger (tag?: string) {
|
||||||
return scope ? logger.withScope(scope) : logger
|
return tag ? logger.withTag(tag) : logger
|
||||||
}
|
}
|
||||||
|
@ -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": "^2.15.3",
|
"consola": "^3.0.0-3",
|
||||||
"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",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import mri from 'mri'
|
import mri from 'mri'
|
||||||
import { red } from 'colorette'
|
import { red } from 'colorette'
|
||||||
import type { ConsolaReporter } from 'consola'
|
import type { Consola } 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'
|
||||||
import { commands } from './commands'
|
import { commands } from './commands'
|
||||||
@ -45,7 +45,8 @@ 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
|
||||||
const wrapReporter = (reporter: ConsolaReporter) => <ConsolaReporter> {
|
// TODO: export type from Consola
|
||||||
|
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,7 +63,6 @@ const wrapReporter = (reporter: ConsolaReporter) => <ConsolaReporter> {
|
|||||||
return reporter.log(logObj, ctx)
|
return reporter.log(logObj, ctx)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// @ts-expect-error
|
|
||||||
consola._reporters = consola._reporters.map(wrapReporter)
|
consola._reporters = consola._reporters.map(wrapReporter)
|
||||||
|
|
||||||
process.on('unhandledRejection', err => consola.error('[unhandledRejection]', err))
|
process.on('unhandledRejection', err => consola.error('[unhandledRejection]', err))
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { existsSync, promises as fsp } from 'node:fs'
|
import { existsSync, promises as fsp } from 'node:fs'
|
||||||
import { dirname, resolve } from 'pathe'
|
import { dirname, resolve } from 'pathe'
|
||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
import { loadKit } from '../utils/kit'
|
import { loadKit } from '../utils/kit'
|
||||||
import { templates } from '../utils/templates'
|
import { templates } from '../utils/templates'
|
||||||
import { defineNuxtCommand } from './index'
|
import { defineNuxtCommand } from './index'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { execa } from 'execa'
|
import { execa } from 'execa'
|
||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
import { tryResolveModule } from '../utils/esm'
|
import { tryResolveModule } from '../utils/esm'
|
||||||
import { defineNuxtCommand } from './index'
|
import { defineNuxtCommand } from './index'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { relative, resolve } from 'pathe'
|
import { relative, resolve } from 'pathe'
|
||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
import { writeTypes } from '../utils/prepare'
|
import { writeTypes } from '../utils/prepare'
|
||||||
import { loadKit } from '../utils/kit'
|
import { loadKit } from '../utils/kit'
|
||||||
import { clearDir } from '../utils/fs'
|
import { clearDir } from '../utils/fs'
|
||||||
|
@ -4,7 +4,7 @@ import { relative, resolve } from 'pathe'
|
|||||||
import chokidar from 'chokidar'
|
import chokidar from 'chokidar'
|
||||||
import { debounce } from 'perfect-debounce'
|
import { debounce } from 'perfect-debounce'
|
||||||
import type { Nuxt } from '@nuxt/schema'
|
import type { Nuxt } from '@nuxt/schema'
|
||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
import { withTrailingSlash } from 'ufo'
|
import { withTrailingSlash } from 'ufo'
|
||||||
import { setupDotenv } from 'c12'
|
import { setupDotenv } from 'c12'
|
||||||
import { showBanner, showVersions } from '../utils/banner'
|
import { showBanner, showVersions } from '../utils/banner'
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { writeFile } from 'node:fs/promises'
|
import { writeFile } from 'node:fs/promises'
|
||||||
import { downloadTemplate, startShell } from 'giget'
|
import { downloadTemplate, startShell } from 'giget'
|
||||||
import { relative } from 'pathe'
|
import { relative } from 'pathe'
|
||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
import { defineNuxtCommand } from './index'
|
import { defineNuxtCommand } from './index'
|
||||||
|
|
||||||
const rpath = (p: string) => relative(process.cwd(), p)
|
const rpath = (p: string) => relative(process.cwd(), p)
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { buildNuxt } from '@nuxt/kit'
|
import { buildNuxt } from '@nuxt/kit'
|
||||||
import { relative, resolve } from 'pathe'
|
import { relative, resolve } from 'pathe'
|
||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
import { clearDir } from '../utils/fs'
|
import { clearDir } from '../utils/fs'
|
||||||
import { loadKit } from '../utils/kit'
|
import { loadKit } from '../utils/kit'
|
||||||
import { writeTypes } from '../utils/prepare'
|
import { writeTypes } from '../utils/prepare'
|
||||||
|
@ -3,7 +3,7 @@ import { dirname, relative } from 'node:path'
|
|||||||
import { execa } from 'execa'
|
import { execa } from 'execa'
|
||||||
import { setupDotenv } from 'c12'
|
import { setupDotenv } from 'c12'
|
||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
import { loadKit } from '../utils/kit'
|
import { loadKit } from '../utils/kit'
|
||||||
|
|
||||||
import { defineNuxtCommand } from './index'
|
import { defineNuxtCommand } from './index'
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { execSync } from 'node:child_process'
|
import { execSync } from 'node:child_process'
|
||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
import { resolve } from 'pathe'
|
import { resolve } from 'pathe'
|
||||||
import { readPackageJSON } from 'pkg-types'
|
import { readPackageJSON } from 'pkg-types'
|
||||||
import { getPackageManager, packageManagerLocks } from '../utils/packageManagers'
|
import { getPackageManager, packageManagerLocks } from '../utils/packageManagers'
|
||||||
@ -7,7 +7,7 @@ import { rmRecursive, touchFile } from '../utils/fs'
|
|||||||
import { cleanupNuxtDirs, nuxtVersionToGitIdentifier } from '../utils/nuxt'
|
import { cleanupNuxtDirs, nuxtVersionToGitIdentifier } from '../utils/nuxt'
|
||||||
import { defineNuxtCommand } from './index'
|
import { defineNuxtCommand } from './index'
|
||||||
|
|
||||||
async function getNuxtVersion (path: string): Promise<string|null> {
|
async function getNuxtVersion (path: string): Promise<string | null> {
|
||||||
try {
|
try {
|
||||||
const pkg = await readPackageJSON('nuxt', { url: path })
|
const pkg = await readPackageJSON('nuxt', { url: path })
|
||||||
if (!pkg.version) {
|
if (!pkg.version) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { promises as fsp } from 'node:fs'
|
import { promises as fsp } from 'node:fs'
|
||||||
import { dirname } from 'pathe'
|
import { dirname } from 'pathe'
|
||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
|
|
||||||
// Check if a file exists
|
// Check if a file exists
|
||||||
export async function exists (path: string) {
|
export async function exists (path: string) {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { promises as fsp } from 'node:fs'
|
import { promises as fsp } from 'node:fs'
|
||||||
import { dirname, resolve } from 'pathe'
|
import { dirname, resolve } from 'pathe'
|
||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
import { hash } from 'ohash'
|
import { hash } from 'ohash'
|
||||||
import type { Nuxt } from '@nuxt/schema'
|
import type { Nuxt } from '@nuxt/schema'
|
||||||
import { rmRecursive } from './fs'
|
import { rmRecursive } from './fs'
|
||||||
|
@ -24,7 +24,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@nuxt/kit": "workspace:../kit",
|
"@nuxt/kit": "workspace:../kit",
|
||||||
"@nuxt/schema": "workspace:../schema",
|
"@nuxt/schema": "workspace:../schema",
|
||||||
"consola": "^2.15.3",
|
"consola": "^3.0.0-3",
|
||||||
"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",
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
import { useTestContext } from './context'
|
import { useTestContext } from './context'
|
||||||
|
|
||||||
export function mockFn () {
|
export function mockFn () {
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { performance } from 'node:perf_hooks'
|
import { performance } from 'node:perf_hooks'
|
||||||
import { createError } from 'h3'
|
import { createError } from 'h3'
|
||||||
import { ViteNodeRunner } from 'vite-node/client'
|
import { ViteNodeRunner } from 'vite-node/client'
|
||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
import { viteNodeFetch, viteNodeOptions } from './vite-node-shared.mjs'
|
import { viteNodeFetch, viteNodeOptions } from './vite-node-shared.mjs'
|
||||||
|
|
||||||
const runner = createRunner()
|
const runner = createRunner()
|
||||||
|
@ -367,8 +367,8 @@ importers:
|
|||||||
specifier: ^1.2.0
|
specifier: ^1.2.0
|
||||||
version: 1.2.0
|
version: 1.2.0
|
||||||
consola:
|
consola:
|
||||||
specifier: ^2.15.3
|
specifier: ^3.0.0-3
|
||||||
version: 2.15.3
|
version: 3.0.0-3
|
||||||
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: ^2.15.3
|
specifier: ^3.0.0-3
|
||||||
version: 2.15.3
|
version: 3.0.0-3
|
||||||
deep-object-diff:
|
deep-object-diff:
|
||||||
specifier: ^1.1.9
|
specifier: ^1.1.9
|
||||||
version: 1.1.9
|
version: 1.1.9
|
||||||
@ -752,8 +752,8 @@ importers:
|
|||||||
specifier: workspace:*
|
specifier: workspace:*
|
||||||
version: link:../schema
|
version: link:../schema
|
||||||
consola:
|
consola:
|
||||||
specifier: ^2.15.3
|
specifier: ^3.0.0-3
|
||||||
version: 2.15.3
|
version: 3.0.0-3
|
||||||
defu:
|
defu:
|
||||||
specifier: ^6.1.2
|
specifier: ^6.1.2
|
||||||
version: 6.1.2
|
version: 6.1.2
|
||||||
@ -3777,6 +3777,9 @@ 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:
|
||||||
|
resolution: {integrity: sha512-3vhBx7Qw5LlF1/QnaeoQSSA5fOohGr9xtHkQ1RFbNlr6kOTwtVz0FvUPx6CdobrDDSP19cj0uWwPtf+/+VBKQA==}
|
||||||
|
|
||||||
/console-control-strings@1.1.0:
|
/console-control-strings@1.1.0:
|
||||||
resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==}
|
resolution: {integrity: sha512-ty/fTekppD2fIwRvnZAVdeOiGd1c7YXEixbgJTNzqcxJWKQnjJ/V1bNEEE6hygpM3WjwHFUVK6HTjWSzV4a8sQ==}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import Crawler from 'crawler'
|
import Crawler from 'crawler'
|
||||||
import consola from 'consola'
|
import { consola } from 'consola'
|
||||||
import { parseURL, withoutTrailingSlash } from 'ufo'
|
import { parseURL, withoutTrailingSlash } from 'ufo'
|
||||||
import chalk from 'chalk'
|
import chalk from 'chalk'
|
||||||
import * as actions from '@actions/core'
|
import * as actions from '@actions/core'
|
||||||
|
Loading…
Reference in New Issue
Block a user