From 3e445f0ad766377d0edab5504f8baab24fad542d Mon Sep 17 00:00:00 2001 From: the1812 Date: Mon, 21 Mar 2022 23:43:36 +0800 Subject: [PATCH] Use string param --- .../components/utils/url-params-clean/index.ts | 2 +- src/components/auto-update/checker.ts | 15 +++++++++------ src/core/download.ts | 2 +- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/registry/lib/components/utils/url-params-clean/index.ts b/registry/lib/components/utils/url-params-clean/index.ts index 763880e08..d495d0e12 100644 --- a/registry/lib/components/utils/url-params-clean/index.ts +++ b/registry/lib/components/utils/url-params-clean/index.ts @@ -4,7 +4,7 @@ import { isNotHtml, matchPattern } from '@/core/utils' import { useScopedConsole } from '@/core/utils/log' const displayName = '网址参数清理' -const console = useScopedConsole({ name: displayName }) +const console = useScopedConsole(displayName) const entry = async () => { if (isNotHtml()) { return diff --git a/src/components/auto-update/checker.ts b/src/components/auto-update/checker.ts index 847997656..d90753cc6 100644 --- a/src/components/auto-update/checker.ts +++ b/src/components/auto-update/checker.ts @@ -14,7 +14,6 @@ import { CheckSingleTypeUpdateConfig, } from './utils' -const console = useScopedConsole({ name: '自动更新器' }) export const checkUpdate = async (config: CheckUpdateConfig) => { const { items, @@ -127,14 +126,18 @@ const checkByName = (method: CheckSingleTypeUpdate) => reload( export const checkAllUpdate = async (config: CheckSingleTypeUpdateConfig) => { const { options } = getComponentSettings(name) - console.groupCollapsed('开始检查更新') - console.log(await checkComponentsUpdate(config) || '暂无组件更新') - console.log(await checkPluginsUpdate(config) || '暂无插件更新') - console.log(await checkStylesUpdate(config) || '暂无样式更新') + const console = useScopedConsole('检查所有更新') + console.log('开始检查更新') + const updateMessages = [ + await checkComponentsUpdate(config) || '暂无组件更新', + await checkPluginsUpdate(config) || '暂无插件更新', + await checkStylesUpdate(config) || '暂无样式更新', + ] options.lastUpdateCheck = Number(new Date()) options.lastInstalledVersion = meta.version + console.groupCollapsed('完成更新检查') + updateMessages.forEach(message => console.log(message)) console.groupEnd() - console.log('完成更新检查') } export const silentCheckUpdate = () => checkAllUpdate({ maxCount: getComponentSettings(name).options.maxUpdateCount, diff --git a/src/core/download.ts b/src/core/download.ts index baeb867f8..3b477f67c 100644 --- a/src/core/download.ts +++ b/src/core/download.ts @@ -5,7 +5,7 @@ import { getGeneralSettings } from './settings' import { formatFilename } from './utils/formatters' import { useScopedConsole } from './utils/log' -const console = useScopedConsole({ name: '文件下载' }) +const console = useScopedConsole('文件下载') /** 表示`DownloadPackage`中的一个文件 */ export interface PackageEntry { /** 文件名 */