Files
dwroller/scripts/copy-bestiary-live.js
Alex caf8a03553 feat: Add scripts for upserting and validating bestiary data
- Implemented `upsert-allewis-from-5001.js` to fetch and update Allewis data from API.
- Created `upsert-missing-movement-from-5001.js` to fill missing movement and wounds data from API.
- Developed `upsert-missing-movement-from-pdfs.js` to extract movement and wounds from PDF text.
- Added `upsert-missing-profiles-from-pdfs.js` to fill missing profiles from PDF data.
- Introduced `upsert-missing-wounds-from-pdfs.js` to update wounds data from PDF sources.
- Created `validate-bestiary.js` to validate the structure of the bestiary JSON.
- Updated `BestiaryTab.jsx` component to display bestiary data with improved structure and search functionality.
- Added tests for `BestiaryTab` to ensure proper rendering and functionality.
2025-08-17 16:21:00 +02:00

41 lines
1.1 KiB
JavaScript

#!/usr/bin/env node
const fs = require('fs');
const path = require('path');
// Simple script to copy bestiary from database to public for live updates
function copyBestiaryToPublic() {
const dbPath = path.join(__dirname, '../database/deathwatch-bestiary-extracted.json');
const publicPath = path.join(__dirname, '../public/deathwatch-bestiary-extracted.json');
const buildPath = path.join(__dirname, '../build/deathwatch-bestiary-extracted.json');
try {
if (!fs.existsSync(dbPath)) {
console.error('❌ Database bestiary file not found:', dbPath);
return false;
}
// Copy to public
fs.copyFileSync(dbPath, publicPath);
console.log('✅ Copied to public:', publicPath);
// Copy to build if it exists
if (fs.existsSync(path.dirname(buildPath))) {
fs.copyFileSync(dbPath, buildPath);
console.log('✅ Copied to build:', buildPath);
}
return true;
} catch (error) {
console.error('❌ Error copying bestiary files:', error.message);
return false;
}
}
// Run if called directly
if (require.main === module) {
copyBestiaryToPublic();
}
module.exports = { copyBestiaryToPublic };