(sourceRoots: string[], cb: Function)
| 2 | import watch from 'node-watch'; |
| 3 | |
| 4 | export function startWatch(sourceRoots: string[], cb: Function) { |
| 5 | const filter = (fn: Function) => { |
| 6 | return (evt: string, filename: string) => { |
| 7 | if (!/node_modules/.test(filename) && /\.sandbox.ts$/.test(filename)) { |
| 8 | fn(filename); |
| 9 | } |
| 10 | }; |
| 11 | }; |
| 12 | |
| 13 | sourceRoots.forEach(sourceRoot => |
| 14 | watch(resolvePath(sourceRoot), { recursive: true }, filter(cb))); |
| 15 | } |