mirror of
https://github.com/PR0M3TH3AN/TORCH.git
synced 2026-10-27 07:51:52 +00:00
fix(build): ensure agent roster and prompts are included in dist
The landing page (`landing/index.html`) relies on fetching `roster.json` and agent markdown files from `src/prompts/`. Previously, the build process did not copy these files to the `dist/` directory, causing 404 errors on the hosted landing page. This change: - Modifies `build.mjs` to recursively copy `src/prompts/` to `dist/src/prompts/`. - Updates `build.mjs` to replace `../src/prompts/` paths in `landing/index.html` with `src/prompts/` during the build, ensuring correct path resolution when served from `dist/`. - Removes the individual `META_PROMPTS.md` copy step as it is now covered by the directory copy. Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
1 parent
d290bf684d
commit
bbbe9980d7
1 file changed
+5
-4
@@ -12,7 +12,7 @@ const DASHBOARD_SRC = path.join(__dirname, 'dashboard');
|
||||
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 PROMPTS_DIR_SRC = path.join(__dirname, 'src', 'prompts');
|
||||
const CONFIG_SRC = path.join(__dirname, 'torch-config.json');
|
||||
const ASSETS_SRC = path.join(__dirname, 'assets');
|
||||
|
||||
@@ -36,6 +36,7 @@ distHtml = distHtml.replace(/"\.\.\/dashboard\/styles\.css"/g, '"dashboard/style
|
||||
distHtml = distHtml.replace(/"\.\.\/dashboard\/"/g, '"dashboard/"'); // Link to dashboard
|
||||
distHtml = distHtml.replace(/'\.\.\/src\/docs\/TORCH\.md'/g, "'src/docs/TORCH.md'");
|
||||
distHtml = distHtml.replace(/"\.\.\/assets\//g, '"assets/');
|
||||
distHtml = distHtml.replace(/\.\.\/src\/prompts\//g, 'src/prompts/');
|
||||
|
||||
// Inject Offline Bundle Filename
|
||||
distHtml = distHtml.replace(/{{OFFLINE_BUNDLE_FILENAME}}/g, tarballName);
|
||||
@@ -60,11 +61,11 @@ if (fs.existsSync(TORCH_MD_SRC)) {
|
||||
// 3.5. Copy src/constants.mjs -> dist/src/constants.mjs
|
||||
fs.copyFileSync(CONSTANTS_SRC, path.join(DIST_DIR, 'src', 'constants.mjs'));
|
||||
|
||||
// 4. Copy src/prompts/META_PROMPTS.md -> dist/src/prompts/META_PROMPTS.md
|
||||
// 4. Copy src/prompts/ -> dist/src/prompts/
|
||||
const distPromptsDir = path.join(DIST_DIR, 'src', 'prompts');
|
||||
fs.mkdirSync(distPromptsDir, { recursive: true });
|
||||
if (fs.existsSync(PROMPTS_SRC)) {
|
||||
fs.copyFileSync(PROMPTS_SRC, path.join(distPromptsDir, 'META_PROMPTS.md'));
|
||||
if (fs.existsSync(PROMPTS_DIR_SRC)) {
|
||||
fs.cpSync(PROMPTS_DIR_SRC, distPromptsDir, { recursive: true });
|
||||
}
|
||||
|
||||
// 5. Copy torch-config.json -> dist/torch-config.json (optional config)
|
||||
|
||||
Reference in new issue
Block a user