From 11c4cff904fb69fc8850f973ddff60a75b9102b8 Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Fri, 31 Mar 2023 11:27:09 +0800 Subject: [PATCH] style: optimize output entry file log. --- packages/core/src/compile.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/packages/core/src/compile.ts b/packages/core/src/compile.ts index 61bdc56c..da89b2d3 100644 --- a/packages/core/src/compile.ts +++ b/packages/core/src/compile.ts @@ -18,15 +18,18 @@ export async function compile(options: CompileOptions = {}) { }); } // ==Use Babel============================================= - const err = [ - '\x1b[31;1m When compiling with\x1b[0m\x1b[33;1m Babel\x1b[0m\x1b[31;1m, you need to specify the compilation file, E.g:\x1b[0m\n', - ' \x1b[35;1m$\x1b[0m\x1b[36;1m tsbb\x1b[0m build\x1b[33;1m src/*.{jsx,js}\x1b[0m --useBabel', - ' \x1b[35;1m$\x1b[0m\x1b[36;1m tsbb\x1b[0m build\x1b[33;1m "src/**/*.ts"\x1b[0m --useBabel', - ' \x1b[35;1m$\x1b[0m\x1b[36;1m tsbb\x1b[0m build\x1b[33;1m src/index.jsx\x1b[0m --useBabel', - ' \x1b[35;1m$\x1b[0m\x1b[36;1m tsbb\x1b[0m build\x1b[33;1m src/index.jsx\x1b[0m \x1b[33;1m src/main.jsx\x1b[0m --useBabel\n', - ` \x1b[31;1m$ tsbb ${process.argv.slice(2).join(' ')}\x1b[0m\n\n`, - ]; if (!options.entry?.length) { + const err = [ + '\x1b[31;1m When compiling with\x1b[0m\x1b[33;1m Babel\x1b[0m\x1b[31;1m, you need to specify the compilation file, E.g:\x1b[0m\n', + ' \x1b[35;1m$\x1b[0m\x1b[36;1m tsbb\x1b[0m build\x1b[33;1m src/*.{jsx,js}\x1b[0m --useBabel', + ' \x1b[35;1m$\x1b[0m\x1b[36;1m tsbb\x1b[0m build\x1b[33;1m "src/**/*.ts"\x1b[0m --useBabel', + ' \x1b[35;1m$\x1b[0m\x1b[36;1m tsbb\x1b[0m build\x1b[33;1m src/index.jsx\x1b[0m --useBabel', + ' \x1b[35;1m$\x1b[0m\x1b[36;1m tsbb\x1b[0m build\x1b[33;1m src/index.jsx\x1b[0m \x1b[33;1m src/main.jsx\x1b[0m --useBabel\n', + ' \x1b[31;1mThe command you entered:\x1b[0m\n', + ` \x1b[31;1m$ tsbb ${process.argv.slice(2).join(' ')}\x1b[0m\n`, + ' \x1b[31;1mThe files you need to compile have been indexed:\x1b[0m\n', + ]; + (options.entry || []).forEach((fileNames) => err.push(` \x1b[35;1m${fileNames}\x1b[0m`)); throw new Error(err.join('\n')); } babelTransform(options);