From 5f35dde2960e1e4761273139fb93481d32a4ce81 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 17 Feb 2026 03:53:55 +0000 Subject: [PATCH] Fix dashboard build failure and missing documentation - Updated `build.mjs` to correctly source `TORCH.md` and `docs/` from the project root instead of the non-existent `src/docs/`. - Ensured `TORCH.md` is copied to `dist/src/docs/TORCH.md` as expected by the dashboard's fetch logic. - Added `test/build_verification.test.mjs` to prevent regressions by verifying the presence of critical build artifacts (`TORCH.md`, assets, dashboard). - Verified dashboard functionality (logos, settings modal) using a temporary Playwright script. Co-authored-by: PR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> --- build.mjs | 12 ++++++++--- test/build_verification.test.mjs | 34 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 3 deletions(-) create mode 100644 test/build_verification.test.mjs diff --git a/build.mjs b/build.mjs index b45245e..72c5e53 100644 --- a/build.mjs +++ b/build.mjs @@ -8,7 +8,8 @@ const __dirname = path.dirname(__filename); const DIST_DIR = path.join(__dirname, 'dist'); const LANDING_SRC = path.join(__dirname, 'landing'); const DASHBOARD_SRC = path.join(__dirname, 'dashboard'); -const DOCS_SRC = path.join(__dirname, 'src', 'docs'); +const DOCS_SRC = path.join(__dirname, 'docs'); +const TORCH_MD_SRC = path.join(__dirname, 'TORCH.md'); const CONSTANTS_SRC = path.join(__dirname, 'src', 'constants.mjs'); const PROMPTS_SRC = path.join(__dirname, 'src', 'prompts', 'META_PROMPTS.md'); const CONFIG_SRC = path.join(__dirname, 'torch-config.json'); @@ -38,10 +39,15 @@ const distDashboard = path.join(DIST_DIR, 'dashboard'); fs.mkdirSync(distDashboard, { recursive: true }); fs.cpSync(DASHBOARD_SRC, distDashboard, { recursive: true }); -// 3. Copy src/docs/ -> dist/src/docs/ +// 3. Copy docs/ -> dist/src/docs/ const distDocs = path.join(DIST_DIR, 'src', 'docs'); fs.mkdirSync(distDocs, { recursive: true }); -fs.cpSync(DOCS_SRC, distDocs, { recursive: true }); +if (fs.existsSync(DOCS_SRC)) { + fs.cpSync(DOCS_SRC, distDocs, { recursive: true }); +} +if (fs.existsSync(TORCH_MD_SRC)) { + fs.copyFileSync(TORCH_MD_SRC, path.join(distDocs, 'TORCH.md')); +} // 3.5. Copy src/constants.mjs -> dist/src/constants.mjs fs.copyFileSync(CONSTANTS_SRC, path.join(DIST_DIR, 'src', 'constants.mjs')); diff --git a/test/build_verification.test.mjs b/test/build_verification.test.mjs new file mode 100644 index 0000000..6a90043 --- /dev/null +++ b/test/build_verification.test.mjs @@ -0,0 +1,34 @@ +import fs from 'fs'; +import path from 'path'; +import { test } from 'node:test'; +import assert from 'node:assert'; + +const DIST_DIR = path.resolve('dist'); + +test('Build artifacts verification', async (t) => { + await t.test('dist directory exists', () => { + assert.strictEqual(fs.existsSync(DIST_DIR), true, 'dist directory should exist'); + }); + + await t.test('Critical files exist in dist', () => { + const criticalFiles = [ + 'index.html', + 'dashboard/index.html', + 'src/docs/TORCH.md', + 'assets/logo.svg', + 'src/constants.mjs', + 'src/prompts/META_PROMPTS.md' + ]; + + criticalFiles.forEach(file => { + const filePath = path.join(DIST_DIR, file); + assert.strictEqual(fs.existsSync(filePath), true, `File ${file} should exist in dist`); + }); + }); + + await t.test('TORCH.md content is not empty', () => { + const torchMdPath = path.join(DIST_DIR, 'src/docs/TORCH.md'); + const content = fs.readFileSync(torchMdPath, 'utf8'); + assert.ok(content.length > 0, 'TORCH.md should not be empty'); + }); +});