fvtt-rolemaster-frp/module/criticals_data/create-js-table.js

21 lines
731 B
JavaScript
Raw Normal View History

// Parse all the JSON files in the tables directory and create a JS file with the tables
// Create on one object per table with file name as ket and the table data in a field table
// This is a one-time script to create the tables.js file
// Run this script with `node create-js-table.js`
const fs = require('fs');
const path = require('path');
const tablesDir = path.join(__dirname, './');
const tables = {};
fs.readdirSync(tablesDir).forEach(file => {
const table = require(path.join(tablesDir, file));
2024-10-20 18:21:19 +02:00
console.log(`Processing ${file} ${table}`);
//tables[file] = table;
}
);
2024-10-20 18:21:19 +02:00
//fs.writeFileSync(path.join(__dirname, 'tables.js'), `module.exports = ${JSON.stringify(tables, null, 2)};`);
console.log('Tables created');a