()
| 118 | } |
| 119 | |
| 120 | async function getCommandList(): Promise<CommandInfo[]> { |
| 121 | const cmdsDir = path.join(SRC_ROOT, "commands"); |
| 122 | const entries = await fs.readdir(cmdsDir, { withFileTypes: true }); |
| 123 | const commands: CommandInfo[] = []; |
| 124 | for (const e of entries) { |
| 125 | if (e.isDirectory()) { |
| 126 | const files = await listDir(path.join(cmdsDir, e.name)); |
| 127 | commands.push({ |
| 128 | name: e.name, |
| 129 | path: `commands/${e.name}`, |
| 130 | isDirectory: true, |
| 131 | files, |
| 132 | }); |
| 133 | } else { |
| 134 | commands.push({ |
| 135 | name: e.name.replace(/\.(ts|tsx)$/, ""), |
| 136 | path: `commands/${e.name}`, |
| 137 | isDirectory: false, |
| 138 | }); |
| 139 | } |
| 140 | } |
| 141 | return commands.sort((a, b) => a.name.localeCompare(b.name)); |
| 142 | } |
| 143 | |
| 144 | // --------------------------------------------------------------------------- |
| 145 | // Server Factory |
no test coverage detected