From 6c41d7c74afa920671637b3c254755eda7ffb782 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Sun, 15 Oct 2023 04:45:49 +0800 Subject: [PATCH] fix: fix errors caused by chalk package. --- core/src/overrides/printInstructions.ts | 9 ++------- packages/react-library/src/checkRequiredFiles.ts | 7 +++---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/core/src/overrides/printInstructions.ts b/core/src/overrides/printInstructions.ts index 0a3cf4ad..9d8b65d2 100644 --- a/core/src/overrides/printInstructions.ts +++ b/core/src/overrides/printInstructions.ts @@ -1,4 +1,3 @@ -import chalk from 'chalk'; import { reactDevUtils } from '../utils/path'; import { getDocsData } from '../plugins/staticDoc'; import { DevServerOptions } from '../utils/conf'; @@ -18,12 +17,8 @@ export function overridesPrintInstructions(opt: OverridesPrintInstructionsOption devServerUtils.createCompiler = (option: any) => { if (opt.docs && !opt.printInstructions) { const { route } = getDocsData(opt.docs); - option.urls.localUrlForTerminal += `\n ${chalk.bold('Docs Local:')} ${ - option.urls?.localUrlForTerminal - }${route}\n`; - option.urls.lanUrlForTerminal += `\n ${chalk.bold('Docs On Your Network:')} ${ - option.urls?.lanUrlForTerminal - }${route}\n`; + option.urls.localUrlForTerminal += `\n \\033[1mDocs Local:\\033[0m ${option.urls?.localUrlForTerminal}${route}\n`; + option.urls.lanUrlForTerminal += `\n \\033[1mDocs On Your Network:\\033[0m ${option.urls?.lanUrlForTerminal}${route}\n`; } if (opt.docs && opt.printInstructions) { const docData = getDocsData(opt.docs); diff --git a/packages/react-library/src/checkRequiredFiles.ts b/packages/react-library/src/checkRequiredFiles.ts index 6e12f7de..80fbe290 100644 --- a/packages/react-library/src/checkRequiredFiles.ts +++ b/packages/react-library/src/checkRequiredFiles.ts @@ -1,6 +1,5 @@ import path from 'path'; import fs from 'fs'; -import chalk from 'chalk'; /** * Checked `paths.appHtml`, `paths.appIndexJs` @@ -21,9 +20,9 @@ export const checkRequiredFiles = (files: string[], isNotCheckHTML = true) => { if (currentFilePath) { const dirName = path.dirname(currentFilePath); const fileName = path.basename(currentFilePath); - console.log(chalk.red('Could not find a required file.')); - console.log(chalk.red(' Name: ') + chalk.cyan(fileName)); - console.log(chalk.red(' Searched in: ') + chalk.cyan(dirName)); + console.log('\\033[1mCould not find a required file.\\033[0m'); + console.log(' \\033[1mName: \\033[0m' + `\\033[36m${fileName}\\033[0m`); + console.log(' \\033[1mSearched in: \\033[0m' + `\\033[36m${dirName}\\033[0m`); } return false; }