Skip to content

Commit

Permalink
type: fix chokidar type error.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jan 9, 2025
1 parent bb13918 commit 2cdde41
Showing 1 changed file with 0 additions and 12 deletions.
12 changes: 0 additions & 12 deletions packages/core/src/scripts/watch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export function watch() {
});

watcher.on('change', async (filepath, stats) => {
if (filepath instanceof Error) {
log.log('\x1b[31midoc:watch:\x1b[0m')(filepath.message);
return;
}
const isTheme = new RegExp(`^${config.data.theme}`).test(filepath);
// Modify Theme files
if (config.data.config.conf === filepath) {
Expand Down Expand Up @@ -61,20 +57,12 @@ export function watch() {
});

watcher.on('add', async (filepath) => {
if (filepath instanceof Error) {
log.log('\x1b[31midoc:watch:\x1b[0m')(filepath.message);
return;
}
watcher.add(filepath);
if (/\.(md|markdown)/i.test(filepath)) {
await compilation(filepath);
}
});
watcher.on('unlink', async (filepath) => {
if (filepath instanceof Error) {
log.log('\x1b[31midoc:watch:\x1b[0m')(filepath.message);
return;
}
watcher.unwatch(filepath);
const isTheme = new RegExp(`^${config.data.theme}`).test(filepath);
if (/\.(md|markdown)$/i.test(filepath)) {
Expand Down

0 comments on commit 2cdde41

Please sign in to comment.