Skip to content

Commit cca939f

Browse files
committed
registry: simplify package page and improve GitHub integration
- Refactor RegistryPkgShow.vue to focus on real package details - Improve registry index build logic - Add GitHub stats fetch script with env token support - Update generated registry index - Update gitignore for env and build artifacts
1 parent 1010502 commit cca939f

File tree

8 files changed

+1133
-436
lines changed

8 files changed

+1133
-436
lines changed

.gitignore

Lines changed: 27 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,28 @@
1-
# Prerequisites
2-
*.d
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
.idea
19+
.DS_Store
20+
*.suo
21+
*.ntvs*
22+
*.njsproj
23+
*.sln
24+
*.sw?
25+
cmd.md
26+
.env
27+
vix-site/.env
328

4-
# Compiled Object files
5-
*.slo
6-
*.lo
7-
*.o
8-
*.obj
9-
10-
# Precompiled Headers
11-
*.gch
12-
*.pch
13-
14-
# Linker files
15-
*.ilk
16-
17-
# Debugger Files
18-
*.pdb
19-
20-
# Compiled Dynamic libraries
21-
*.so
22-
*.dylib
23-
*.dll
24-
25-
# Fortran module files
26-
*.mod
27-
*.smod
28-
29-
# Compiled Static libraries
30-
*.lai
31-
*.la
32-
*.a
33-
*.lib
34-
35-
# Executables
36-
*.exe
37-
*.out
38-
*.app
39-
40-
# debug information files
41-
*.dwo

