2014-10-29 08:02:03 +01:00
|
|
|
#!/usr/bin/env node
|
|
|
|
|
2017-08-09 11:05:55 +02:00
|
|
|
const fs = require('fs'),
|
2019-01-12 11:43:36 +01:00
|
|
|
TypeResolver = require('../lib/GameResolver');
|
2014-10-29 08:02:03 +01:00
|
|
|
|
2017-08-09 11:05:55 +02:00
|
|
|
const generated = TypeResolver.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
|
|
|
|
2017-08-09 11:05:55 +02:00
|
|
|
const updated = readme.substr(0,start)+"\n\n"+generated+"\n"+readme.substr(end);
|
2014-10-29 08:02:03 +01:00
|
|
|
fs.writeFileSync(readmeFilename, updated);
|