Commit Graph

11 Commits

Author SHA1 Message Date
Sidharth Vinod 2b5da79cdf
Merge pull request #4112 from aloisklink/add-jsonschema-schema-for-config
Use JSON Schema to define and document `MermaidConfig`
2023-07-06 10:03:55 +00:00
Sidharth Vinod aaec16ed6c
chore: Remove lint warnings in example-diagram 2023-07-06 11:58:55 +05:30
Alois Klink 7c3a73d4a8 build(types): add script to generate Config types
Add script `packages/mermaid/scripts/create-types-from-json-schema.mts`
to automatically generate the TypeScript definition for `MermaidConfig`
from the `MermaidConfig` JSON Schema at
`packages/mermaid/src/schemas/config.schema.yaml`.

To do this, we are using this library
[`json-schema-to-typescript`][1], which is also used by Webpack to
generate their types from their JSON Schema.

In order to make sure that this isn't a breaking change, the script
makes all fields **optional**, as that is what the original typescript
file has.

Additionally, I've put in some custom logic into the script, so that
the exact same order is used for the TypeScript file, to make the
`git diff` easier to review. In the future, we can remove this custom
logic, once we no longer need to worry about `git merge` conflicts.

[1]: https://github.com/bcherny/json-schema-to-typescript
2023-07-06 03:53:40 +01:00
Yokozuna59 346daa2327 prettierignore .nyc_output 2023-06-28 03:12:46 +03:00
Sidharth Vinod cdc68d99fe
Cleanup 2023-04-29 10:50:30 +05:30
Sidharth Vinod de8ce77f37
fix Lint 2022-11-21 08:16:16 +05:30
Alois Klink 69d05c454d style: ignore pnpm-lock.yaml from prettier
The `pnpm-lock.yaml` file is auto-generated by PNPM.
2022-09-25 19:52:27 +01:00
Sidharth Vinod 98506d888c
Fix lint 2022-09-16 18:45:12 +05:30
Sidharth Vinod 98e9f5751a
Prettier pass 2022-09-05 01:00:47 +05:30
Sidharth Vinod 91478caf5b
fix #3407 Replace `div` with `pre` and format 2022-09-05 00:48:36 +05:30
Sidharth Vinod c68ec54fdd
tsConversion: mermaid main 2022-08-21 18:37:27 +05:30