feat(web): serve vehicle icons statically + deploy symlink + dev guard for logs/lang

This commit is contained in:
FURRO404
2026-06-18 00:38:00 -07:00
parent 49e75cc8f0
commit 177ddd408d
3 changed files with 63 additions and 0 deletions
+24
View File
@@ -348,6 +348,29 @@ function promoteBuiltDist() {
}
}
function syncVehicleIcons() {
// Point the served icon dir at the bot-managed SHARED/ICONS/VEHICLES so the
// scoreboard can render vehicle icons without bloating this repo. Symlink when
// possible; fall back to skipping (icons hide gracefully) if the source is absent.
const src = process.env.VEHICLE_ICONS_SRC || '/home/deploy/BOTS/SHARED/ICONS/VEHICLES'
const dst = path.resolve(
__dirname,
process.env.VEHICLE_ICONS_DIR || path.join('dist', 'vehicle-icons'),
)
if (!fs.existsSync(src)) {
console.warn(`vehicle icons source missing, skipping: ${src}`)
return
}
try {
fs.rmSync(dst, { recursive: true, force: true })
fs.mkdirSync(path.dirname(dst), { recursive: true })
fs.symlinkSync(src, dst)
console.log(`linked vehicle icons ${dst} -> ${src}`)
} catch (error) {
console.error(`vehicle icon sync failed: ${error.message}`)
}
}
function validateBuiltDist() {
const indexPath = path.join(NEXT_DIST_DIR, 'index.html')
if (!fs.existsSync(indexPath)) {
@@ -535,6 +558,7 @@ async function deploy(push) {
validateBuiltDist()
await run('cargo', ['build', '--manifest-path', 'backend/Cargo.toml', '--release'])
promoteBuiltDist()
syncVehicleIcons()
for (const target of RESTART_TARGETS) {
await run('pm2', ['reload', target, '--update-env'])