UNPKG

pinecone-cli

Version:
22 lines (21 loc) 745 B
import chokidar from 'chokidar'; import pinecone from '../index.js'; import { log, toRelativePath } from '../utilities.js'; export const watch = async (config) => { const themePath = toRelativePath(config.options.source); const configPath = toRelativePath('pinecone.config.js'); const watcher = chokidar.watch([themePath, configPath]); watcher.on('change', async () => { await pinecone() .then(() => { log.list('👀 Watching for changes...', [ config.options.source, './pinecone.config.js', ]); }) .catch((error) => { log.error('Unable to watch for changes.'); throw new Error(error); }); }); };