Skip to content

Issue 125 - autogenerate $configMap with proper grouping#126

Merged
gesinn-it-ilm merged 8 commits intomasterfrom
issue-125
Jul 9, 2025
Merged

Issue 125 - autogenerate $configMap with proper grouping#126
gesinn-it-ilm merged 8 commits intomasterfrom
issue-125

Conversation

@gesinn-it-ilm
Copy link
Copy Markdown
Contributor

@gesinn-it-ilm gesinn-it-ilm commented Jul 9, 2025

This PR is related to the issue #125.

This PR contains:

  • Fetches and parses config.type.ts from Mermaid.js v10.9.3.
  • Recursively extracts all config properties including nested interfaces into a flat dot-notation map.
  • Detects boolean config properties and assigns FILTER_VALIDATE_BOOLEAN for correct PHP typing.
  • Groups configuration keys by diagram prefix (e.g. flowchart, gantt) with comment headers in the PHP array.
  • Automatically updates src/MermaidConfigExtractor.php by replacing the $configMap block in-place.
  • Eliminates manual syncing and reduces risk of human error or outdated configs.
  • Makes the config structure clearer and easier to maintain.
  • Added more test cases for different keys Mermaid config extraction
  • Simplifies future Mermaid.js upgrades by regenerating configMap via the script. (just put the proper Mermaid.js version into script scripts/generateConfigMap.ts)

Note: Related tests must be updated to reflect the new config structure, such as removal of deprecated keys.

This automation ensures the config map stays up to date and neatly organized, reducing manual maintenance and human error.

- Automated extraction now pulls deeper config keys like 'flowchart.useMaxWidth' as flat strings
  instead of nested arrays, matching Mermaid.js v10+ configuration style.
- Fetches config.type.ts directly from Mermaid.js for the specified Mermaid.js version,
  ensuring up-to-date and accurate config definitions.
- Recursively extracts all config properties including nested interfaces and types,
  flattening keys into dot notation strings (e.g., 'flowchart.useMaxWidth').
- Detects boolean fields and marks them with FILTER_VALIDATE_BOOLEAN for proper type handling.
- Groups config keys by diagram prefix (e.g., 'flowchart', 'sequence') and adds
  descriptive // comments above each group for better readability and maintenance.
- Automatically updates the $configMap block in src/MermaidConfigExtractor.php
  to reflect the latest config structure, reducing manual effort and human error.
…aid.js v10.9.3

- Adjusted test expectations in MermaidConfigExtractorTest and MermaidParserFunctionTest
- config.flowchart.useMaxWidth is no longer a valid configuration key in Mermaid.js v10.9.3
@codecov
Copy link
Copy Markdown

codecov bot commented Jul 9, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.05%. Comparing base (d85e165) to head (35d5fcf).
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##             master     #126   +/-   ##
=========================================
  Coverage     94.05%   94.05%           
  Complexity       24       24           
=========================================
  Files             5        5           
  Lines           101      101           
=========================================
  Hits             95       95           
  Misses            6        6           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@gesinn-it-ilm gesinn-it-ilm merged commit bd29c32 into master Jul 9, 2025
8 checks passed
@gesinn-it-ilm gesinn-it-ilm deleted the issue-125 branch July 9, 2025 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant