Skip to content

Commit 351894e

Browse files
authored
Add “used by” to docs (#1110)
1 parent ae7a4f3 commit 351894e

File tree

9 files changed

+136
-104
lines changed

9 files changed

+136
-104
lines changed

docs/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
"version": "0.0.0",
44
"type": "module",
55
"scripts": {
6-
"build": "astro build",
7-
"dev": "astro dev"
6+
"build": "npm run update-contributors && astro build",
7+
"dev": "npm run update-contributors && astro dev",
8+
"update-contributors": "node scripts/update-contributors.js"
89
},
910
"dependencies": {
1011
"@algolia/client-search": "^4.17.0",

docs/scripts/update-contributors.js

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
import fs from "node:fs";
2+
import { URL } from "node:url";
3+
4+
const AVATAR_RE = /property="og:image" content="([^"]+)/;
5+
6+
async function fetchAvatar(username) {
7+
const res = await fetch(`https://github.com/${username}`);
8+
if (!res.ok) throw new Error(`${res.url} responded with ${res.status}`);
9+
const body = await res.text();
10+
const match = body.match(AVATAR_RE);
11+
if (!match) throw new Error(`Could not find avatar for ${username}`);
12+
return match[1];
13+
}
14+
15+
const OPENAPI_TS_CONTRIBUTORS = [
16+
...new Set([
17+
"drwpow",
18+
"psmyrdek",
19+
"enmand",
20+
"atlefren",
21+
"tpdewolf",
22+
"tombarton",
23+
"svnv",
24+
"sorin-davidoi",
25+
"scvnathan",
26+
"lbenie",
27+
"bokub",
28+
"antonk52",
29+
"tshelburne",
30+
"mmiszy",
31+
"skh-",
32+
"BlooJeans",
33+
"selbekk",
34+
"Mause",
35+
"henhal",
36+
"gr2m",
37+
"samdbmg",
38+
"rendall",
39+
"robertmassaioli",
40+
"jankuca",
41+
"th-m",
42+
"asithade",
43+
"MikeYermolayev",
44+
"radist2s",
45+
"FedeBev",
46+
"yamacent",
47+
"dnalborczyk",
48+
"FabioWanner",
49+
"ashsmith",
50+
"mehalter",
51+
"Chrg1001",
52+
"sharmarajdaksh",
53+
"shuluster",
54+
"FDiskas",
55+
"ericzorn93",
56+
"mbelsky",
57+
"Peteck",
58+
"rustyconover",
59+
"bunkscene",
60+
"ottomated",
61+
"sadfsdfdsa",
62+
"ajaishankar",
63+
"dominikdosoudil",
64+
"kgtkr",
65+
"berzi",
66+
"PhilipTrauner",
67+
"Powell-v2",
68+
"duncanbeevers",
69+
"tkukushkin",
70+
"Semigradsky",
71+
"MrLeebo",
72+
"axelhzf",
73+
"imagoiq",
74+
"BTMPL",
75+
"HiiiiD",
76+
"yacinehmito",
77+
"sajadtorkamani",
78+
"mvdbeek",
79+
"sgrimm",
80+
"Swiftwork",
81+
"mtth",
82+
"mitchell-merry",
83+
"qnp",
84+
"shoffmeister",
85+
"liangskyli",
86+
"happycollision",
87+
]),
88+
];
89+
90+
export const OPENAPI_FETCH_CONTRIBUTORS = [...new Set(["drwpow", "fergusean", "shinzui", "ezpuzz", "KotoriK", "fletchertyler914", "nholik", "roj1512", "nickcaballero"])];
91+
92+
async function main() {
93+
const openapiTS = Promise.all(OPENAPI_TS_CONTRIBUTORS.map(async (username) => ({ username, avatar: await fetchAvatar(username) })));
94+
const openapiFetch = Promise.all(OPENAPI_FETCH_CONTRIBUTORS.map(async (username) => ({ username, avatar: await fetchAvatar(username) })));
95+
const contributors = {
96+
"openapi-typescript": await openapiTS,
97+
"openapi-fetch": await openapiFetch,
98+
};
99+
fs.writeFileSync(new URL("../src/data/contributors.json", import.meta.url), JSON.stringify(contributors));
100+
}
101+
102+
main();

