mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 04:09:12 +00:00
@@ -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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user