mirror of
https://github.com/tribufu/node-gamedig
synced 2026-05-06 07:07:33 +00:00
chore: Move the gen readme in a separate folder than bin
This commit is contained in:
parent
17c351fb4b
commit
3a1950133d
2 changed files with 3 additions and 1 deletions
2
tools/README.md
Normal file
2
tools/README.md
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
This folder is not really intended to be used by users.
|
||||
Contains helpers for certain stuff (such as generating the games list Markdown table).
|
||||
21
tools/genreadme.js
Normal file
21
tools/genreadme.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#!/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)
|
||||
Loading…
Add table
Add a link
Reference in a new issue