2014-10-29 08:02:03 +01:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2023-09-14 22:28:31 +02:00
|
|
|
import * as fs from 'fs';
|
|
|
|
import GameResolver from "../lib/GameResolver";
|
|
|
|
|
|
|
|
const gameResolver = new GameResolver();
|
2014-10-29 08:02:03 +01:00
|
|
|
|
2019-01-13 05:52:06 +01:00
|
|
|
const generated = gameResolver.printReadme();
|
2014-10-29 08:02:03 +01:00
|
|
|
|
2017-08-09 11:05:55 +02:00
|
|
|
const readmeFilename = __dirname+'/../README.md';
|
|
|
|
const readme = fs.readFileSync(readmeFilename, {encoding:'utf8'});
|
2014-10-29 08:02:03 +01:00
|
|
|
|
2017-08-09 11:05:55 +02:00
|
|
|
const marker_top = '<!--- BEGIN GENERATED GAMES -->';
|
|
|
|
const marker_bottom = '<!--- END GENERATED GAMES -->';
|
2014-10-29 08:02:03 +01:00
|
|
|
|
2017-08-09 11:05:55 +02:00
|
|
|
let start = readme.indexOf(marker_top);
|
2014-10-29 08:02:03 +01:00
|
|
|
start += marker_top.length;
|
2017-08-09 11:05:55 +02:00
|
|
|
const end = readme.indexOf(marker_bottom);
|
2014-10-29 08:02:03 +01:00
|
|
|
|
2023-09-13 16:31:58 +02:00
|
|
|
const updated = readme.substring(0,start)+"\n\n"+generated+"\n"+readme.substring(end);
|
2014-10-29 08:02:03 +01:00
|
|
|
fs.writeFileSync(readmeFilename, updated);
|