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 <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-17 03:53:55 +00:00
1 parent 57ab57fb97
commit 5f35dde296
2 files changed
+43 -3

No files matched your search

+9 -3
View File
@@ -8,7 +8,8 @@ const __dirname = path.dirname(__filename);
const DIST_DIR = path.join(__dirname, 'dist'); const DIST_DIR = path.join(__dirname, 'dist');
const LANDING_SRC = path.join(__dirname, 'landing'); const LANDING_SRC = path.join(__dirname, 'landing');
const DASHBOARD_SRC = path.join(__dirname, 'dashboard'); 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 CONSTANTS_SRC = path.join(__dirname, 'src', 'constants.mjs');
const PROMPTS_SRC = path.join(__dirname, 'src', 'prompts', 'META_PROMPTS.md'); const PROMPTS_SRC = path.join(__dirname, 'src', 'prompts', 'META_PROMPTS.md');
const CONFIG_SRC = path.join(__dirname, 'torch-config.json'); 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.mkdirSync(distDashboard, { recursive: true });
fs.cpSync(DASHBOARD_SRC, 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'); const distDocs = path.join(DIST_DIR, 'src', 'docs');
fs.mkdirSync(distDocs, { recursive: true }); 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 // 3.5. Copy src/constants.mjs -> dist/src/constants.mjs
fs.copyFileSync(CONSTANTS_SRC, path.join(DIST_DIR, 'src', 'constants.mjs')); fs.copyFileSync(CONSTANTS_SRC, path.join(DIST_DIR, 'src', 'constants.mjs'));
+34
View File
@@ -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');
});
});