From 877f888c967bf4ce1e66d27dedd17d7aada5d7c5 Mon Sep 17 00:00:00 2001 From: Chris Wanstrath Date: Mon, 29 Sep 2025 22:08:39 -0700 Subject: [PATCH] games command --- bin/games.tsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 bin/games.tsx 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