-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
minor #54424 [WebProfilerBundle] Inline flowchart-only Mermaid versio…
…n (MatTheCat) This PR was merged into the 7.1 branch. Discussion ---------- [WebProfilerBundle] Inline flowchart-only Mermaid version | Q | A | ------------- | --- | Branch? | 7.1 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | Fix #54416 | License | MIT From mermaid-js/mermaid#2920 (comment) there is no official way to generate a diagram-specific script, but it is possible by patching the `packages/mermaid/src/diagram-api/diagram-orchestration.ts` file before building. This PR comes with a Makefile whose default recipe does so, and the `mermaid-flowchart-v2.min.js` file it generated from v10.9.0. Bumping the script’s version will require to update the Makefile’s `tag` variable to the corresponding `mermaid-js/mermaid`’s (from https://github.com/mermaid-js/mermaid/tags) and running `make`. The recipe depends on cURL, GNU tar, and pnpm. Commits ------- 32612e7 [WebProfilerBundle] Inline flowchart-only Mermaid version
- Loading branch information
Showing
5 changed files
with
519 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
vendor/ | ||
composer.lock | ||
phpunit.xml | ||
/Resources/views/Script/Mermaid/repo-* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/Symfony/Bundle/WebProfilerBundle/Resources/views/Script/Mermaid/Makefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
define diagram-orchestration | ||
import { diagram as flowchartV2 } from '../diagrams/flowchart/flowDiagram-v2.js'; | ||
import { registerDiagram } from './diagramAPI.js'; | ||
|
||
let hasLoadedDiagrams = false; | ||
export const addDiagrams = () => { | ||
if (hasLoadedDiagrams) { | ||
return; | ||
} | ||
hasLoadedDiagrams = true; | ||
registerDiagram('flowchart-v2', flowchartV2, () => true); | ||
}; | ||
endef | ||
|
||
override tag := v10.9.0 | ||
|
||
.PHONY: mermaid-flowchart-v2.min.js | ||
mermaid-flowchart-v2.min.js: | repo-$(tag)/node_modules | ||
$(file >repo-$(tag)/packages/mermaid/src/diagram-api/diagram-orchestration.ts,$(diagram-orchestration)) | ||
pnpm -C repo-$(tag) run build | ||
cp repo-$(tag)/packages/mermaid/dist/mermaid.min.js $@ | ||
|
||
repo-$(tag)/node_modules: | repo-$(tag) | ||
pnpm -C $(@D) install --ignore-scripts | ||
|
||
.SECONDARY: repo-$(tag) | ||
repo-$(tag): | ||
curl -fL https://github.com/mermaid-js/mermaid/archive/refs/tags/$(tag).tar.gz | tar -xz --strip-components=1 --one-top-level=$@ | ||
|
||
.PHONY: clean | ||
clean: | ||
rm -rf ./repo-* |
483 changes: 483 additions & 0 deletions
483
...mfony/Bundle/WebProfilerBundle/Resources/views/Script/Mermaid/mermaid-flowchart-v2.min.js
Large diffs are not rendered by default.
Oops, something went wrong.