build: fix antlr4 script

This commit is contained in:
hayden 2023-11-16 20:35:44 +08:00 committed by Hayden
parent 1711febca7
commit 55379f3cf5

View File

@ -15,8 +15,10 @@ const baseCmd = 'antlr4ts -visitor -listener -Xexact-output-dir -o';
function compile(language) {
const cmd = `${baseCmd} ${outputPath}/${language} ${grammarsPath}/${language}/*.g4`;
if (fs.existsSync(`${outputPath}/${language}`)) {
console.info(chalk.green(`\nRemoving:`, chalk.gray(`${outputPath}/${language}/*`)));
fs.rmSync(`${outputPath}/${language}`, { recursive: true });
}
console.info(chalk.green('Executing:'), chalk.gray(cmd));
exec(cmd, (err) => {