Parse critical tables
This commit is contained in:
20
module/criticals_data/create-js-table.js
Normal file
20
module/criticals_data/create-js-table.js
Normal file
@ -0,0 +1,20 @@
|
||||
// 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));
|
||||
console.log(`Processing ${file} ${table}`);
|
||||
//tables[file] = table;
|
||||
}
|
||||
);
|
||||
|
||||
//fs.writeFileSync(path.join(__dirname, 'tables.js'), `module.exports = ${JSON.stringify(tables, null, 2)};`);
|
||||
console.log('Tables created');a
|
Reference in New Issue
Block a user