mirror of
https://github.com/chrononeko/chronocat.git
synced 2024-11-16 12:51:39 +00:00
refactor(shell): update init log
This commit is contained in:
parent
2134ce4ac3
commit
aa06467f84
@ -11,18 +11,22 @@ import { getSelfProfile, setSelfProfile } from './services/selfProfile'
|
||||
import { uix } from './services/uix'
|
||||
import { validate } from './services/validate'
|
||||
import type { ChronocatContext, Engine } from './types'
|
||||
import { bold, cyan, grey } from './utils/colors'
|
||||
import { PLATFORM } from './utils/consts'
|
||||
import { exists } from './utils/fs'
|
||||
import { sleep, timeout } from './utils/time'
|
||||
import { bgGrey, cyan, white } from './utils/colors'
|
||||
import { STARTUP_TEXT } from './utils/startup'
|
||||
import { sleep, timeout } from './utils/time'
|
||||
|
||||
export * from './satori/types'
|
||||
export * from './services/config/configEntity'
|
||||
export * from './types'
|
||||
|
||||
declare const __DEFINE_CHRONO_VERSION__: string
|
||||
|
||||
export const chronocat = () => {
|
||||
l.write(STARTUP_TEXT)
|
||||
l.info(`${cyan('Chronocat')} ${bold(__DEFINE_CHRONO_VERSION__)}`)
|
||||
l.info(grey('当左侧错误指示灯亮起时,点击错误码以检查说明。'))
|
||||
|
||||
let ready: () => void
|
||||
const readyPromise = new Promise<void>((res) => {
|
||||
@ -83,7 +87,7 @@ export const chronocat = () => {
|
||||
|
||||
const outerContext = {
|
||||
load: (x: Engine) => {
|
||||
l.info(`加载引擎 ${cyan(x.name)} ${bgGrey(white(`v${x.version}`))}`)
|
||||
l.info(`加载引擎 ${cyan(x.name)} ${grey(`v${x.version}`)}`)
|
||||
try {
|
||||
x.apply(ctx)
|
||||
} catch (e) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import type { Methods } from '../types'
|
||||
import { bgMagenta, cyan, magenta, white } from '../utils/colors'
|
||||
import { cyan, magenta } from '../utils/colors'
|
||||
import { l } from './logger'
|
||||
|
||||
export type ApiImpl<M extends keyof Methods> = ((
|
||||
@ -26,9 +26,7 @@ export type Api = {
|
||||
const buildNotimpl = (name: string) => {
|
||||
const fn = () =>
|
||||
l.error(
|
||||
new Error(
|
||||
`没有引擎提供 ${bgMagenta(white(name))}。可能没有加载所需的引擎?`,
|
||||
),
|
||||
new Error(`没有引擎提供 ${magenta(name)}。可能没有加载所需的引擎?`),
|
||||
{
|
||||
code: 2159,
|
||||
throw: true,
|
||||
|
@ -31,13 +31,4 @@ export const magenta = color('magenta')
|
||||
export const cyan = color('cyan')
|
||||
export const white = color('white')
|
||||
|
||||
export const bgGrey = bgColor('bgGrey')
|
||||
export const bgRed = bgColor('bgRed')
|
||||
export const bgGreen = bgColor('bgGreen')
|
||||
export const bgYellow = bgColor('bgYellow')
|
||||
export const bgBlue = bgColor('bgBlue')
|
||||
export const bgMagenta = bgColor('bgMagenta')
|
||||
export const bgCyan = bgColor('bgCyan')
|
||||
export const bgWhite = bgColor('bgWhite')
|
||||
|
||||
export type ColorFormatter = ReturnType<typeof color>
|
||||
|
@ -1,6 +1,4 @@
|
||||
import { cyan, grey, bold } from './colors'
|
||||
|
||||
declare const __DEFINE_CHRONO_VERSION__: string
|
||||
import { cyan, grey } from './colors'
|
||||
|
||||
const backgroundStrings = [
|
||||
'chronocat',
|
||||
@ -46,8 +44,4 @@ bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
|
||||
.replace(/([^b])/g, cyan('$1'))
|
||||
.replace(/b/g, () => grey(bgStr[i++ % bgStr.length]!))}
|
||||
|
||||
${cyan(' ChronoCat ')} ${bold(__DEFINE_CHRONO_VERSION__)}
|
||||
|
||||
${grey('[+] 点击形如 [CH2157] 的日志文本可以打开相应说明页面。')}
|
||||
|
||||
`
|
||||
|
Loading…
Reference in New Issue
Block a user