mirror of
https://github.com/badlogic/heissepreise.git
synced 2024-06-29 20:05:51 +02:00
25 lines
621 B
JavaScript
25 lines
621 B
JavaScript
const fs = require("fs");
|
|
const analysis = require("./analysis.js");
|
|
|
|
if (process.argv.length < 3) {
|
|
console.log("Usage: node pages.js <data-dir>");
|
|
console.log()
|
|
console.log("e.g. node pages.js data/");
|
|
console.log()
|
|
process.exit(1);
|
|
}
|
|
const dataDir = process.argv[2];
|
|
|
|
if (!fs.existsSync(dataDir)) {
|
|
fs.mkdirSync(dataDir);
|
|
}
|
|
|
|
(async function () {
|
|
try {
|
|
await analysis.updateData(dataDir);
|
|
console.log(`Wrote ${JSON.parse(fs.readFileSync(`${dataDir}/latest-canonical.json`)).length} to ${dataDir}/latest-canonical.json`);
|
|
} catch(e) {
|
|
process.exit(1);
|
|
}
|
|
})();
|