vix-site/package-lock.json

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vix-site/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
},
2626
"devDependencies": {
2727
"@vitejs/plugin-vue": "^6.0.1",
28+
"dotenv": "^17.3.1",
2829
"vite": "^7.2.4",
2930
"vite-plugin-pwa": "^1.2.0",
3031
"vitepress": "^1.6.4"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{"meta":{"registryId":"vixcpp-registry","specVersion":"1.0.0","generatedAt":"2026-02-16T10:00:51.567Z","sourceRepo":"https://github.com/vixcpp/registry","indexFormat":"json-per-package","entryCount":3},"entries":[{"description":"","displayName":"binary_search","homepage":"https://github.com/Gaspardkirira/binary_search","keywords":[],"latest":"0.1.2","license":"MIT","maintainers":[{"github":"","name":""}],"manifestPath":"vix.json","name":"binary_search","namespace":"gaspardkirira","repo":{"defaultBranch":"main","url":"https://github.com/Gaspardkirira/binary_search"},"type":"header-only","versions":{"0.1.1":{"commit":"b2cc3302637f336f2a798f8bf4e855c4b20f7522","notes":"Fix registry id + publishable commit","tag":"v0.1.1"},"0.1.2":{"commit":"adf2cd3c9b9784014223e4b33055521717b5fb84","notes":"Update README","tag":"v0.1.2"}}},{"name":"test_lib","namespace":"gaspardkirira","displayName":"test_lib","description":"Header-only C++ utility library for testing Vix workflows and registry publishing.","keywords":["header-only"],"license":"MIT","repo":{"url":"https://github.com/GaspardKirira/test_lib","defaultBranch":"main"},"type":"header-only","manifestPath":"vix.json","homepage":"https://softadastra.com","maintainers":[{"name":"Gaspard kirira","github":"Gaspard Kirira"}],"versions":{"0.1.0":{"tag":"v0.1.0","commit":"f05619022bca6da576d7bf7dca65e028f7db654d","notes":"Add test_lib","publishedAt":"2026-02-11T05:06:50.025Z"}},"latest":"0.1.0"},{"description":"Tiny header-only example library for demonstrating the Vix Registry workflow.","displayName":"tree","homepage":"https://github.com/GaspardKirira/tree","keywords":["c++","header-only","demo","registry","vix"],"latest":"0.7.2","license":"MIT","maintainers":[{"github":"GaspardKirira","name":"Gaspard Kirira"}],"manifestPath":"vix.json","name":"tree","namespace":"gaspardkirira","readme":"# tree\n\nA tiny header-only example library for the Vix Registry demo.\n\n## Usage\n- Include headers from `include/`\n- Example in `examples/basic.cpp`\n\n---\n\n## License\n\nMIT © [Gaspard Kirira Authors](https://github.com/Gaspardkirira/tree)\n","repo":{"defaultBranch":"main","url":"https://github.com/GaspardKirira/tree"},"type":"header-only","versions":{"0.1.0":{"commit":"ffcf9d703e6113f5ac5887c99b45baaccf7e4937","notes":"Initial demo release","tag":"v0.1.0"},"0.2.0":{"commit":"b79ba53ca60a78a3c4b7baaa1da728907ee0a5fa","notes":"Add count_leaves helper","tag":"v0.2.0"},"0.5.0":{"commit":"b184d0cf2220f825ca41139bede5543c5e717df4","notes":"Add index_by_id helper","tag":"v0.5.0"},"0.6.0":{"commit":"6d6a9abdf1b80a85b2f97832153b754f9f746629","notes":"Add count_internal_nodes helper","tag":"v0.6.0"},"0.7.0":{"commit":"18363babf297b4050d2585596238012faee65d52","notes":"Add tree helper","tag":"v0.7.0"},"0.7.1":{"commit":"5f650ab896593c169f91dd722aaa72185db90f8c","notes":"Update README with code examples","tag":"v0.7.1"},"0.7.2":{"commit":"4e729d736440c5cfcae5e70ab1879273387a7ed6","notes":"Update tree README","tag":"v0.7.2"}}}]}
1+
{"meta":{"registryId":"vixcpp-registry","specVersion":"1.1.0","generatedAt":"2026-02-18T09:48:46.185Z","sourceRepo":"https://github.com/vixcpp/registry","indexFormat":"json-per-package","entryCount":3},"entries":[{"api":{"format":"vix-api-1","generatedBy":"manual","path":"vix.api.json","updatedAt":"2026-02-18T00:00:00Z"},"constraints":{"minCppStandard":"c++17","platforms":["linux","macos","windows"]},"dependencies":{"git":[],"registry":[],"system":[]},"description":"Minimal header-only binary search utilities for C++ (beginner-friendly).","displayName":"binary_search","documentation":"https://github.com/Gaspardkirira/binary_search#readme","exports":{"headers":["binary_search.hpp"],"modules":["binary_search.hpp"],"namespaces":[]},"homepage":"https://github.com/Gaspardkirira/binary_search","keywords":["algorithm","binary-search","cpp","header-only","competitive-programming"],"license":"MIT","maintainers":[{"github":"Gaspardkirira","name":"Gaspard Kirira"}],"manifestPath":"vix.json","name":"binary_search","namespace":"gaspardkirira","quality":{"ci":[],"hasDocs":true,"hasExamples":true,"hasTests":false},"repo":{"defaultBranch":"main","url":"https://github.com/Gaspardkirira/binary_search"},"type":"header-only","versions":{"0.1.1":{"commit":"b2cc3302637f336f2a798f8bf4e855c4b20f7522","notes":"Fix registry id + publishable commit","publishedAt":"2026-02-18T00:00:00Z","tag":"v0.1.1"},"0.1.2":{"commit":"adf2cd3c9b9784014223e4b33055521717b5fb84","notes":"Update README","publishedAt":"2026-02-18T00:00:00Z","tag":"v0.1.2"},"0.1.3":{"commit":"5bd13f2289adf21ddf160aff46052bdbc17855a6","notes":"Update vix.json","publishedAt":"2026-02-18T09:42:13Z","status":"published","tag":"v0.1.3"}},"latestVersion":"0.1.3"},{"name":"test_lib","namespace":"gaspardkirira","displayName":"test_lib","description":"Header-only C++ utility library for testing Vix workflows and registry publishing.","keywords":["header-only"],"license":"MIT","repo":{"url":"https://github.com/GaspardKirira/test_lib","defaultBranch":"main"},"type":"header-only","manifestPath":"vix.json","homepage":"https://softadastra.com","maintainers":[{"name":"Gaspard kirira","github":"Gaspard Kirira"}],"versions":{"0.1.0":{"tag":"v0.1.0","commit":"f05619022bca6da576d7bf7dca65e028f7db654d","notes":"Add test_lib","publishedAt":"2026-02-11T05:06:50.025Z"}},"latest":"0.1.0","latestVersion":"0.1.0"},{"description":"Tiny header-only example library for demonstrating the Vix Registry workflow.","displayName":"tree","homepage":"https://github.com/GaspardKirira/tree","keywords":["c++","header-only","demo","registry","vix"],"latest":"0.7.2","license":"MIT","maintainers":[{"github":"GaspardKirira","name":"Gaspard Kirira"}],"manifestPath":"vix.json","name":"tree","namespace":"gaspardkirira","readme":"# tree\n\nA tiny header-only example library for the Vix Registry demo.\n\n## Usage\n- Include headers from `include/`\n- Example in `examples/basic.cpp`\n\n---\n\n## License\n\nMIT © [Gaspard Kirira Authors](https://github.com/Gaspardkirira/tree)\n","repo":{"defaultBranch":"main","url":"https://github.com/GaspardKirira/tree"},"type":"header-only","versions":{"0.1.0":{"commit":"ffcf9d703e6113f5ac5887c99b45baaccf7e4937","notes":"Initial demo release","tag":"v0.1.0"},"0.2.0":{"commit":"b79ba53ca60a78a3c4b7baaa1da728907ee0a5fa","notes":"Add count_leaves helper","tag":"v0.2.0"},"0.5.0":{"commit":"b184d0cf2220f825ca41139bede5543c5e717df4","notes":"Add index_by_id helper","tag":"v0.5.0"},"0.6.0":{"commit":"6d6a9abdf1b80a85b2f97832153b754f9f746629","notes":"Add count_internal_nodes helper","tag":"v0.6.0"},"0.7.0":{"commit":"18363babf297b4050d2585596238012faee65d52","notes":"Add tree helper","tag":"v0.7.0"},"0.7.1":{"commit":"5f650ab896593c169f91dd722aaa72185db90f8c","notes":"Update README with code examples","tag":"v0.7.1"},"0.7.2":{"commit":"4e729d736440c5cfcae5e70ab1879273387a7ed6","notes":"Update tree README","tag":"v0.7.2"}},"latestVersion":"0.7.2"}]}

vix-site/scripts/fetch_github_stats.mjs

Lines changed: 73 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,73 @@
1+
/**
2+
* scripts/fetch_github_stats.mjs
3+
*
4+
* Writes repo stats to:
5+
* - src/data/github_stats.json (for static import)
6+
* - public/data/github_stats.json (for runtime fetch)
7+
*/
8+
19
import fs from "node:fs";
210
import path from "node:path";
11+
import "dotenv/config";
12+
13+
const OUT_SRC = path.resolve("src/data/github_stats.json");
14+
const OUT_PUBLIC = path.resolve("public/data/github_stats.json");
315

4-
const OUT = path.resolve("src/data/github_stats.json");
516
const REPO = "vixcpp/vix";
617
const API = `https://api.github.com/repos/${REPO}`;
718

19+
const GH_TOKEN =
20+
process.env.VITE_GITHUB_TOKEN || process.env.GITHUB_TOKEN || "";
21+
22+
console.log("[env] cwd:", process.cwd());
23+
console.log(
24+
"[env] VITE_GITHUB_TOKEN:",
25+
process.env.VITE_GITHUB_TOKEN ? "set" : "missing",
26+
);
27+
console.log(
28+
"[env] GITHUB_TOKEN:",
29+
process.env.GITHUB_TOKEN ? "set" : "missing",
30+
);
31+
832
function nowISO() {
933
return new Date().toISOString();
1034
}
1135

12-
async function fetchJson(url, headers) {
13-
const res = await fetch(url, { headers });
14-
if (!res.ok)
15-
throw new Error(`GitHub API failed: ${res.status} ${res.statusText}`);
16-
return res.json();
17-
}
18-
19-
async function main() {
20-
const token = process.env.GITHUB_TOKEN || "";
21-
const headers = {
36+
function ghHeaders() {
37+
const h = {
2238
Accept: "application/vnd.github+json",
2339
"User-Agent": "vix-site-build",
40+
"X-GitHub-Api-Version": "2022-11-28",
2441
};
42+
if (GH_TOKEN) h.Authorization = `Bearer ${GH_TOKEN}`;
43+
return h;
44+
}
2545

26-
if (token) headers["Authorization"] = `Bearer ${token}`;
46+
async function fetchJson(url) {
47+
const res = await fetch(url, { headers: ghHeaders() });
48+
if (!res.ok) {
49+
let extra = "";
50+
try {
51+
const j = await res.json();
52+
if (j?.message) extra = ` (${j.message})`;
53+
} catch {}
54+
throw new Error(
55+
`GitHub API failed: ${res.status} ${res.statusText}${extra}`,
56+
);
57+
}
58+
return res.json();
59+
}
2760

61+
function writeJson(filePath, payload) {
62+
fs.mkdirSync(path.dirname(filePath), { recursive: true });
63+
fs.writeFileSync(filePath, JSON.stringify(payload, null, 2), "utf8");
64+
}
65+
66+
async function main() {
2867
let payload;
68+
2969
try {
30-
const repo = await fetchJson(API, headers);
70+
const repo = await fetchJson(API);
3171

3272
payload = {
3373
repo: REPO,
@@ -36,18 +76,9 @@ async function main() {
3676
forks: repo.forks_count ?? 0,
3777
open_issues: repo.open_issues_count ?? 0,
3878
watchers: repo.subscribers_count ?? 0,
79+
rate_limit: GH_TOKEN ? "auth" : "public",
3980
};
4081
} catch (err) {
41-
if (fs.existsSync(OUT)) {
42-
console.warn(
43-
`[github_stats] fetch failed, keeping existing file: ${err.message}`,
44-
);
45-
return;
46-
}
47-
48-
console.warn(
49-
`[github_stats] fetch failed, writing fallback file: ${err.message}`,
50-
);
5182
payload = {
5283
repo: REPO,
5384
fetched_at: nowISO(),
@@ -56,12 +87,28 @@ async function main() {
5687
open_issues: 0,
5788
watchers: 0,
5889
fallback: true,
90+
rate_limit: GH_TOKEN ? "auth" : "public",
91+
error: String(err?.message || err),
5992
};
93+
94+
// si déjà présent, on ne casse pas le site
95+
if (fs.existsSync(OUT_SRC) || fs.existsSync(OUT_PUBLIC)) {
96+
console.warn(
97+
`[github_stats] fetch failed, keeping existing file: ${payload.error}`,
98+
);
99+
return;
100+
}
101+
102+
console.warn(
103+
`[github_stats] fetch failed, writing fallback file: ${payload.error}`,
104+
);
60105
}
61106

62-
fs.mkdirSync(path.dirname(OUT), { recursive: true });
63-
fs.writeFileSync(OUT, JSON.stringify(payload, null, 2), "utf8");
64-
console.log(`[github_stats] wrote ${OUT}`);
107+
writeJson(OUT_SRC, payload);
108+
writeJson(OUT_PUBLIC, payload);
109+
110+
console.log("[github_stats] wrote", OUT_SRC);
111+
console.log("[github_stats] wrote", OUT_PUBLIC);
65112
}
66113

67114
main().catch((e) => {
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
{
22
"repo": "vixcpp/vix",
3-
"fetched_at": "2026-02-17T12:37:44.529Z",
4-
"stars": 291,
3+
"fetched_at": "2026-02-18T10:52:46.392Z",
4+
"stars": 293,
55
"forks": 26,
66
"open_issues": 12,
7-
"watchers": 3
7+
"watchers": 3,
8+
"rate_limit": "auth"
89
}

0 commit comments

Comments
 (0)