MCPcopy Create free account
hub / github.com/BuilderIO/framework-benchmarks / preview

Function preview

src/helpers/preview.ts:4–22  ·  view source on GitHub ↗
(framework: string)

Source from the content-addressed store, hash-verified

2import { getPort } from './get-port.js';
3
4export 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}

Callers 6

measureFunction · 0.85
serve.tsFile · 0.85
measure-flow.tsFile · 0.85
measureFunction · 0.85
measureFunction · 0.85

Calls 1

getPortFunction · 0.85

Tested by

no test coverage detected