diff --git a/bin/games.tsx b/bin/games.tsx new file mode 100644 index 0000000..4bc18d4 --- /dev/null +++ b/bin/games.tsx @@ -0,0 +1,20 @@ +// List all the games installed on the system. + +import { readdirSync } from "fs" +import { join } from "path" +import { NOSE_SYS_BIN } from "@/config" + +export default async function () { + let games = await Promise.all(readdirSync(NOSE_SYS_BIN, { withFileTypes: true }).map(async file => { + if (!file.isFile()) return + + const code = await Bun.file(join(NOSE_SYS_BIN, file.name)).text() + + if (/^export const game\s*=\s*true\s*;?\s*$/m.test(code)) + return file.name.replace(".tsx", "").replace(".ts", "") + })).then(games => games.filter(file => file)) + + return <> + {games.map(game => {game})} + +} \ No newline at end of file