docusaurus-plugin-generate-schema-docs 1.6.0 → 1.7.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. package/README.md +17 -0
  2. package/__tests__/__fixtures__/static/schemas/battle-test-event.json +771 -0
  3. package/__tests__/__fixtures__/static/schemas/conditional-event.json +52 -0
  4. package/__tests__/__fixtures__/static/schemas/nested-conditional-event.json +50 -0
  5. package/__tests__/components/ConditionalRows.test.js +150 -0
  6. package/__tests__/components/ConnectorLines.visualRegression.test.js +93 -0
  7. package/__tests__/components/FoldableRows.test.js +7 -4
  8. package/__tests__/components/SchemaRows.test.js +31 -0
  9. package/__tests__/components/__snapshots__/ConnectorLines.visualRegression.test.js.snap +7 -0
  10. package/__tests__/generateEventDocs.partials.test.js +134 -0
  11. package/__tests__/helpers/buildExampleFromSchema.test.js +49 -0
  12. package/__tests__/helpers/schemaToExamples.test.js +75 -0
  13. package/__tests__/helpers/schemaToTableData.battleTest.test.js +704 -0
  14. package/__tests__/helpers/schemaToTableData.hierarchicalLines.test.js +190 -7
  15. package/__tests__/helpers/schemaToTableData.test.js +263 -2
  16. package/__tests__/helpers/validator.test.js +6 -6
  17. package/__tests__/syncGtm.test.js +346 -0
  18. package/components/ConditionalRows.js +156 -0
  19. package/components/FoldableRows.js +88 -61
  20. package/components/PropertiesTable.js +1 -1
  21. package/components/PropertyRow.js +24 -8
  22. package/components/SchemaRows.css +115 -0
  23. package/components/SchemaRows.js +31 -4
  24. package/generateEventDocs.js +41 -34
  25. package/helpers/buildExampleFromSchema.js +11 -0
  26. package/helpers/continuingLinesStyle.js +169 -0
  27. package/helpers/schema-doc-template.js +2 -5
  28. package/helpers/schemaToExamples.js +75 -2
  29. package/helpers/schemaToTableData.js +252 -26
  30. package/helpers/update-schema-ids.js +3 -3
  31. package/helpers/validator.js +7 -19
  32. package/index.js +34 -0
  33. package/package.json +1 -1
  34. package/scripts/sync-gtm.js +397 -0
package/README.md CHANGED
@@ -73,6 +73,23 @@ npm run update-schema-ids
73
73
 
74
74
  This command will update the `$id` of all schemas in the versioned directories.
75
75
 
76
+ ### Sync GTM Variables (Optional)
77
+
78
+ If you use Google Tag Manager, you can sync Data Layer Variables from your schemas:
79
+
80
+ ```bash
81
+ npm install --save-optional @owntag/gtm-cli
82
+ npm run sync:gtm
83
+ ```
84
+
85
+ The Docusaurus CLI command is:
86
+
87
+ ```bash
88
+ docusaurus sync-gtm
89
+ ```
90
+
91
+ By default, it resolves schemas from the project root. Use `--path=<siteDir>` to target a different site directory.
92
+
76
93
  ## How it Works
77
94
 
78
95
  The plugin reads your JSON schemas, dereferences any `$ref` properties, and merges `allOf` properties. It then generates an MDX file for each schema, which uses custom React components to render the schema details.