Add extra build logging (#1259)

* fix build reloading

* prettier
This commit is contained in:
Konnor Rogers
2025-08-06 16:25:30 -04:00
committed by GitHub
parent 56d678b504
commit c02ac306af

View File

@@ -464,7 +464,25 @@ export async function build(options = {}) {
function handleWatchEvent(evt) { function handleWatchEvent(evt) {
return async filename => { return async filename => {
spinner.info(`File modified ${chalk.gray(`(${relative(getRootDir(), filename)})`)}`); const changedFile = relative(getRootDir(), filename);
let message = '';
if (evt === 'change') {
message = chalk.blue(`File modified ${chalk.gray(`(${changedFile})`)}`);
} else if (evt === 'unlink') {
message = chalk.red(`File deleted ${chalk.gray(`(${changedFile})`)}`);
} else if (evt === 'add') {
message = chalk.green(`File added ${chalk.gray(`(${changedFile})`)}`);
}
if (message) {
if (spinner) {
spinner.info(message);
} else {
console.log(message);
}
}
if (typeof options.beforeWatchEvent === 'function') { if (typeof options.beforeWatchEvent === 'function') {
await options.beforeWatchEvent(evt, filename); await options.beforeWatchEvent(evt, filename);
} }