fix(cli): print Next.js' stderr to improve debug

especially for `log4brains build` (see #26)
This commit is contained in:
Thomas Vaillant
2021-04-30 16:01:36 +02:00
committed by Thomas Vaillant
parent 7eb267eded
commit 8f888634fd

View File

@@ -13,11 +13,12 @@ export async function execNext(fn: () => Promise<void>): Promise<void> {
const debug = !!process.env.DEBUG;
const capturer = new ConsoleCapturer();
if (debug) {
capturer.onLog = (method, args) => {
capturer.onLog = (method, args, stream) => {
if (stream === "stderr" || debug) {
capturer.doPrintln(...["[Next] ", ...args].map((a) => chalk.dim(a)));
};
}
}
};
capturer.start();
await fn();
capturer.stop();