-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Fix using __dirname in the games_list.md generator tool
- Loading branch information
1 parent
371fad3
commit 4092fe3
Showing
2 changed files
with
26 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env node | ||
|
||
import * as fs from 'node:fs' | ||
import GameResolver from '../lib/GameResolver.js' | ||
import { fileURLToPath } from 'node:url' | ||
import { dirname } from 'node:path' | ||
|
||
const gameResolver = new GameResolver() | ||
|
||
const generated = gameResolver.printReadme() | ||
|
||
const __filename = fileURLToPath(import.meta.url) | ||
const __dirname = dirname(__filename) | ||
|
||
const readmeFilename = __dirname + '/../GAMES_LIST.md' | ||
const readme = fs.readFileSync(readmeFilename, { encoding: 'utf8' }) | ||
|
||
const markerTop = '<!--- BEGIN GENERATED GAMES -->' | ||
const markerBottom = '<!--- END GENERATED GAMES -->' | ||
|
||
let start = readme.indexOf(markerTop) | ||
start += markerTop.length | ||
const end = readme.indexOf(markerBottom) | ||
|
||
const updated = readme.substring(0, start) + '\n\n' + generated + '\n' + readme.substring(end) | ||
fs.writeFileSync(readmeFilename, updated) |
This file was deleted.
Oops, something went wrong.