mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-17 17:25:19 +01:00
21 lines
664 B
JavaScript
21 lines
664 B
JavaScript
#!/usr/bin/env node
|
|
|
|
import * as fs from 'node:fs'
|
|
import GameResolver from '../lib/GameResolver.js'
|
|
|
|
const gameResolver = new GameResolver()
|
|
|
|
const generated = gameResolver.printReadme()
|
|
|
|
const readmeFilename = __dirname + '/../README.md'
|
|
const readme = fs.readFileSync(readmeFilename, { encoding: 'utf8' })
|
|
|
|
const marker_top = '<!--- BEGIN GENERATED GAMES -->'
|
|
const marker_bottom = '<!--- END GENERATED GAMES -->'
|
|
|
|
let start = readme.indexOf(marker_top)
|
|
start += marker_top.length
|
|
const end = readme.indexOf(marker_bottom)
|
|
|
|
const updated = readme.substring(0, start) + '\n\n' + generated + '\n' + readme.substring(end)
|
|
fs.writeFileSync(readmeFilename, updated)
|