INNER CODE UNIT · TypeScript
initWatcher
akirarika/milkio · packages/cookbook/src/watcher/index.ts:41
export async function initWatcher(options: CookbookOptions, mode: string, watch: boolean) {
const watchers: FSWatcher[] = [];
const dispose = () => {
for (const watcher of watchers) watcher.close();
};
let processedProjectCount = 0;
for (const projectName in options.projects ?? []) {
const project = options.projects[projectName];
if (project.type !== "milkio") continue;
const root = join(cwd(), "projects", projectName);
if (!(await exists(join(root, "app")))) continue;
processedProjectCount++;
}
progress.configure({ totalUnits: processedProjectCount * TOTAL_STAGE_WEIGHT });
try {
const tasks: Array<Promise<void>> = [];