From eeee5bc0aa6def96dcd592895c5a72c6f403a758 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Thu, 9 Apr 2026 08:20:01 -0700 Subject: [PATCH] Copy antipattern examples and browser detector to build output These self-contained HTML files and the detector script were served by the dev server from public/ but never made it into the Cloudflare Pages build directory, causing 404s on the deployed site. Co-Authored-By: Claude Opus 4.6 (1M context) --- scripts/build.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/scripts/build.js b/scripts/build.js index 621ca683a..53f506101 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -570,6 +570,20 @@ async function build() { } } + // Copy antipattern examples (self-contained HTML, not Bun entrypoints) + const examplesDir = path.join(ROOT_DIR, 'public', 'antipattern-examples'); + if (fs.existsSync(examplesDir)) { + copyDirSync(examplesDir, path.join(buildDir, 'antipattern-examples')); + } + + // Copy browser detector script (referenced by antipattern examples at /js/...) + const detectorSrc = path.join(ROOT_DIR, 'src', 'detect-antipatterns-browser.js'); + if (fs.existsSync(detectorSrc)) { + const jsDir = path.join(buildDir, 'js'); + fs.mkdirSync(jsDir, { recursive: true }); + fs.copyFileSync(detectorSrc, path.join(jsDir, 'detect-antipatterns-browser.js')); + } + // Read source files (unified skills architecture) const { skills } = readSourceFiles(ROOT_DIR); const patterns = readPatterns(ROOT_DIR);