Browse Source

chore(docs): Add admonition syntax validation to MDX tests

Update test-mdx.ts to validate admonition syntax using the new
validateAdmonitions utility from @vendure-io/docs-provider v0.9.0.
The test now checks for invalid space-separated labels before
running MDX compilation.
David Höck 13 hours ago
parent
commit
0fab1df149
3 changed files with 30 additions and 9 deletions
  1. 6 6
      docs/package-lock.json
  2. 2 2
      docs/package.json
  3. 22 1
      docs/scripts/test-mdx.ts

+ 6 - 6
docs/package-lock.json

@@ -1,14 +1,14 @@
 {
     "name": "@vendure/docs",
-    "version": "0.0.0-202601221213",
+    "version": "0.0.0-202601271334",
     "lockfileVersion": 3,
     "requires": true,
     "packages": {
         "": {
             "name": "@vendure/docs",
-            "version": "0.0.0-202601221213",
+            "version": "0.0.0-202601271334",
             "dependencies": {
-                "@vendure-io/docs-provider": "^0.8.2"
+                "@vendure-io/docs-provider": "^0.9.0"
             },
             "devDependencies": {
                 "rimraf": "^5.0.5",
@@ -591,9 +591,9 @@
             "license": "ISC"
         },
         "node_modules/@vendure-io/docs-provider": {
-            "version": "0.8.2",
-            "resolved": "https://registry.npmjs.org/@vendure-io/docs-provider/-/docs-provider-0.8.2.tgz",
-            "integrity": "sha512-UczT4Fv/m9y4bYJyC7PnRXQnbu7Me6s8/cjYQ3XuTxVAyeUGZymBFeG4BZIe9AI8GziGiQJJwNIYeyyJfHajJA==",
+            "version": "0.9.0",
+            "resolved": "https://registry.npmjs.org/@vendure-io/docs-provider/-/docs-provider-0.9.0.tgz",
+            "integrity": "sha512-GlcgXqaI/zYR8mF/dGT5Dpm6y81J12hk0EVPHXHktfDyBq+/BYICQLmYMERFut61ZcBwVFr5UTZ8K0oQxqj66Q==",
             "license": "MIT",
             "dependencies": {
                 "@mdx-js/mdx": "^3.0.0",

+ 2 - 2
docs/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@vendure/docs",
-    "version": "0.0.0-202601221213",
+    "version": "0.0.0-202601271334",
     "type": "module",
     "main": "dist/index.js",
     "types": "dist/index.d.ts",
@@ -29,7 +29,7 @@
         "typecheck": "tsc --noEmit"
     },
     "dependencies": {
-        "@vendure-io/docs-provider": "^0.8.2"
+        "@vendure-io/docs-provider": "^0.9.0"
     },
     "devDependencies": {
         "rimraf": "^5.0.5",

+ 22 - 1
docs/scripts/test-mdx.ts

@@ -3,9 +3,26 @@ import {
     testManifestMdx,
     formatTestReport,
     createProgressReporter,
+    validateAdmonitions,
+    formatAdmonitionReport,
 } from '@vendure-io/docs-provider/testing';
 
 async function main() {
+    const verbose = process.argv.includes('--verbose');
+    let hasErrors = false;
+
+    // Validate admonition syntax
+    console.log('Validating admonition syntax...\n');
+    const admonitionReport = validateAdmonitions(manifest);
+
+    if (admonitionReport.errors.length > 0) {
+        console.log(formatAdmonitionReport(admonitionReport));
+        hasErrors = true;
+    } else {
+        console.log(`✓ All admonitions valid (${admonitionReport.filesScanned} files scanned)\n`);
+    }
+
+    // Test MDX compilation
     console.log('Testing MDX files...\n');
 
     const report = await testManifestMdx(manifest, {
@@ -13,9 +30,13 @@ async function main() {
     });
 
     console.log('\n');
-    console.log(formatTestReport(report, process.argv.includes('--verbose')));
+    console.log(formatTestReport(report, verbose));
 
     if (report.failed > 0) {
+        hasErrors = true;
+    }
+
+    if (hasErrors) {
         process.exit(1);
     }
 }