2024-08-15 22:25:07 +02:00
|
|
|
// 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-08-15 22:25:07 +02:00
|
|
|
}
|
|
|
|
);
|
|
|
|
|
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
|