Browse Source

chore(docs): Add MDX testing utilities

Add test:mdx script using @vendure-io/docs-provider/testing to validate
MDX files before publishing. This catches compilation errors early in
the development feedback loop.

- Add scripts/test-mdx.ts with testManifestMdx integration
- Add tsx dev dependency for running TypeScript scripts
- Update prepublishOnly to run MDX tests before build
David Höck 6 hours ago
parent
commit
092aeee8ff
4 changed files with 940 additions and 15 deletions
  1. 0 0
      docs/CLAUDE.md
  2. 908 12
      docs/package-lock.json
  3. 6 3
      docs/package.json
  4. 26 0
      docs/scripts/test-mdx.ts

+ 0 - 0
docs/CLAUDE.md


File diff suppressed because it is too large
+ 908 - 12
docs/package-lock.json


+ 6 - 3
docs/package.json

@@ -1,6 +1,6 @@
 {
     "name": "@vendure/docs",
-    "version": "0.0.0-202601211543",
+    "version": "0.0.0-202601211609",
     "type": "module",
     "main": "dist/index.js",
     "types": "dist/index.d.ts",
@@ -18,16 +18,19 @@
     ],
     "scripts": {
         "build": "rimraf dist && tsc -p ./tsconfig.build.json",
-        "prepublishOnly": "npm run build",
+        "prepublishOnly": "npm run test:mdx && npm run build",
         "publish:local": "npm version 0.0.0-$(date +%Y%m%d%H%M) --no-git-tag-version && npm publish",
         "publish:local:next": "npm version 0.0.0-$(date +%Y%m%d%H%M) --no-git-tag-version && npm publish --tag next",
+        "test:mdx": "tsx scripts/test-mdx.ts",
+        "test:mdx:verbose": "tsx scripts/test-mdx.ts --verbose",
         "typecheck": "tsc"
     },
     "dependencies": {
-        "@vendure-io/docs-provider": "^0.5.0"
+        "@vendure-io/docs-provider": "^0.7.0"
     },
     "devDependencies": {
         "rimraf": "^5.0.5",
+        "tsx": "^4.7.0",
         "typescript": "5.8.2"
     }
 }

+ 26 - 0
docs/scripts/test-mdx.ts

@@ -0,0 +1,26 @@
+import { manifest } from '../src/manifest';
+import {
+    testManifestMdx,
+    formatTestReport,
+    createProgressReporter,
+} from '@vendure-io/docs-provider/testing';
+
+async function main() {
+    console.log('Testing MDX files...\n');
+
+    const report = await testManifestMdx(manifest, {
+        onProgress: createProgressReporter(),
+    });
+
+    console.log('\n');
+    console.log(formatTestReport(report, process.argv.includes('--verbose')));
+
+    if (report.failed > 0) {
+        process.exit(1);
+    }
+}
+
+main().catch((error) => {
+    console.error('Test runner error:', error);
+    process.exit(1);
+});

Some files were not shown because too many files changed in this diff