Skip to content

Commit 695b5cc

Browse files
authored
1 parent f3d2a79 commit 695b5cc

File tree

10 files changed

+5170
-4175
lines changed

10 files changed

+5170
-4175
lines changed

build.ts

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { get, objectifiedTesters, escape } from "./utils.ts";
22
import { render } from "./template.ts";
33

4-
const results = {};
5-
const headers = {};
4+
const results: Record<string, any> = {};
5+
const headers: Record<string, any> = {};
66

77
const KEY = "result";
88

@@ -20,14 +20,14 @@ function result(nodeVersion: string, path: string): string {
2020
return '<div class="No">-</div>';
2121
}
2222

23-
const title =
24-
result === true
25-
? "Test passed"
26-
: typeof result === "string"
23+
const title = result === true
24+
? "Test passed"
25+
: typeof result === "string"
2726
? result
2827
: "Test failed";
29-
result =
30-
result === true ? "Yes" : typeof result === "string" ? "Error" : "No";
28+
result = result === true
29+
? "Yes"
30+
: typeof result === "string" ? "Error" : "No";
3131
return `<div class="${result}" title="${escape(title)}">${result}</div>`;
3232
}
3333

@@ -37,8 +37,8 @@ function percent(nodeVersion: string): number {
3737
}
3838

3939
function compare(x1: string, x2: string): number {
40-
const y1 = x1.split(".").map(x => parseInt(x));
41-
const y2 = x2.split(".").map(x => parseInt(x));
40+
const y1 = x1.split(".").map((x) => parseInt(x));
41+
const y2 = x2.split(".").map((x) => parseInt(x));
4242

4343
for (let i = 0; i < y1.length; i++) {
4444
if (y1[i] === y2[i]) {
@@ -53,23 +53,23 @@ function compare(x1: string, x2: string): number {
5353
return 0;
5454
}
5555

56-
export default function build() {
57-
const files = Deno.readDirSync("./result").filter(
58-
x => x.isFile() && x.name.substr(-5) === ".json"
56+
export default async function build() {
57+
const files = (await Deno.readdir("./result")).filter(
58+
(x) => x.isFile() && x.name!.substr(-5) === ".json",
5959
);
6060

61-
const versions = files.map(x => x.name.replace(/\.json/, ""));
61+
const versions = files.map((x) => x.name!.replace(/\.json/, ""));
6262

6363
versions.sort(compare);
6464

6565
for (const version of versions) {
66-
const content = Deno.readFileSync(`./result/${version}.json`);
66+
const content = await Deno.readFile(`./result/${version}.json`);
6767
results[version] = JSON.parse(decoder.decode(content));
6868
headers[version] = {
69-
version: results[version].version
69+
version: results[version].version,
7070
};
7171
}
7272

7373
const html = render({ headers, testers, result, percent });
74-
Deno.writeFileSync("./index.html", encoder.encode(html));
74+
await Deno.writeFile("./index.html", encoder.encode(html));
7575
}

index.html

Lines changed: 4726 additions & 3948 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)