(framework: string)
| 2 | import { getPort } from './get-port.js'; |
| 3 | |
| 4 | export async function preview(framework: string) { |
| 5 | const port = await getPort(framework); |
| 6 | if (!port) { |
| 7 | throw new Error( |
| 8 | `Could not find port for ${framework}, be sure to add it to package.json like: "port": 8080` |
| 9 | ); |
| 10 | } |
| 11 | |
| 12 | const useBun = framework.endsWith('-bun'); |
| 13 | |
| 14 | const process = $`cd frameworks/${framework} && ${ |
| 15 | useBun ? 'bun' : 'npm' |
| 16 | } run preview`; |
| 17 | |
| 18 | return { |
| 19 | process, |
| 20 | port, |
| 21 | }; |
| 22 | } |
no test coverage detected