(argv: string[])
| 20 | const SUPPORTED_NODE_RANGE = ">=20.12 <27"; |
| 21 | |
| 22 | async function main(argv: string[]): Promise<void> { |
| 23 | assertSupportedNode(); |
| 24 | |
| 25 | const [rawCommand, ...args] = argv; |
| 26 | const command = normalizeCommand(rawCommand); |
| 27 | |
| 28 | switch (command) { |
| 29 | case "serve": |
| 30 | await ensureConfigured(); |
| 31 | await serve(); |
| 32 | return; |
| 33 | case "init": |
| 34 | await runInit({ force: args.includes("--force") }); |
| 35 | return; |
| 36 | case "doctor": |
| 37 | await runDoctor(); |
| 38 | return; |
| 39 | case "config": |
| 40 | runConfigCommand(args); |
| 41 | return; |
| 42 | case "help": |
| 43 | printHelp(); |
| 44 | return; |
| 45 | case "version": |
| 46 | printVersion(); |
| 47 | return; |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | function normalizeCommand(command: string | undefined): Command { |
| 52 | if (!command || command === "serve" || command === "start") return "serve"; |
no test coverage detected