mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: watcher: ignore hidden file/folder changes
This commit is contained in:
1 parent
718c589dec
commit
f81a1dda54
1 file changed
+2
-1
@@ -2,7 +2,7 @@
|
|||||||
/* eslint-disable consistent-return */
|
/* eslint-disable consistent-return */
|
||||||
/* eslint-disable import/no-dynamic-require */
|
/* eslint-disable import/no-dynamic-require */
|
||||||
/* eslint-disable @typescript-eslint/no-shadow */
|
/* eslint-disable @typescript-eslint/no-shadow */
|
||||||
import { relative, resolve } from 'path';
|
import { relative, resolve, sep } from 'path';
|
||||||
import { FSWatcher, watch } from 'chokidar';
|
import { FSWatcher, watch } from 'chokidar';
|
||||||
import { debounce } from 'lodash';
|
import { debounce } from 'lodash';
|
||||||
import { Context, MainScope, Service } from '../context';
|
import { Context, MainScope, Service } from '../context';
|
||||||
@@ -59,6 +59,7 @@ export default class Watcher extends Service {
|
|||||||
const triggerLocalReload = debounce(() => this.triggerLocalReload(), 1000);
|
const triggerLocalReload = debounce(() => this.triggerLocalReload(), 1000);
|
||||||
|
|
||||||
this.watcher.on('change', (path) => {
|
this.watcher.on('change', (path) => {
|
||||||
|
if (path.includes(`${sep}.`)) return;
|
||||||
logger.debug('change detected:', relative(this.root, path));
|
logger.debug('change detected:', relative(this.root, path));
|
||||||
this.ctx.emit('app/watch/change', path);
|
this.ctx.emit('app/watch/change', path);
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user