chore: Build at start

This commit is contained in:
Sidharth Vinod 2023-08-13 20:21:43 +05:30
parent fc99d9be41
commit 170bbce0d3
No known key found for this signature in database
GPG Key ID: FB5CCD378D3907CD
1 changed files with 3 additions and 2 deletions

View File

@ -20,7 +20,9 @@ const zenumlCtx = await context(
const contexts = [mermaidCtx, mermaidIIFECtx, externalCtx, zenumlCtx];
const rebuildAll = async () => {
const time = Date.now();
await Promise.all(contexts.map((ctx) => ctx.rebuild()));
console.log('Rebuilt in' + (Date.now() - time) + 'ms');
};
let clients: { id: number; response: Response }[] = [];
@ -51,10 +53,8 @@ function handleFileChange() {
clearTimeout(timeoutId);
}
timeoutId = setTimeout(async () => {
const time = Date.now();
await rebuildAll();
sendEventsToAll();
console.log('Rebuild & Refresh complete in' + (Date.now() - time) + 'ms');
timeoutId = undefined;
}, 100);
}
@ -64,6 +64,7 @@ function sendEventsToAll() {
}
async function createServer() {
await rebuildAll();
const app = express();
chokidar
.watch('**/src/**/*.{js,ts,yaml,json}', {