mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-10-19 14:09:54 +02:00
chore: Build at start
This commit is contained in:
@@ -20,7 +20,9 @@ const zenumlCtx = await context(
|
|||||||
const contexts = [mermaidCtx, mermaidIIFECtx, externalCtx, zenumlCtx];
|
const contexts = [mermaidCtx, mermaidIIFECtx, externalCtx, zenumlCtx];
|
||||||
|
|
||||||
const rebuildAll = async () => {
|
const rebuildAll = async () => {
|
||||||
|
const time = Date.now();
|
||||||
await Promise.all(contexts.map((ctx) => ctx.rebuild()));
|
await Promise.all(contexts.map((ctx) => ctx.rebuild()));
|
||||||
|
console.log('Rebuilt in' + (Date.now() - time) + 'ms');
|
||||||
};
|
};
|
||||||
|
|
||||||
let clients: { id: number; response: Response }[] = [];
|
let clients: { id: number; response: Response }[] = [];
|
||||||
@@ -51,10 +53,8 @@ function handleFileChange() {
|
|||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
}
|
}
|
||||||
timeoutId = setTimeout(async () => {
|
timeoutId = setTimeout(async () => {
|
||||||
const time = Date.now();
|
|
||||||
await rebuildAll();
|
await rebuildAll();
|
||||||
sendEventsToAll();
|
sendEventsToAll();
|
||||||
console.log('Rebuild & Refresh complete in' + (Date.now() - time) + 'ms');
|
|
||||||
timeoutId = undefined;
|
timeoutId = undefined;
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
@@ -64,6 +64,7 @@ function sendEventsToAll() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function createServer() {
|
async function createServer() {
|
||||||
|
await rebuildAll();
|
||||||
const app = express();
|
const app = express();
|
||||||
chokidar
|
chokidar
|
||||||
.watch('**/src/**/*.{js,ts,yaml,json}', {
|
.watch('**/src/**/*.{js,ts,yaml,json}', {
|
||||||
|
Reference in New Issue
Block a user