-
Notifications
You must be signed in to change notification settings - Fork 118
Expand file tree
/
Copy pathapps.ts
More file actions
55 lines (51 loc) · 1.16 KB
/
apps.ts
File metadata and controls
55 lines (51 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// List of all e2e tested apps
const apps = [
// examples
"create-next-app",
"middleware",
"playground14",
"playground15",
"playground16",
"vercel-blog-starter",
"ssg-app",
"prisma",
"next-partial-prerendering",
// e2e
"app-pages-router",
"app-router",
"pages-router",
"experimental",
// overrides
"d1-tag-next",
"kv-tag-next",
"memory-queue",
"r2-incremental-cache",
"static-assets-incremental-cache",
// bugs
"gh-119",
"gh-219",
"gh-223",
] as const;
export type AppName = (typeof apps)[number];
const BASE_WRANGLER_PORT = 8770;
const BASE_NEXT_PORT = 3100;
/**
* Returns a distinct port for each application so they can run in parallel.
*/
export function getAppPort(app: AppName, { isWorker = true } = {}): number {
const index = apps.indexOf(app);
if (index === -1) {
throw new Error(`Unknown app: ${app}`);
}
return isWorker ? BASE_WRANGLER_PORT + index : BASE_NEXT_PORT + index;
}
/**
* Returns a distinct port for each application so they can run in parallel.
*/
export function getInspectorPort(app: AppName): number {
const index = apps.indexOf(app);
if (index === -1) {
throw new Error(`Unknown app: ${app}`);
}
return 9300 + index;
}