(args: string[])
| 23 | * directory. |
| 24 | */ |
| 25 | export async function openCommand(args: string[]): Promise<void> { |
| 26 | const filePath = args.find((a) => !a.startsWith("-")); |
| 27 | const mode = resolveOpenMode(args, process.env); |
| 28 | |
| 29 | let resolvedFile: string | undefined; |
| 30 | let allowRoot: string | undefined; |
| 31 | if (filePath) { |
| 32 | resolvedFile = path.resolve(process.cwd(), filePath); |
| 33 | allowRoot = path.dirname(resolvedFile); |
| 34 | } |
| 35 | |
| 36 | if (mode === "static") { |
| 37 | await openStatic(resolvedFile, allowRoot); |
| 38 | } else { |
| 39 | await openDev(resolvedFile, allowRoot); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * STATIC: serve the bundled SPA (`<pkg>/dist`, a sibling of this file's `dist-cli`) |
no test coverage detected