Skip to content

Commit 85948b9

Browse files
committed
table: generate nicer table
1 parent dcddf02 commit 85948b9

File tree

4 files changed

+152
-1
lines changed

4 files changed

+152
-1
lines changed

.github/workflows/test-dev-e2e.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ jobs:
4747
jq -ns 'inputs' "$file" | node ../gateway-conformance/aggregate.js 1 > "${new_file}"
4848
done
4949
50-
node ../gateway-conformance/aggregate-into-table.js ./aggregates/*.json > ./table.md
50+
node ../gateway-conformance/aggregate-into-table.js ./aggregates/*.json > /tmp/table.md
51+
node ../gateway-conformance/aggregate-update-names.js ../gateway-conformance/names.json /tmp/table.md > ./table.md
5152
- name: Set summary
5253
if: (failure() || success())
5354
run: cat ./artifacts/table.md >> $GITHUB_STEP_SUMMARY

.github/workflows/test-prod-e2e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ jobs:
110110
done
111111
112112
node ../gateway-conformance/aggregate-into-table.js ./aggregates/*.json > ./table.md
113+
node ../gateway-conformance/aggregate-update-names.js ../gateway-conformance/names.json ./table.md > ./table.md
113114
- name: Set summary
114115
if: (failure() || success())
115116
run: cat ./artifacts/table.md >> $GITHUB_STEP_SUMMARY

aggregate-update-names.js

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
const fs = require('fs');
2+
3+
const jsonFilePath = process.argv[2];
4+
const markdownFilePath = process.argv[3];
5+
6+
// Check if file paths are provided
7+
if (!jsonFilePath || !markdownFilePath) {
8+
console.error('Both a JSON file path and a Markdown file path must be provided.');
9+
process.exit(1);
10+
}
11+
12+
const jsonData = JSON.parse(fs.readFileSync(jsonFilePath, 'utf8'));
13+
const sortedKeys = Object.keys(jsonData).sort((a, b) => b.length - a.length);
14+
15+
let markdown = fs.readFileSync(markdownFilePath, 'utf8');
16+
17+
for (const key of sortedKeys) {
18+
const newName = jsonData[key][1]
19+
? `[${jsonData[key][0]}](${jsonData[key][1]})`
20+
: jsonData[key][0];
21+
22+
const regex = new RegExp(key, 'g');
23+
markdown = markdown.replace(regex, newName);
24+
}
25+
26+
// output the new markdown to stdout
27+
fs.writeFileSync(1, markdown);

names.json

Lines changed: 122 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,122 @@
1+
{
2+
"Cors": [
3+
"Cross-Origin Resource Sharing",
4+
null
5+
],
6+
"DAgPbConversion": [
7+
"DAG Protobuf Conversion",
8+
null
9+
],
10+
"DNSLinkGateway": [
11+
"DNS Link Gateway",
12+
"https://specs.ipfs.tech/http-gateways/dnslink-gateway/"
13+
],
14+
"DNSLinkGatewayUnixFSDirectoryListing": [
15+
"DNS Link Gateway Unix FS Directory Listing",
16+
"https://specs.ipfs.tech/http-gateways/dnslink-gateway/"
17+
],
18+
"GatewayBlock": [
19+
"Gateway Block",
20+
null
21+
],
22+
"GatewayCache": [
23+
"Gateway Cache",
24+
null
25+
],
26+
"GatewayCacheWithIPNS": [
27+
"Gateway Cache with IPNS",
28+
null
29+
],
30+
"GatewayIPNSRecord": [
31+
"Gateway IPNS Record",
32+
null
33+
],
34+
"GatewayJSONCborAndIPNS": [
35+
"Gateway JSON CBOR and IPNS",
36+
null
37+
],
38+
"GatewayJsonCbor": [
39+
"Gateway JSON CBOR",
40+
null
41+
],
42+
"GatewaySubdomainAndIPNS": [
43+
"Gateway Subdomain and IPNS",
44+
null
45+
],
46+
"GatewaySubdomains": [
47+
"Gateway Subdomains",
48+
null
49+
],
50+
"GatewaySymlink": [
51+
"Gateway Symbolic Link",
52+
null
53+
],
54+
"NativeDag": [
55+
"Native DAG",
56+
null
57+
],
58+
"Pathing": [
59+
"Pathing",
60+
null
61+
],
62+
"PlainCodec": [
63+
"Plain Codec",
64+
null
65+
],
66+
"RedirectsFileSupport": [
67+
"Redirects File Support",
68+
"https://specs.ipfs.tech/http-gateways/web-redirects-file/"
69+
],
70+
"RedirectsFileSupportWithDNSLink": [
71+
"Redirects File Support with DNS Link",
72+
"https://specs.ipfs.tech/http-gateways/web-redirects-file/"
73+
],
74+
"SubdomainGatewayDNSLinkInlining": [
75+
"Subdomain Gateway DNS Link Inlining",
76+
null
77+
],
78+
"Tar": [
79+
"Tar",
80+
null
81+
],
82+
"TrustlessCarDagScopeAll": [
83+
"Trustless Car DAG Scope All",
84+
"https://specs.ipfs.tech/http-gateways/trustless-gateway/"
85+
],
86+
"TrustlessCarDagScopeBlock": [
87+
"Trustless Car DAG Scope Block",
88+
"https://specs.ipfs.tech/http-gateways/trustless-gateway/"
89+
],
90+
"TrustlessCarDagScopeEntity": [
91+
"Trustless Car DAG Scope Entity",
92+
"https://specs.ipfs.tech/http-gateways/trustless-gateway/"
93+
],
94+
"TrustlessCarEntityBytes": [
95+
"Trustless Car Entity Bytes",
96+
"https://specs.ipfs.tech/http-gateways/trustless-gateway/"
97+
],
98+
"TrustlessCarPathing": [
99+
"Trustless Car Pathing",
100+
"https://specs.ipfs.tech/http-gateways/trustless-gateway/"
101+
],
102+
"TrustlessRaw": [
103+
"Trustless Raw",
104+
"https://specs.ipfs.tech/http-gateways/trustless-gateway/"
105+
],
106+
"UnixFSDirectoryListing": [
107+
"Unix FS Directory Listing",
108+
null
109+
],
110+
"UnixFSDirectoryListingOnSubdomainGateway": [
111+
"Unix FS Directory Listing on Subdomain Gateway",
112+
null
113+
],
114+
"conformance-bifrost-gateway": [
115+
"Bifrost Gateway",
116+
"https://github.com/ipfs/bifrost-gateway"
117+
],
118+
"conformance-kubo-gateway": [
119+
"Kubo Gateway",
120+
"https://github.com/ipfs/kubo"
121+
]
122+
}

0 commit comments

Comments
 (0)