// 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));
  tables[file] = table;
}
);

fs.writeFileSync(path.join(__dirname, 'tables.js'), `module.exports = ${JSON.stringify(tables, null, 2)};`);
console.log('Tables created');
