chore: Optimize dev server
This commit is contained in:
parent
94c3d7fb60
commit
cbcd2cce9b
|
@ -7,37 +7,23 @@ import chokidar from 'chokidar';
|
||||||
import { generateLangium } from '../.build/generateLangium.js';
|
import { generateLangium } from '../.build/generateLangium.js';
|
||||||
import { packageOptions } from '../.build/common.js';
|
import { packageOptions } from '../.build/common.js';
|
||||||
|
|
||||||
const parserCtx = await context(
|
const configs = Object.values(packageOptions).map(({ packageName }) =>
|
||||||
getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: 'parser' })
|
getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: packageName })
|
||||||
);
|
);
|
||||||
const mermaidCtx = await context(
|
const mermaidIIFEConfig = getBuildConfig({
|
||||||
getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: 'mermaid' })
|
...defaultOptions,
|
||||||
);
|
minify: false,
|
||||||
const mermaidIIFECtx = await context(
|
core: false,
|
||||||
getBuildConfig({
|
entryName: 'mermaid',
|
||||||
...defaultOptions,
|
format: 'iife',
|
||||||
minify: false,
|
});
|
||||||
core: false,
|
configs.push(mermaidIIFEConfig);
|
||||||
entryName: 'mermaid',
|
|
||||||
format: 'iife',
|
const contexts = await Promise.all(configs.map((config) => context(config)));
|
||||||
})
|
|
||||||
);
|
|
||||||
const externalCtx = await context(
|
|
||||||
getBuildConfig({
|
|
||||||
...defaultOptions,
|
|
||||||
minify: false,
|
|
||||||
core: false,
|
|
||||||
entryName: 'mermaid-example-diagram',
|
|
||||||
})
|
|
||||||
);
|
|
||||||
const zenumlCtx = await context(
|
|
||||||
getBuildConfig({ ...defaultOptions, minify: false, core: false, entryName: 'mermaid-zenuml' })
|
|
||||||
);
|
|
||||||
const contexts = [parserCtx, mermaidCtx, mermaidIIFECtx, externalCtx, zenumlCtx];
|
|
||||||
|
|
||||||
const rebuildAll = async () => {
|
const rebuildAll = async () => {
|
||||||
console.time('Rebuild time');
|
console.time('Rebuild time');
|
||||||
await Promise.all(contexts.map((ctx) => ctx.rebuild()));
|
await Promise.all(contexts.map((ctx) => ctx.rebuild())).catch((e) => console.error(e));
|
||||||
console.timeEnd('Rebuild time');
|
console.timeEnd('Rebuild time');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue