Skip to content

Commit 54fdb10

Browse files
chore: render servers table in readme (#46)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent c99829e commit 54fdb10

File tree

14 files changed

+91
-9
lines changed

14 files changed

+91
-9
lines changed

.github/workflows/audits.yml

+2
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ jobs:
159159
uses: actions/download-artifact@v3
160160
with:
161161
name: audit-reports
162+
- name: Render servers table
163+
run: node scripts/render-servers-table.mjs
162164
- name: Diff
163165
run: git diff --minimal
164166
- name: Commit

README.md

+15-9
Original file line numberDiff line numberDiff line change
@@ -744,15 +744,21 @@ Having said this, graphql-http is mostly aimed for library authors and simple se
744744

745745
If you want a feature-full server with bleeding edge technologies, you're recommended to use one of the following.
746746

747-
| Name | Audit |
748-
| ------------------------------------------------------------------ | -------------------------------------------------------- |
749-
| [graphql-yoga](https://www.the-guild.dev/graphql/yoga-server) | [✅ Compliant](/implementations/graphql-yoga/README.md) |
750-
| [graphql-helix](https://www.graphql-helix.com/) | [✅ Compliant](/implementations/graphql-helix/README.md) |
751-
| [hotchocolate](https://chillicream.com/docs/hotchocolate) | [✅ Compliant](/implementations/hotchocolate/README.md) |
752-
| [pioneer](https://pioneer.dexclaimation.com/) | [✅ Compliant](/implementations/pioneer/README.md) |
753-
| [postgraphile](https://www.graphile.org/postgraphile/) | [✅ Compliant](/implementations/postgraphile/README.md) |
754-
| [apollo-server](https://www.apollographql.com/docs/apollo-server/) | [✅ Compliant](/implementations/apollo-server/README.md) |
755-
| [deno](https://deno.com/blog/build-a-graphql-server-with-deno) | [✅ Compliant](/implementations/deno/README.md) |
747+
<!-- <ServersTable> -->
748+
<!-- prettier-ignore-start -->
749+
| Name | Audit |
750+
|------|-------|
751+
| [apollo-server](https://www.apollographql.com/docs/apollo-server) | [✅ Compliant](/implementations/apollo-server/README.md) |
752+
| [deno](https://deno.com/blog/build-a-graphql-server-with-deno) | [✅ Compliant](/implementations/deno/README.md) |
753+
| [graph-client](https://github.com/graphprotocol/graph-client) | [✅ Compliant](/implementations/graph-client/README.md) |
754+
| [graphql-helix](https://www.graphql-helix.com) | [✅ Compliant](/implementations/graphql-helix/README.md) |
755+
| [graphql-yoga](https://www.the-guild.dev/graphql/yoga-server) | [✅ Compliant](/implementations/graphql-yoga/README.md) |
756+
| [hotchocolate](https://chillicream.com/docs/hotchocolate) | [✅ Compliant](/implementations/hotchocolate/README.md) |
757+
| [pioneer](https://pioneer.dexclaimation.com) | [✅ Compliant](/implementations/pioneer/README.md) |
758+
| [postgraphile](https://www.graphile.org/postgraphile) | [✅ Compliant](/implementations/postgraphile/README.md) |
759+
<!-- prettier-ignore-end -->
760+
761+
<!-- </ServersTable> -->
756762

757763
## [Documentation](docs/)
758764

implementations/apollo-server/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"private": true,
33
"name": "apollo-server",
4+
"url": "https://www.apollographql.com/docs/apollo-server",
45
"packageManager": "[email protected]",
56
"main": "index.mjs",
67
"scripts": {

implementations/deno/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"private": true,
33
"name": "deno",
4+
"url": "https://deno.com/blog/build-a-graphql-server-with-deno",
45
"packageManager": "[email protected]",
56
"scripts": {
67
"start": "docker compose up"

implementations/express-graphql/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"private": true,
33
"name": "express-graphql",
4+
"url": "https://github.com/graphql/express-graphql",
45
"packageManager": "[email protected]",
56
"main": "index.mjs",
67
"scripts": {

implementations/graph-client/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"private": true,
33
"name": "graph-client",
4+
"url": "https://github.com/graphprotocol/graph-client",
45
"packageManager": "[email protected]",
56
"main": "index.mjs",
67
"scripts": {

implementations/graphql-helix/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"private": true,
33
"name": "graphql-helix",
4+
"url": "https://www.graphql-helix.com",
45
"packageManager": "[email protected]",
56
"main": "index.mjs",
67
"scripts": {

implementations/graphql-yoga/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"private": true,
33
"name": "graphql-yoga",
4+
"url": "https://www.the-guild.dev/graphql/yoga-server",
45
"packageManager": "[email protected]",
56
"main": "index.mjs",
67
"scripts": {

implementations/hotchocolate/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"private": true,
33
"name": "hotchocolate",
4+
"url": "https://chillicream.com/docs/hotchocolate",
45
"packageManager": "[email protected]",
56
"scripts": {
67
"start": "docker compose up"

implementations/mercurius/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"private": true,
33
"name": "mercurius",
4+
"url": "https://mercurius.dev",
45
"packageManager": "[email protected]",
56
"main": "index.mjs",
67
"scripts": {

implementations/pioneer/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"private": true,
33
"name": "pioneer",
4+
"url": "https://pioneer.dexclaimation.com",
45
"packageManager": "[email protected]",
56
"scripts": {
67
"start": "docker compose up"

implementations/postgraphile/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"private": true,
33
"name": "postgraphile",
4+
"url": "https://www.graphile.org/postgraphile",
45
"packageManager": "[email protected]",
56
"scripts": {
67
"start": "docker compose up"

implementations/thegraph/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"private": true,
33
"name": "thegraph",
4+
"url": "https://thegraph.com/docs/en/",
45
"packageManager": "[email protected]"
56
}

scripts/render-servers-table.mjs

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
import fs from 'fs/promises';
2+
import path from 'path';
3+
4+
async function main() {
5+
const openMark = '<!-- <ServersTable> -->';
6+
const closeMark = '<!-- </ServersTable> -->';
7+
8+
let table = `${openMark}\n`;
9+
table += await renderTable('implementations');
10+
table += '\n'; // prettier would the new line here
11+
table += `\n${closeMark}`;
12+
13+
const readme = (await fs.readFile('README.md')).toString();
14+
15+
await fs.writeFile(
16+
'README.md',
17+
readme.replace(new RegExp(`${openMark}.+?${closeMark}`, 's'), table),
18+
);
19+
}
20+
21+
main().catch((err) => {
22+
console.error(err);
23+
process.exit(1);
24+
});
25+
26+
/** @param {string} implsDir */
27+
async function renderTable(implsDir) {
28+
let out = `<!-- prettier-ignore-start -->
29+
| Name | Audit |
30+
|------|-------|`;
31+
for (const implDir of (await fs.readdir(implsDir)).sort()) {
32+
/** @type {{ error: number }} */
33+
const report = JSON.parse(
34+
(
35+
await fs.readFile(path.join(implsDir, implDir, 'report.json'))
36+
).toString(),
37+
);
38+
if (report.error > 0) {
39+
continue;
40+
}
41+
42+
/** @type {Record<string, unknown>} */
43+
const pkg = JSON.parse(
44+
(
45+
await fs.readFile(path.join(implsDir, implDir, 'package.json'))
46+
).toString(),
47+
);
48+
if (pkg.name === 'express-graphql') {
49+
// deprecated
50+
continue;
51+
}
52+
53+
out += '\n';
54+
if (pkg.url) {
55+
out += `| [${pkg.name}](${pkg.url}) `;
56+
} else {
57+
out += `| ${pkg.name} `;
58+
}
59+
out += `| [✅ Compliant](/implementations/${implDir}/README.md) |`;
60+
}
61+
out += '\n<!-- prettier-ignore-end -->';
62+
return out;
63+
}

0 commit comments

Comments
 (0)