Skip to content

Commit ce51b27

Browse files
committed
apply prettier fixes
1 parent fd96319 commit ce51b27

File tree

588 files changed

+25174
-25174
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

588 files changed

+25174
-25174
lines changed

.changeset/config.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
{
2-
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3-
"changelog": [
4-
"@changesets/changelog-github",
5-
{
6-
"repo": "opennextjs/opennextjs-cloudflare"
7-
}
8-
],
9-
"commit": false,
10-
"fixed": [],
11-
"linked": [],
12-
"access": "public",
13-
"baseBranch": "main",
14-
"updateInternalDependencies": "patch",
15-
"ignore": [],
16-
"privatePackages": false
2+
"$schema": "https://unpkg.com/@changesets/[email protected]/schema.json",
3+
"changelog": [
4+
"@changesets/changelog-github",
5+
{
6+
"repo": "opennextjs/opennextjs-cloudflare"
7+
}
8+
],
9+
"commit": false,
10+
"fixed": [],
11+
"linked": [],
12+
"access": "public",
13+
"baseBranch": "main",
14+
"updateInternalDependencies": "patch",
15+
"ignore": [],
16+
"privatePackages": false
1717
}

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"editor.formatOnSave": true,
3-
"cSpell.words": ["nextjs"]
2+
"editor.formatOnSave": true,
3+
"cSpell.words": ["nextjs"]
44
}

benchmarking/package.json

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
{
2-
"name": "@opennextjs-cloudflare/benchmarking",
3-
"private": true,
4-
"type": "module",
5-
"devDependencies": {
6-
"tsx": "catalog:",
7-
"@tsconfig/strictest": "catalog:",
8-
"@types/node": "catalog:",
9-
"ora": "^8.1.0"
10-
},
11-
"scripts": {
12-
"benchmark": "tsx src/index.ts"
13-
}
2+
"name": "@opennextjs-cloudflare/benchmarking",
3+
"private": true,
4+
"type": "module",
5+
"devDependencies": {
6+
"tsx": "catalog:",
7+
"@tsconfig/strictest": "catalog:",
8+
"@types/node": "catalog:",
9+
"ora": "^8.1.0"
10+
},
11+
"scripts": {
12+
"benchmark": "tsx src/index.ts"
13+
}
1414
}

benchmarking/src/benchmarking.ts

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,26 @@ import nodePath from "node:path";
44
import { getPercentile } from "./utils";
55

66
export type FetchBenchmark = {
7-
iterationsMs: number[];
8-
averageMs: number;
9-
p90Ms: number;
7+
iterationsMs: number[];
8+
averageMs: number;
9+
p90Ms: number;
1010
};
1111

1212
export type BenchmarkingResults = {
13-
name: string;
14-
path: string;
15-
fetchBenchmark: FetchBenchmark;
13+
name: string;
14+
path: string;
15+
fetchBenchmark: FetchBenchmark;
1616
}[];
1717

1818
type BenchmarkFetchOptions = {
19-
numberOfIterations?: number;
20-
maxRandomDelayMs?: number;
21-
fetch: (deploymentUrl: string) => Promise<Response>;
19+
numberOfIterations?: number;
20+
maxRandomDelayMs?: number;
21+
fetch: (deploymentUrl: string) => Promise<Response>;
2222
};
2323

2424
const defaultOptions: Required<Omit<BenchmarkFetchOptions, "fetch">> = {
25-
numberOfIterations: 20,
26-
maxRandomDelayMs: 15_000,
25+
numberOfIterations: 20,
26+
maxRandomDelayMs: 15_000,
2727
};
2828

2929
/**
@@ -38,17 +38,17 @@ const defaultOptions: Required<Omit<BenchmarkFetchOptions, "fetch">> = {
3838
* @returns the benchmarking results for the application
3939
*/
4040
export async function benchmarkApplicationResponseTime({
41-
build,
42-
deploy,
43-
fetch,
41+
build,
42+
deploy,
43+
fetch,
4444
}: {
45-
build: () => Promise<void>;
46-
deploy: () => Promise<string>;
47-
fetch: (deploymentUrl: string) => Promise<Response>;
45+
build: () => Promise<void>;
46+
deploy: () => Promise<string>;
47+
fetch: (deploymentUrl: string) => Promise<Response>;
4848
}): Promise<FetchBenchmark> {
49-
await build();
50-
const deploymentUrl = await deploy();
51-
return benchmarkFetch(deploymentUrl, { fetch });
49+
await build();
50+
const deploymentUrl = await deploy();
51+
return benchmarkFetch(deploymentUrl, { fetch });
5252
}
5353

