@shiinasaku/github-card 4.2.0 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -13
- package/dist/card.d.ts +2 -15
- package/dist/lib.js +4363 -930
- package/dist/types.d.ts +8 -3
- package/dist/utils/index.d.ts +4 -5
- package/dist/utils/languages.d.ts +0 -1
- package/package.json +14 -16
- package/src/card.ts +114 -92
- package/src/gallery.ts +37 -0
- package/src/github.ts +86 -42
- package/src/index.ts +89 -166
- package/src/types.ts +8 -3
- package/src/utils/format.ts +22 -20
- package/src/utils/github-client.ts +43 -138
- package/src/utils/icons.ts +5 -1
- package/src/utils/index.ts +4 -5
- package/src/utils/languages.ts +1 -1
- package/src/env.d.ts +0 -4
- package/src/input.css +0 -1
- package/src/tailwind.css +0 -3837
package/README.md
CHANGED
|
@@ -10,7 +10,7 @@ Live SVG cards for your README — stars, commits, languages, all auto-updating.
|
|
|
10
10
|
|
|
11
11
|
[](https://www.npmjs.com/package/@shiinasaku/github-card)
|
|
12
12
|
[](https://bun.sh)
|
|
13
|
-
[](https://next.elysiajs.com)
|
|
14
14
|
[](https://www.typescriptlang.org)
|
|
15
15
|
[](LICENSE)
|
|
16
16
|
[](https://vercel.com/new/clone?repository-url=https://github.com/ShiinaSaku/Github-Card)
|
|
@@ -27,7 +27,7 @@ Live SVG cards for your README — stars, commits, languages, all auto-updating.
|
|
|
27
27
|
|
|
28
28
|
### ✨ What's new in 4.2
|
|
29
29
|
|
|
30
|
-
> System-font only · no shipped `.woff2` · crisper text (`geometricPrecision`, tabular numbers) · new 24 px icons (MingCute / Huge / Tabler) · airy stat stack with 7 px gaps, no boxes · default `affiliations=owner` — org stars excluded unless `?affiliations=affiliated` · fully typed `github.ts` & `github-client`, cache
|
|
30
|
+
> System-font only · no shipped `.woff2` · crisper text (`geometricPrecision`, tabular numbers) · new 24 px icons (MingCute / Huge / Tabler) · airy stat stack with 7 px gaps, no boxes · default `affiliations=owner` — org stars excluded unless `?affiliations=affiliated` · fully typed `github.ts` & `github-client`, cache v9.
|
|
31
31
|
|
|
32
32
|
---
|
|
33
33
|
|
|
@@ -39,23 +39,32 @@ Paste into your profile README — replace `shiinasaku` with your username:
|
|
|
39
39
|
[](https://github.com/shiinasaku)
|
|
40
40
|
```
|
|
41
41
|
|
|
42
|
-
That's it. No sign-up, no build — the card refreshes
|
|
42
|
+
That's it. No sign-up, no build — the card refreshes automatically as cached data expires.
|
|
43
43
|
|
|
44
44
|
<details>
|
|
45
45
|
<summary><b>Self-host / local dev</b></summary>
|
|
46
46
|
|
|
47
|
+
Requires Bun 1.4.4 or newer. The API uses Elysia 2 RC with pinned framework and plugin versions.
|
|
48
|
+
|
|
47
49
|
```bash
|
|
48
50
|
bun install
|
|
49
51
|
cp .env.example .env # add GITHUB_TOKEN
|
|
50
52
|
bun dev # http://localhost:3000
|
|
51
53
|
```
|
|
52
54
|
|
|
53
|
-
| Command | Action
|
|
54
|
-
| ------------------- |
|
|
55
|
-
| `bun test` | Run
|
|
56
|
-
| `bun run typecheck` |
|
|
57
|
-
| `bun run
|
|
58
|
-
| `bun run fmt`
|
|
55
|
+
| Command | Action |
|
|
56
|
+
| ------------------- | -------------------- |
|
|
57
|
+
| `bun test` | Run tests |
|
|
58
|
+
| `bun run typecheck` | Native `bun check` |
|
|
59
|
+
| `bun run fmt` | Bun native formatter |
|
|
60
|
+
| `bun run fmt:check` | Check formatting |
|
|
61
|
+
|
|
62
|
+
Formatting uses Bun's built-in `bun fmt`; no separate formatter or linter is installed.
|
|
63
|
+
Bun 1.4.4 does not provide a built-in `bun lint` command. `bun check` enforces strict typing and
|
|
64
|
+
unused-symbol checks. TypeScript is retained only to emit the library’s `.d.ts` files during builds.
|
|
65
|
+
|
|
66
|
+
`src/index.ts` serves as the entrypoint for Vercel and local development, starting a listener
|
|
67
|
+
only when run directly. The rendering library is unchanged.
|
|
59
68
|
|
|
60
69
|
</details>
|
|
61
70
|
|
|
@@ -136,6 +145,24 @@ Add `?theme=tokyonight` or override any slot with hex or Tailwind tokens: `pink-
|
|
|
136
145
|
| `affiliations` | `string` | `owner` (default) or `affiliated` — org stars excluded by default |
|
|
137
146
|
| `fields` | `string[]` | Fetch only `fields=stats` for speed |
|
|
138
147
|
|
|
148
|
+
#### What the numbers mean
|
|
149
|
+
|
|
150
|
+
- Stars, repositories, and languages come from non-fork repositories in the requested scope.
|
|
151
|
+
`affiliations=owner` is the default for both the HTTP API and `getProfileData`.
|
|
152
|
+
- User commits are contributions credited by GitHub from January 1 (UTC) to now, not lifetime
|
|
153
|
+
commit counts. Default user PR/issue totals are lifetime authored totals. With `scope=org`,
|
|
154
|
+
commits, PRs, and issues are this year's contributions to the selected organizations.
|
|
155
|
+
- `scope=all` combines personal and contributed organization repositories without counting a repo
|
|
156
|
+
twice; its activity totals remain the user's totals. `orgs` filters the organization portion.
|
|
157
|
+
- Organization accounts have repository/star/language data, but no computed activity totals.
|
|
158
|
+
Those metrics display `—` (and are `null` in `UserStats`), not a misleading zero.
|
|
159
|
+
- Language filters run before `lang_count`. Percentages describe the displayed languages by code
|
|
160
|
+
size, not time spent coding. The bar and legend use the same “Other” group.
|
|
161
|
+
- Results depend on what the GitHub token can access. GitHub's query limits still apply:
|
|
162
|
+
the top 10 languages per repository and up to 100 repositories in each org contribution
|
|
163
|
+
breakdown. Repository pagination supports up to 10,000 repos per connection; reaching that
|
|
164
|
+
limit with more pages remaining returns an error rather than caching incomplete totals.
|
|
165
|
+
|
|
139
166
|
#### Examples
|
|
140
167
|
|
|
141
168
|
```md
|
|
@@ -176,7 +203,7 @@ Add `?theme=tokyonight` or override any slot with hex or Tailwind tokens: `pink-
|
|
|
176
203
|
|
|
177
204
|
3. Done — serves `/card/:username` on Vercel CDN `s-maxage=1800, stale-while-revalidate=1800`.
|
|
178
205
|
|
|
179
|
-
> Without Redis, in-memory
|
|
206
|
+
> Without Redis, bounded in-memory cache (1000 entries, SWR 30 min) still keeps warm instances fast.
|
|
180
207
|
|
|
181
208
|
---
|
|
182
209
|
|
|
@@ -205,7 +232,7 @@ npm install @shiinasaku/github-card # Node / Next / Vite
|
|
|
205
232
|
import { renderCard, themes } from "@shiinasaku/github-card";
|
|
206
233
|
|
|
207
234
|
const svg = renderCard(user, stats, languages, { theme: "tokyonight" });
|
|
208
|
-
// → string
|
|
235
|
+
// → SVG string, no network or server required
|
|
209
236
|
```
|
|
210
237
|
|
|
211
238
|
Prebuilt `dist/lib.js` + `.d.ts`; Bun resolves raw TS via `bun` export condition. Pure renderer — no network, no server.
|
|
@@ -221,7 +248,7 @@ flowchart LR
|
|
|
221
248
|
C -- hit --> G[render SVG<br/>ETag/304 → CDN]
|
|
222
249
|
C -- miss --> D{L2 Redis<br/>SWR 30m}
|
|
223
250
|
D -- hit --> G
|
|
224
|
-
D -- miss --> E[GitHub GraphQL<br/>100/page,
|
|
251
|
+
D -- miss --> E[GitHub GraphQL<br/>100/page, up to 100 pages, 6s/request]
|
|
225
252
|
E --> F[typed fetch<br/>+ avatar 150px]
|
|
226
253
|
F --> G
|
|
227
254
|
G --> H[Pure SVG<br/>system fonts · measured layout · glass]
|
|
@@ -239,7 +266,7 @@ Fully automated:
|
|
|
239
266
|
|
|
240
267
|
1. **Actions → Bump** → `patch` / `minor` / `major`.
|
|
241
268
|
2. Workflow bumps `package.json`, commits, tags `vX.Y.Z`.
|
|
242
|
-
3. Tag triggers **Release**: `
|
|
269
|
+
3. Tag triggers **Release**: `bun fmt --check` · `bun check` · `tests` · `dist` build · tag↔version guard · `npm pack` verify → publish with [provenance](https://docs.npmjs.com/generating-provenance-statements) + GitHub Release.
|
|
243
270
|
|
|
244
271
|
---
|
|
245
272
|
|
package/dist/card.d.ts
CHANGED
|
@@ -1,16 +1,3 @@
|
|
|
1
|
-
import type { UserProfile, UserStats, LanguageStat } from "./types";
|
|
2
|
-
export type CardOpts =
|
|
3
|
-
theme?: string;
|
|
4
|
-
title_color?: string;
|
|
5
|
-
text_color?: string;
|
|
6
|
-
icon_color?: string;
|
|
7
|
-
bg_color?: string;
|
|
8
|
-
border_color?: string;
|
|
9
|
-
hide_border?: boolean;
|
|
10
|
-
compact?: boolean;
|
|
11
|
-
hide?: string[];
|
|
12
|
-
hide_langs?: string[];
|
|
13
|
-
show_langs?: string[];
|
|
14
|
-
animate?: boolean;
|
|
15
|
-
};
|
|
1
|
+
import type { UserProfile, UserStats, LanguageStat, CardOptions } from "./types";
|
|
2
|
+
export type CardOpts = CardOptions;
|
|
16
3
|
export declare function renderCard(user: UserProfile, stats: UserStats, langs: LanguageStat[], opts?: CardOpts): string;
|