startWatcher(embedderPath, exludePattern, client, mainFileName) { this._embedderPath = fileURLToPath(embedderPath); this._client = client; this._watcher = chokidar.watch([this._embedderPath], { ignored: new RegExp(exludePattern), awaitWriteFinish: true, ignorePermissionErrors: true }); const events = []; this._watcher.on('all', (event, name) => { if (event === 'add' || event === 'change' || event === 'unlink') { if (!events.length) setTimeout(() => client.filesChanged(events.splice(0)), 100); events.push({ type: event, name: pathToFileURL(name).toString() }); } }); this._watcher.on('error', console.error); }
.watch(slash(path.join(this.sourcePath, "/**/*")), { ignoreInitial: true, ignored: "**/node_modules/**"
chokidar.watch( process.argv[2], options, ).on('all', (type, file) => { Log.debug('worker found file', file); process.send(file); });
function createWatcher (...folders) { const watcher = chokidar.watch(folders, { ignored: /(^|[/\\])\../, persistent: true }) return watcher }
/** * Serve the site in watch mode */ const serve = (options, flags) => { log.info(`Starting local server at http://localhost:${flags.port}`); const { srcPath, outputPath } = parseOptions(options); build(options); server.serve({ path: outputPath, port: flags.port }); chokidar.watch(srcPath, { ignoreInitial: true }).on( 'all', debounce(() => { build(options); log.info('Waiting for changes...'); }, 500) ); }
listen () { if (!this.wss) { this.wss = new WebSocket.Server({server: this.server}) this.wss.on('connection', function connection (ws) { console.info('Live reload connected to the browser') const watcher = chokidar.watch(join(process.cwd(), 'browser', 'dist')) watcher.on('change', () => { console.info('Reloading browser') try { ws.send('reload') } catch (e) { console.warn(e) watcher.close() } }) }) } }
chokidar.watch(fileName).on("change", () => { console.log("Reloading web service data...") createServer() console.log("Reloading web service data complete.") })
chokidar .watch(serverFilename, { ignoreInitial: true, awaitWriteFinish: { stabilityThreshold: 100 }, }) .on('all', async () => { const spinner = ora('Updating Server Middleware') spinner.start() try { serverMiddleware = await getServerMiddleware() } catch (e) { spinner.fail() console.error(e) return } spinner.succeed() })
chokidar.watch(templatePath).on('change', () => { template = fs.readFileSync(templatePath, 'utf-8'); console.log('index.html template updated.'); update(); });
// Regenerate component metadata when components or examples change. chokidar .watch([paths.examples, paths.components]) .on("change", function(event, path) { generate(paths); });
chokidar.watch("./app").on("change", (event, path) => { console.log(event, path); reload(2); });
chokidar.watch('dist/nodom.js') .on('change', () => exec('npm', ['run', 'uglify']));
.watch(slash(path.join(this.sourcePath, "/**/*")), { ignoreInitial: true, ignored: "**/node_modules/**"
chokidar.watch(fileName).on("change", () => { console.log("Reloading web service data..."); createServer(); console.log("Reloading web service data complete."); });
chokidar.watch('lib/**/*.js') .on('change', () => exec('npm', ['run', 'build']));