Skip to content

Commit

Permalink
style: optimize output entry file log.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Mar 31, 2023
1 parent e8923e0 commit 11c4cff
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/core/src/compile.ts
Expand Up @@ -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);
Expand Down

0 comments on commit 11c4cff

Please sign in to comment.