docs/src/components/Contributors.astro

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,19 @@
22
import { fetchAvatar } from "../lib/github.js";
33
44
export type Props = {
5-
usernames: string[];
5+
contributors: { username: string; avatar: string }[];
66
};
77
8-
const { usernames = [] } = Astro.props;
9-
const avatars = await Promise.all(usernames.map(fetchAvatar));
8+
const { contributors = [] } = Astro.props;
109
---
1110

1211
<ul class="wrapper">
1312
{
14-
usernames.map((user, i) => (
13+
contributors.map(({ username, avatar }) => (
1514
<li class="contributor">
16-
<a href={`https://github.com/${user}`} target="_blank" rel="noopener noreferrer" class="link">
17-
<img class="avatar" src={avatars[i]} alt={user} />
18-
{user}
15+
<a href={`https://github.com/${username}`} target="_blank" rel="noopener noreferrer" class="link">
16+
<img class="avatar" src={avatar} alt={username} />
17+
{username}
1918
</a>
2019
</li>
2120
))

docs/src/consts.ts

Lines changed: 0 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -16,82 +16,3 @@ export const KNOWN_LANGUAGES = {
1616
English: "en",
1717
} as const;
1818
export const KNOWN_LANGUAGE_CODES = Object.values(KNOWN_LANGUAGES);
19-
20-
export const OPENAPI_TS_CONTRIBUTORS = [
21-
...new Set([
22-
"drwpow",
23-
"psmyrdek",
24-
"enmand",
25-
"atlefren",
26-
"tpdewolf",
27-
"tombarton",
28-
"svnv",
29-
"sorin-davidoi",
30-
"scvnathan",
31-
"lbenie",
32-
"bokub",
33-
"antonk52",
34-
"tshelburne",
35-
"mmiszy",
36-
"skh-",
37-
"BlooJeans",
38-
"selbekk",
39-
"Mause",
40-
"henhal",
41-
"gr2m",
42-
"samdbmg",
43-
"rendall",
44-
"robertmassaioli",
45-
"jankuca",
46-
"th-m",
47-
"asithade",
48-
"MikeYermolayev",
49-
"radist2s",
50-
"FedeBev",
51-
"yamacent",
52-
"dnalborczyk",
53-
"FabioWanner",
54-
"ashsmith",
55-
"mehalter",
56-
"Chrg1001",
57-
"sharmarajdaksh",
58-
"shuluster",
59-
"FDiskas",
60-
"ericzorn93",
61-
"mbelsky",
62-
"Peteck",
63-
"rustyconover",
64-
"bunkscene",
65-
"ottomated",
66-
"sadfsdfdsa",
67-
"ajaishankar",
68-
"dominikdosoudil",
69-
"kgtkr",
70-
"berzi",
71-
"PhilipTrauner",
72-
"Powell-v2",
73-
"duncanbeevers",
74-
"tkukushkin",
75-
"Semigradsky",
76-
"MrLeebo",
77-
"axelhzf",
78-
"imagoiq",
79-
"BTMPL",
80-
"HiiiiD",
81-
"yacinehmito",
82-
"sajadtorkamani",
83-
"mvdbeek",
84-
"sgrimm",
85-
"Swiftwork",
86-
"mtth",
87-
"mitchell-merry",
88-
"qnp",
89-
"shoffmeister",
90-
"liangskyli",
91-
"happycollision",
92-
]),
93-
];
94-
95-
export const OPENAPI_FETCH_CONTRIBUTORS = [
96-
...new Set(["drwpow", "fergusean", "shinzui", "ezpuzz", "KotoriK", "fletchertyler914", "nholik", "roj1512"]),
97-
];

docs/src/content/docs/about.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,24 @@ title: About
33
description: Additional info about this project
44
---
55

6-
## Project Goals
6+
## Used by
7+
8+
- [**Bigcommerce**](https://github.com/bigcommerce/bigcommerce-api-node): Node SDK for the BigCommerce API
9+
- [**Budibase**](https://github.com/Budibase/budibase): low code platform for creating internal tools, workflows, and admin panels
10+
- [**Fedora `fmn`**](https://github.com/fedora-infra/fmn): tools and APIs for Fedora’s messaging infra
11+
- [**Fingerprint**](https://github.com/fingerprintjs/fingerprintjs-pro-server-api-node-sdk): device fingerprinting for high-scale applications
12+
- [**Google Firebase CLI**](https://github.com/firebase/firebase-tools): Official CLI for Google’s Firebase platform
13+
- [**GitHub Octokit**](https://github.com/octokit): Official SDK for the GitHub API
14+
- [**Lotus**](https://github.com/uselotus/lotus): open source pricing & packaging infra
15+
- [**Jitsu**](https://github.com/jitsucom/jitsu): modern, open source data ingestion / data pipelines
16+
- [**Medusa**](https://github.com/medusajs/medusa): building blocks for digital commerce
17+
- [**Nitro engine**](https://github.com/unjs/nitro): universal web server engine that powers Nuxt
18+
- [**Relevance AI**](https://github.com/RelevanceAI/relevance-js-sdk): build and deploy AI chains
19+
- [**Revolt**](https://github.com/revoltchat/api): open source user-first chat platform
20+
- [**Spacebar**](https://github.com/spacebarchat): a free, open source, self-hostable Discord-compatible chat/voice/video platform
21+
- [**Twitter API**](https://github.com/twitterdev/twitter-api-typescript-sdk): Official SDK for the Twitter API
22+
23+
## Project goals
724

825
1. Support converting any valid OpenAPI schema to TypeScript types, no matter how complicated.
926
1. This library does **NOT** validate your schema, there are other libraries for that.

docs/src/content/docs/introduction.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ This library requires the latest version of <a href="https://nodejs.org/en" targ
3131
npm i -D openapi-typescript
3232
```
3333

34-
## Basic Usage
34+
## Basic usage
3535

3636
First, generate a local type file by running `npx openapi-typescript`:
3737

docs/src/data/contributors.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"openapi-typescript":[{"username":"drwpow","avatar":"https://avatars.githubusercontent.com/u/1369770?v=4?s=400"},{"username":"psmyrdek","avatar":"https://avatars.githubusercontent.com/u/6187417?v=4?s=400"},{"username":"enmand","avatar":"https://avatars.githubusercontent.com/u/432487?v=4?s=400"},{"username":"atlefren","avatar":"https://avatars.githubusercontent.com/u/1829927?v=4?s=400"},{"username":"tpdewolf","avatar":"https://avatars.githubusercontent.com/u/4455209?v=4?s=400"},{"username":"tombarton","avatar":"https://avatars.githubusercontent.com/u/6222711?v=4?s=400"},{"username":"svnv","avatar":"https://avatars.githubusercontent.com/u/1080888?v=4?s=400"},{"username":"sorin-davidoi","avatar":"https://avatars.githubusercontent.com/u/2109702?v=4?s=400"},{"username":"scvnathan","avatar":"https://avatars.githubusercontent.com/u/73474?v=4?s=400"},{"username":"lbenie","avatar":"https://avatars.githubusercontent.com/u/7316046?v=4?s=400"},{"username":"bokub","avatar":"https://avatars.githubusercontent.com/u/17952318?v=4?s=400"},{"username":"antonk52","avatar":"https://avatars.githubusercontent.com/u/5817809?v=4?s=400"},{"username":"tshelburne","avatar":"https://avatars.githubusercontent.com/u/1202267?v=4?s=400"},{"username":"mmiszy","avatar":"https://avatars.githubusercontent.com/u/1338731?v=4?s=400"},{"username":"skh-","avatar":"https://avatars.githubusercontent.com/u/1292598?v=4?s=400"},{"username":"BlooJeans","avatar":"https://avatars.githubusercontent.com/u/1751182?v=4?s=400"},{"username":"selbekk","avatar":"https://avatars.githubusercontent.com/u/1307267?v=4?s=400"},{"username":"Mause","avatar":"https://avatars.githubusercontent.com/u/1405026?v=4?s=400"},{"username":"henhal","avatar":"https://avatars.githubusercontent.com/u/9608258?v=4?s=400"},{"username":"gr2m","avatar":"https://avatars.githubusercontent.com/u/39992?v=4?s=400"},{"username":"samdbmg","avatar":"https://avatars.githubusercontent.com/u/408983?v=4?s=400"},{"username":"rendall","avatar":"https://avatars.githubusercontent.com/u/293263?v=4?s=400"},{"username":"robertmassaioli","avatar":"https://avatars.githubusercontent.com/u/149178?v=4?s=400"},{"username":"jankuca","avatar":"https://avatars.githubusercontent.com/u/367262?v=4?s=400"},{"username":"th-m","avatar":"https://avatars.githubusercontent.com/u/13792029?v=4?s=400"},{"username":"asithade","avatar":"https://avatars.githubusercontent.com/u/3814354?v=4?s=400"},{"username":"MikeYermolayev","avatar":"https://avatars.githubusercontent.com/u/8783498?v=4?s=400"},{"username":"radist2s","avatar":"https://avatars.githubusercontent.com/u/725645?v=4?s=400"},{"username":"FedeBev","avatar":"https://avatars.githubusercontent.com/u/22151395?v=4?s=400"},{"username":"yamacent","avatar":"https://avatars.githubusercontent.com/u/8544439?v=4?s=400"},{"username":"dnalborczyk","avatar":"https://avatars.githubusercontent.com/u/2903325?v=4?s=400"},{"username":"FabioWanner","avatar":"https://avatars.githubusercontent.com/u/46821078?v=4?s=400"},{"username":"ashsmith","avatar":"https://avatars.githubusercontent.com/u/1086841?v=4?s=400"},{"username":"mehalter","avatar":"https://avatars.githubusercontent.com/u/1591837?v=4?s=400"},{"username":"Chrg1001","avatar":"https://avatars.githubusercontent.com/u/40189653?v=4?s=400"},{"username":"sharmarajdaksh","avatar":"https://avatars.githubusercontent.com/u/33689528?v=4?s=400"},{"username":"shuluster","avatar":"https://avatars.githubusercontent.com/u/1707910?v=4?s=400"},{"username":"FDiskas","avatar":"https://avatars.githubusercontent.com/u/468006?v=4?s=400"},{"username":"ericzorn93","avatar":"https://avatars.githubusercontent.com/u/22532542?v=4?s=400"},{"username":"mbelsky","avatar":"https://avatars.githubusercontent.com/u/3923527?v=4?s=400"},{"username":"Peteck","avatar":"https://avatars.githubusercontent.com/u/129566390?v=4?s=400"},{"username":"rustyconover","avatar":"https://avatars.githubusercontent.com/u/731941?v=4?s=400"},{"username":"bunkscene","avatar":"https://avatars.githubusercontent.com/u/2693678?v=4?s=400"},{"username":"ottomated","avatar":"https://avatars.githubusercontent.com/u/31470743?v=4?s=400"},{"username":"sadfsdfdsa","avatar":"https://avatars.githubusercontent.com/u/28733669?v=4?s=400"},{"username":"ajaishankar","avatar":"https://avatars.githubusercontent.com/u/328008?v=4?s=400"},{"username":"dominikdosoudil","avatar":"https://avatars.githubusercontent.com/u/15929942?v=4?s=400"},{"username":"kgtkr","avatar":"https://avatars.githubusercontent.com/u/17868838?v=4?s=400"},{"username":"berzi","avatar":"https://avatars.githubusercontent.com/u/32619123?v=4?s=400"},{"username":"PhilipTrauner","avatar":"https://avatars.githubusercontent.com/u/9287847?v=4?s=400"},{"username":"Powell-v2","avatar":"https://avatars.githubusercontent.com/u/25308326?v=4?s=400"},{"username":"duncanbeevers","avatar":"https://avatars.githubusercontent.com/u/7367?v=4?s=400"},{"username":"tkukushkin","avatar":"https://avatars.githubusercontent.com/u/1482516?v=4?s=400"},{"username":"Semigradsky","avatar":"https://avatars.githubusercontent.com/u/1198848?v=4?s=400"},{"username":"MrLeebo","avatar":"https://avatars.githubusercontent.com/u/2754163?v=4?s=400"},{"username":"axelhzf","avatar":"https://avatars.githubusercontent.com/u/175627?v=4?s=400"},{"username":"imagoiq","avatar":"https://avatars.githubusercontent.com/u/12294151?v=4?s=400"},{"username":"BTMPL","avatar":"https://avatars.githubusercontent.com/u/247153?v=4?s=400"},{"username":"HiiiiD","avatar":"https://avatars.githubusercontent.com/u/61231210?v=4?s=400"},{"username":"yacinehmito","avatar":"https://avatars.githubusercontent.com/u/6893840?v=4?s=400"},{"username":"sajadtorkamani","avatar":"https://avatars.githubusercontent.com/u/9380313?v=4?s=400"},{"username":"mvdbeek","avatar":"https://avatars.githubusercontent.com/u/6804901?v=4?s=400"},{"username":"sgrimm","avatar":"https://avatars.githubusercontent.com/u/1248649?v=4?s=400"},{"username":"Swiftwork","avatar":"https://avatars.githubusercontent.com/u/455178?v=4?s=400"},{"username":"mtth","avatar":"https://avatars.githubusercontent.com/u/1216372?v=4?s=400"},{"username":"mitchell-merry","avatar":"https://avatars.githubusercontent.com/u/8567231?v=4?s=400"},{"username":"qnp","avatar":"https://avatars.githubusercontent.com/u/6012554?v=4?s=400"},{"username":"shoffmeister","avatar":"https://avatars.githubusercontent.com/u/3868036?v=4?s=400"},{"username":"liangskyli","avatar":"https://avatars.githubusercontent.com/u/31531283?v=4?s=400"},{"username":"happycollision","avatar":"https://avatars.githubusercontent.com/u/3663628?v=4?s=400"}],"openapi-fetch":[{"username":"drwpow","avatar":"https://avatars.githubusercontent.com/u/1369770?v=4?s=400"},{"username":"fergusean","avatar":"https://avatars.githubusercontent.com/u/1029297?v=4?s=400"},{"username":"shinzui","avatar":"https://avatars.githubusercontent.com/u/519?v=4?s=400"},{"username":"ezpuzz","avatar":"https://avatars.githubusercontent.com/u/672182?v=4?s=400"},{"username":"KotoriK","avatar":"https://avatars.githubusercontent.com/u/52659125?v=4?s=400"},{"username":"fletchertyler914","avatar":"https://avatars.githubusercontent.com/u/3344498?v=4?s=400"},{"username":"nholik","avatar":"https://avatars.githubusercontent.com/u/2022214?v=4?s=400"},{"username":"roj1512","avatar":"https://avatars.githubusercontent.com/u/49933115?v=4?s=400"},{"username":"nickcaballero","avatar":"https://avatars.githubusercontent.com/u/355976?v=4?s=400"}]}

docs/src/layouts/MainLayout.astro

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import NextLink from "../components/NextLink.astro";
99
import PageContent from "../components/PageContent/PageContent.astro";
1010
import LeftSidebar from "../components/LeftSidebar/LeftSidebar.astro";
1111
import RightSidebar from "../components/RightSidebar/RightSidebar.astro";
12-
import { GITHUB_EDIT_URL, OPENAPI_FETCH_CONTRIBUTORS, OPENAPI_TS_CONTRIBUTORS, SITE } from "../consts.js";
12+
import { GITHUB_EDIT_URL, SITE } from "../consts.js";
13+
import contributors from "../data/contributors.json";
1314
1415
type Props = CollectionEntry<"docs">["data"] & {
1516
headings: MarkdownHeading[];
@@ -72,7 +73,7 @@ const nextLink: Record<string, Link | undefined> = {
7273
}
7374

7475
.grid-sidebar {
75-
height: 100vh;
76+
max-height: 100vh;
7677
position: sticky;
7778
top: 0;
7879
padding: 0;
@@ -134,8 +135,8 @@ const nextLink: Record<string, Link | undefined> = {
134135
<div id="grid-main">
135136
<PageContent title={data.title} headings={headings} githubEditUrl={githubEditUrl}>
136137
<slot />
137-
{currentPage === "/about" && <Contributors usernames={OPENAPI_TS_CONTRIBUTORS} />}
138-
{currentPage === "/openapi-fetch/about" && <Contributors usernames={OPENAPI_FETCH_CONTRIBUTORS} />}
138+
{currentPage.startsWith("/about") && <Contributors contributors={contributors["openapi-typescript"]} />}
139+
{currentPage.startsWith("/openapi-fetch/about") && <Contributors contributors={contributors["openapi-fetch"]} />}
139140
{nextLink[currentPage] && <NextLink href={nextLink[currentPage]!.url}>{nextLink[currentPage]!.text}</NextLink>}
140141
</PageContent>
141142
</div>

docs/src/lib/github.ts

Lines changed: 0 additions & 10 deletions
This file was deleted.

0 commit comments

Comments
 (0)