In https://github.com/tcvan0707/txt2html/blob/main/src/txt2html.js#L57-L61, I would improve things slightly:
// Move to its own function
function ensureDistDir() {
try {
await fs.mkdir(distDir);
} catch {
console.error(`Couldn't create ${distDir}, exiting`);
process.exit(1);
}
}
// later on call this...
ensureDistDir();
Here I log a helpful error message, don't print a call stack, and exit with an error code.
In https://github.com/tcvan0707/txt2html/blob/main/src/txt2html.js#L57-L61, I would improve things slightly:
Here I log a helpful error message, don't print a call stack, and exit with an error code.