mirror of
https://github.com/mermaid-js/mermaid.git
synced 2025-09-11 11:29:42 +02:00
fix: Viz build
This commit is contained in:
@@ -16,13 +16,13 @@ type OutputOptions = Exclude<
|
|||||||
undefined
|
undefined
|
||||||
>['output'];
|
>['output'];
|
||||||
|
|
||||||
const visualizerOptions = (packageName: string): PluginOption[] => {
|
const visualizerOptions = (packageName: string, core = false): PluginOption[] => {
|
||||||
if (packageName !== 'mermaid' || !visualize) {
|
if (packageName !== 'mermaid' || !visualize) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
return ['network', 'treemap', 'sunburst'].map((chartType) =>
|
return ['network', 'treemap', 'sunburst'].map((chartType) =>
|
||||||
visualizer({
|
visualizer({
|
||||||
filename: `./stats/${chartType}.html`,
|
filename: `./stats/${chartType}${core ? '.core' : ''}.html`,
|
||||||
template: chartType as TemplateType,
|
template: chartType as TemplateType,
|
||||||
gzipSize: true,
|
gzipSize: true,
|
||||||
brotliSize: true,
|
brotliSize: true,
|
||||||
@@ -112,7 +112,7 @@ export const getBuildConfig = ({ minify, core, watch, entryName }: BuildOptions)
|
|||||||
resolve: {
|
resolve: {
|
||||||
extensions: ['.jison', '.js', '.ts', '.json'],
|
extensions: ['.jison', '.js', '.ts', '.json'],
|
||||||
},
|
},
|
||||||
plugins: [jisonPlugin(), ...visualizerOptions(packageName)],
|
plugins: [jisonPlugin(), ...visualizerOptions(packageName, core)],
|
||||||
};
|
};
|
||||||
|
|
||||||
if (watch && config.build) {
|
if (watch && config.build) {
|
||||||
@@ -149,6 +149,9 @@ if (watch) {
|
|||||||
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-mindmap' }));
|
build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-mindmap' }));
|
||||||
// build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-example-diagram' }));
|
// build(getBuildConfig({ minify: false, watch, entryName: 'mermaid-example-diagram' }));
|
||||||
}
|
}
|
||||||
|
} else if (visualize) {
|
||||||
|
await build(getBuildConfig({ minify: false, core: true, entryName: 'mermaid' }));
|
||||||
|
await build(getBuildConfig({ minify: false, core: false, entryName: 'mermaid' }));
|
||||||
} else {
|
} else {
|
||||||
void main();
|
void main();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user