mirror of
https://github.com/gamedig/node-gamedig.git
synced 2024-11-18 01:30:39 +01:00
01794f6339
* Add missing CRLF line ending * Add support for running using deno Prefix node imports with "node:" and gate a socket API that is not implemented in [deno](https://deno.land) so that the library can be used there. This should not break node and doesn't in my brief testing.
21 lines
661 B
JavaScript
21 lines
661 B
JavaScript
#!/usr/bin/env node
|
|
|
|
import * as fs from 'node:fs'
|
|
import GameResolver from '../lib/GameResolver'
|
|
|
|
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)
|