5454
/**
@@ -59,38 +59,38 @@ export async function benchmarkApplicationResponseTime({
5959
* @returns the computed average alongside all the single call times
6060
*/
6161
async function benchmarkFetch(url: string, options: BenchmarkFetchOptions): Promise<FetchBenchmark> {
62-
const benchmarkFetchCall = async () => {
63-
const preTimeMs = performance.now();
64-
const resp = await options.fetch(url);
65-
const postTimeMs = performance.now();
62+
const benchmarkFetchCall = async () => {
63+
const preTimeMs = performance.now();
64+
const resp = await options.fetch(url);
65+
const postTimeMs = performance.now();
6666

67-
if (!resp.ok) {
68-
throw new Error(`Error: Failed to fetch from "${url}"`);
69-
}
67+
if (!resp.ok) {
68+
throw new Error(`Error: Failed to fetch from "${url}"`);
69+
}
7070

71-
return postTimeMs - preTimeMs;
72-
};
71+
return postTimeMs - preTimeMs;
72+
};
7373

74-
const resolvedOptions = { ...defaultOptions, ...options };
74+
const resolvedOptions = { ...defaultOptions, ...options };
7575

76-
const iterationsMs = await Promise.all(
77-
new Array(resolvedOptions.numberOfIterations).fill(null).map(async () => {
78-
// let's add a random delay before we make the fetch
79-
await nodeTimesPromises.setTimeout(Math.round(Math.random() * resolvedOptions.maxRandomDelayMs));
76+
const iterationsMs = await Promise.all(
77+
new Array(resolvedOptions.numberOfIterations).fill(null).map(async () => {
78+
// let's add a random delay before we make the fetch
79+
await nodeTimesPromises.setTimeout(Math.round(Math.random() * resolvedOptions.maxRandomDelayMs));
8080

81-
return benchmarkFetchCall();
82-
})
83-
);
81+
return benchmarkFetchCall();
82+
})
83+
);
8484

85-
const averageMs = iterationsMs.reduce((time, sum) => sum + time) / iterationsMs.length;
85+
const averageMs = iterationsMs.reduce((time, sum) => sum + time) / iterationsMs.length;
8686

87-
const p90Ms = getPercentile(iterationsMs, 90);
87+
const p90Ms = getPercentile(iterationsMs, 90);
8888

89-
return {
90-
iterationsMs,
91-
averageMs,
92-
p90Ms,
93-
};
89+
return {
90+
iterationsMs,
91+
averageMs,
92+
p90Ms,
93+
};
9494
}
9595

9696
/**
@@ -100,18 +100,18 @@ async function benchmarkFetch(url: string, options: BenchmarkFetchOptions): Prom
100100
* @returns the path to the created json file
101101
*/
102102
export async function saveResultsToDisk(results: BenchmarkingResults): Promise<string> {
103-
const date = new Date();
103+
const date = new Date();
104104

105-
const fileName = `${toSimpleDateString(date)}.json`;
105+
const fileName = `${toSimpleDateString(date)}.json`;
106106

107-
const outputFile = nodePath.resolve(`./results/${fileName}`);
107+
const outputFile = nodePath.resolve(`./results/${fileName}`);
108108

109-
await nodeFsPromises.mkdir(nodePath.dirname(outputFile), { recursive: true });
109+
await nodeFsPromises.mkdir(nodePath.dirname(outputFile), { recursive: true });
110110

111-
const resultStr = JSON.stringify(results, null, 2);
112-
await nodeFsPromises.writeFile(outputFile, resultStr);
111+
const resultStr = JSON.stringify(results, null, 2);
112+
await nodeFsPromises.writeFile(outputFile, resultStr);
113113

114-
return outputFile;
114+
return outputFile;
115115
}
116116

117117
/**
@@ -125,8 +125,8 @@ export async function saveResultsToDisk(results: BenchmarkingResults): Promise<s
125125
* @returns a string representing the date
126126
*/
127127
function toSimpleDateString(date: Date): string {
128-
const isoString = date.toISOString();
129-
const isoDate = isoString.split(".")[0]!;
128+
const isoString = date.toISOString();
129+
const isoDate = isoString.split(".")[0]!;
130130

131-
return isoDate.replace("T", "_").replaceAll(":", "-");
131+
return isoDate.replace("T", "_").replaceAll(":", "-");
132132
}

0 commit comments

Comments
 (0)