From e348c7c3813d5baff0577ee47023f20bf6948edc Mon Sep 17 00:00:00 2001 From: tiennm99 Date: Sat, 18 Apr 2026 22:20:09 +0700 Subject: [PATCH] refactor(card): drop numeric prefix from output filenames Files now land at output//profile-details.svg etc., without leading 0-8 prefixes. README authors embed cards by name, so the lexicographic-sort rationale for the prefix no longer applies. - All Filename() methods + the allCards ordering comment updated. - Tests updated to expect the 9 unnumbered filenames. - README, deployment-guide, codebase-summary, roadmap references refreshed. - Dracula sample SVGs regenerated under new names. --- README.md | 36 +++++++++---------- docs/codebase-summary.md | 14 ++++---- docs/deployment-guide.md | 18 +++++----- docs/project-roadmap.md | 2 +- internal/card/card.go | 6 ++-- internal/card/card_test.go | 14 +++++--- internal/card/contributions.go | 4 +-- internal/card/most_commit_language.go | 2 +- .../card/most_commit_language_all_time.go | 2 +- internal/card/productive.go | 4 +-- internal/card/profile.go | 2 +- internal/card/repos_per_language.go | 2 +- internal/card/stats.go | 2 +- ...ll-time.svg => contributions-all-time.svg} | 4 +-- ...{5-contributions.svg => contributions.svg} | 4 +-- ....svg => most-commit-language-all-time.svg} | 26 +++++++------- ...-language.svg => most-commit-language.svg} | 24 ++++++------- ...-time.svg => productive-time-all-time.svg} | 10 +++--- ...roductive-time.svg => productive-time.svg} | 10 +++--- ...rofile-details.svg => profile-details.svg} | 0 ...er-language.svg => repos-per-language.svg} | 0 output/dracula/{3-stats.svg => stats.svg} | 4 +-- 22 files changed, 97 insertions(+), 93 deletions(-) rename output/dracula/{8-contributions-all-time.svg => contributions-all-time.svg} (97%) rename output/dracula/{5-contributions.svg => contributions.svg} (94%) rename output/dracula/{6-most-commit-language-all-time.svg => most-commit-language-all-time.svg} (50%) rename output/dracula/{2-most-commit-language.svg => most-commit-language.svg} (55%) rename output/dracula/{7-productive-time-all-time.svg => productive-time-all-time.svg} (88%) rename output/dracula/{4-productive-time.svg => productive-time.svg} (87%) rename output/dracula/{0-profile-details.svg => profile-details.svg} (100%) rename output/dracula/{1-repos-per-language.svg => repos-per-language.svg} (100%) rename output/dracula/{3-stats.svg => stats.svg} (98%) diff --git a/README.md b/README.md index 1e98f7b8..06ec640f 100644 --- a/README.md +++ b/README.md @@ -55,15 +55,15 @@ jobs: Then embed the cards in your `README.md`: ```md -![profile](./output/dracula/0-profile-details.svg) -![repos-per-language](./output/dracula/1-repos-per-language.svg) -![most-commit-language](./output/dracula/2-most-commit-language.svg) -![stats](./output/dracula/3-stats.svg) -![productive-time](./output/dracula/4-productive-time.svg) -![contributions](./output/dracula/5-contributions.svg) -![most-commit-language-all-time](./output/dracula/6-most-commit-language-all-time.svg) -![productive-time-all-time](./output/dracula/7-productive-time-all-time.svg) -![contributions-all-time](./output/dracula/8-contributions-all-time.svg) +![profile](./output/dracula/profile-details.svg) +![repos-per-language](./output/dracula/repos-per-language.svg) +![most-commit-language](./output/dracula/most-commit-language.svg) +![stats](./output/dracula/stats.svg) +![productive-time](./output/dracula/productive-time.svg) +![contributions](./output/dracula/contributions.svg) +![most-commit-language-all-time](./output/dracula/most-commit-language-all-time.svg) +![productive-time-all-time](./output/dracula/productive-time-all-time.svg) +![contributions-all-time](./output/dracula/contributions-all-time.svg) ``` ### Action inputs @@ -145,15 +145,15 @@ github-profile-summary-cards). Built-ins include `default`, `dark`, `dracula`, ``` output/ dracula/ - 0-profile-details.svg - 1-repos-per-language.svg - 2-most-commit-language.svg - 3-stats.svg - 4-productive-time.svg - 5-contributions.svg - 6-most-commit-language-all-time.svg - 7-productive-time-all-time.svg - 8-contributions-all-time.svg + profile-details.svg + repos-per-language.svg + most-commit-language.svg + stats.svg + productive-time.svg + contributions.svg + most-commit-language-all-time.svg + productive-time-all-time.svg + contributions-all-time.svg ``` Only the `dracula` theme is tracked in git as a reference sample; other diff --git a/docs/codebase-summary.md b/docs/codebase-summary.md index 8f3adaeb..87c2ea7c 100644 --- a/docs/codebase-summary.md +++ b/docs/codebase-summary.md @@ -23,13 +23,13 @@ ghstats/ │ │ ├── svg.go # escapeXML, formatInt, header, footer │ │ ├── axis.go # niceTicks (d3-style 1/2/5 × 10^k), formatTick │ │ ├── icons.go # Octicon path strings -│ │ ├── profile.go # 0-profile-details -│ │ ├── repos_per_language.go # 1-repos-per-language -│ │ ├── most_commit_language.go # 2-most-commit-language -│ │ ├── most_commit_language_all_time.go # 6-most-commit-language-all-time -│ │ ├── stats.go # 3-stats -│ │ ├── productive.go # 4-productive-time + 7-*-all-time -│ │ ├── contributions.go # 5-contributions + 8-*-all-time +│ │ ├── profile.go # profile-details +│ │ ├── repos_per_language.go # repos-per-language +│ │ ├── most_commit_language.go # most-commit-language +│ │ ├── most_commit_language_all_time.go # most-commit-language-all-time +│ │ ├── stats.go # stats +│ │ ├── productive.go # productive-time (+ all-time) +│ │ ├── contributions.go # contributions (+ all-time) │ │ ├── donut_chart.go # renderDonutCard — shared by language cards │ │ └── card_test.go # Rendering + escape + format tests │ └── theme/ diff --git a/docs/deployment-guide.md b/docs/deployment-guide.md index f8432c5a..7d352db3 100644 --- a/docs/deployment-guide.md +++ b/docs/deployment-guide.md @@ -51,15 +51,15 @@ Create one at → "Generate new token (clas ### Embedding in README ```md -![profile](./output/dracula/0-profile-details.svg) -![repos-per-language](./output/dracula/1-repos-per-language.svg) -![most-commit-language](./output/dracula/2-most-commit-language.svg) -![stats](./output/dracula/3-stats.svg) -![productive-time](./output/dracula/4-productive-time.svg) -![contributions](./output/dracula/5-contributions.svg) -![most-commit-language-all-time](./output/dracula/6-most-commit-language-all-time.svg) -![productive-time-all-time](./output/dracula/7-productive-time-all-time.svg) -![contributions-all-time](./output/dracula/8-contributions-all-time.svg) +![profile](./output/dracula/profile-details.svg) +![repos-per-language](./output/dracula/repos-per-language.svg) +![most-commit-language](./output/dracula/most-commit-language.svg) +![stats](./output/dracula/stats.svg) +![productive-time](./output/dracula/productive-time.svg) +![contributions](./output/dracula/contributions.svg) +![most-commit-language-all-time](./output/dracula/most-commit-language-all-time.svg) +![productive-time-all-time](./output/dracula/productive-time-all-time.svg) +![contributions-all-time](./output/dracula/contributions-all-time.svg) ``` The Action commits SVGs to `output//` on the default branch. GitHub serves them from the raw URL the README references. diff --git a/docs/project-roadmap.md b/docs/project-roadmap.md index 37836cdb..79d49fc5 100644 --- a/docs/project-roadmap.md +++ b/docs/project-roadmap.md @@ -20,7 +20,7 @@ - Unified commit-history fetch splits into last-year and all-time buckets. - Per-year `contributionsCollection` loop yields `DailyContributionsAllTime` + `TotalCommitsAllTime`. -- Three new cards: 6-most-commit-language-all-time, 7-productive-time-all-time, 8-contributions-all-time. +- Three new cards: most-commit-language-all-time, productive-time-all-time, contributions-all-time. - Stats card gains a lifetime commits row. ## Phase 4 — Accurate repo sampling (✅ done) diff --git a/internal/card/card.go b/internal/card/card.go index 993eea1a..47715a17 100644 --- a/internal/card/card.go +++ b/internal/card/card.go @@ -12,14 +12,14 @@ import ( // Card renders one SVG for a Profile under the given theme. type Card interface { - // Filename is the on-disk basename (e.g. "0-profile-details.svg"). + // Filename is the on-disk basename (e.g. "profile-details.svg"). Filename() string // SVG returns the rendered SVG bytes. SVG(p *github.Profile, t theme.Theme) ([]byte, error) } -// allCards is the ordered list rendered by RenderAll. -// Keep filename prefixes numeric so the output directory lists in a predictable order. +// allCards is the ordered list rendered by RenderAll. Filenames are plain +// kebab-case — README authors embed them by name, not by lexicographic order. var allCards = []Card{ profileCard{}, reposPerLanguageCard{}, diff --git a/internal/card/card_test.go b/internal/card/card_test.go index 8e4a0047..5cb52ee6 100644 --- a/internal/card/card_test.go +++ b/internal/card/card_test.go @@ -42,11 +42,15 @@ func TestRenderAll(t *testing.T) { } want := []string{ - "0-profile-details.svg", - "1-repos-per-language.svg", - "2-most-commit-language.svg", - "3-stats.svg", - "4-productive-time.svg", + "profile-details.svg", + "repos-per-language.svg", + "most-commit-language.svg", + "stats.svg", + "productive-time.svg", + "contributions.svg", + "most-commit-language-all-time.svg", + "productive-time-all-time.svg", + "contributions-all-time.svg", } for _, name := range want { data, err := os.ReadFile(filepath.Join(dir, "dracula", name)) diff --git a/internal/card/contributions.go b/internal/card/contributions.go index 9d2d79cc..257f95fa 100644 --- a/internal/card/contributions.go +++ b/internal/card/contributions.go @@ -11,7 +11,7 @@ import ( type contributionsCard struct{} -func (contributionsCard) Filename() string { return "5-contributions.svg" } +func (contributionsCard) Filename() string { return "contributions.svg" } func (contributionsCard) SVG(p *github.Profile, t theme.Theme) ([]byte, error) { return renderContributions("Contributions (last year)", p.DailyContributions, t), nil @@ -19,7 +19,7 @@ func (contributionsCard) SVG(p *github.Profile, t theme.Theme) ([]byte, error) { type contributionsAllTimeCard struct{} -func (contributionsAllTimeCard) Filename() string { return "8-contributions-all-time.svg" } +func (contributionsAllTimeCard) Filename() string { return "contributions-all-time.svg" } func (contributionsAllTimeCard) SVG(p *github.Profile, t theme.Theme) ([]byte, error) { return renderContributions("Contributions (all time)", p.DailyContributionsAllTime, t), nil diff --git a/internal/card/most_commit_language.go b/internal/card/most_commit_language.go index 27323014..b036385e 100644 --- a/internal/card/most_commit_language.go +++ b/internal/card/most_commit_language.go @@ -7,7 +7,7 @@ import ( type mostCommitLanguageCard struct{} -func (mostCommitLanguageCard) Filename() string { return "2-most-commit-language.svg" } +func (mostCommitLanguageCard) Filename() string { return "most-commit-language.svg" } func (mostCommitLanguageCard) SVG(p *github.Profile, t theme.Theme) ([]byte, error) { return renderDonutCard("Most Commit Language (last year)", p.CommitsByLanguage, t), nil diff --git a/internal/card/most_commit_language_all_time.go b/internal/card/most_commit_language_all_time.go index d7c1fe9c..dec6962d 100644 --- a/internal/card/most_commit_language_all_time.go +++ b/internal/card/most_commit_language_all_time.go @@ -8,7 +8,7 @@ import ( type mostCommitLanguageAllTimeCard struct{} func (mostCommitLanguageAllTimeCard) Filename() string { - return "6-most-commit-language-all-time.svg" + return "most-commit-language-all-time.svg" } func (mostCommitLanguageAllTimeCard) SVG(p *github.Profile, t theme.Theme) ([]byte, error) { diff --git a/internal/card/productive.go b/internal/card/productive.go index 3b6697c1..dfaa93de 100644 --- a/internal/card/productive.go +++ b/internal/card/productive.go @@ -10,7 +10,7 @@ import ( type productiveCard struct{} -func (productiveCard) Filename() string { return "4-productive-time.svg" } +func (productiveCard) Filename() string { return "productive-time.svg" } func (productiveCard) SVG(p *github.Profile, t theme.Theme) ([]byte, error) { return renderProductiveTime(productiveTitle("last year", p.UTCOffsetLabel), p.Productive, t), nil @@ -18,7 +18,7 @@ func (productiveCard) SVG(p *github.Profile, t theme.Theme) ([]byte, error) { type productiveAllTimeCard struct{} -func (productiveAllTimeCard) Filename() string { return "7-productive-time-all-time.svg" } +func (productiveAllTimeCard) Filename() string { return "productive-time-all-time.svg" } func (productiveAllTimeCard) SVG(p *github.Profile, t theme.Theme) ([]byte, error) { return renderProductiveTime(productiveTitle("all time", p.UTCOffsetLabel), p.ProductiveAllTime, t), nil diff --git a/internal/card/profile.go b/internal/card/profile.go index f8923c97..8f4e83ec 100644 --- a/internal/card/profile.go +++ b/internal/card/profile.go @@ -11,7 +11,7 @@ import ( type profileCard struct{} -func (profileCard) Filename() string { return "0-profile-details.svg" } +func (profileCard) Filename() string { return "profile-details.svg" } // profileRow is one labeled-by-icon line in the profile card. type profileRow struct { diff --git a/internal/card/repos_per_language.go b/internal/card/repos_per_language.go index 29db8eb4..efb1213f 100644 --- a/internal/card/repos_per_language.go +++ b/internal/card/repos_per_language.go @@ -7,7 +7,7 @@ import ( type reposPerLanguageCard struct{} -func (reposPerLanguageCard) Filename() string { return "1-repos-per-language.svg" } +func (reposPerLanguageCard) Filename() string { return "repos-per-language.svg" } func (reposPerLanguageCard) SVG(p *github.Profile, t theme.Theme) ([]byte, error) { return renderDonutCard("Repos Per Language", p.ReposByLanguage, t), nil diff --git a/internal/card/stats.go b/internal/card/stats.go index 75208bde..ed5c6cb5 100644 --- a/internal/card/stats.go +++ b/internal/card/stats.go @@ -10,7 +10,7 @@ import ( type statsCard struct{} -func (statsCard) Filename() string { return "3-stats.svg" } +func (statsCard) Filename() string { return "stats.svg" } // statRow is one labeled-by-icon line in the stats card. type statRow struct { diff --git a/output/dracula/8-contributions-all-time.svg b/output/dracula/contributions-all-time.svg similarity index 97% rename from output/dracula/8-contributions-all-time.svg rename to output/dracula/contributions-all-time.svg index 7348991d..619e4458 100644 --- a/output/dracula/8-contributions-all-time.svg +++ b/output/dracula/contributions-all-time.svg @@ -40,7 +40,7 @@ 05/24 04/26 - - + + mm/yy \ No newline at end of file diff --git a/output/dracula/5-contributions.svg b/output/dracula/contributions.svg similarity index 94% rename from output/dracula/5-contributions.svg rename to output/dracula/contributions.svg index 31bf66c8..fe8c0b16 100644 --- a/output/dracula/5-contributions.svg +++ b/output/dracula/contributions.svg @@ -42,7 +42,7 @@ 02/26 04/26 - - + + mm/yy \ No newline at end of file diff --git a/output/dracula/6-most-commit-language-all-time.svg b/output/dracula/most-commit-language-all-time.svg similarity index 50% rename from output/dracula/6-most-commit-language-all-time.svg rename to output/dracula/most-commit-language-all-time.svg index c24e2ee9..18b4c2aa 100644 --- a/output/dracula/6-most-commit-language-all-time.svg +++ b/output/dracula/most-commit-language-all-time.svg @@ -2,21 +2,21 @@ Most Commit Language (all time) - JavaScript 33.00% + JavaScript 32.81% - HTML 20.56% + HTML 20.44% - Java 17.54% + Java 17.44% - C++ 5.38% - - Python 4.91% + C++ 5.35% + + Go 5.12% - Other 18.61% - - - - - - + Other 18.84% + + + + + + \ No newline at end of file diff --git a/output/dracula/2-most-commit-language.svg b/output/dracula/most-commit-language.svg similarity index 55% rename from output/dracula/2-most-commit-language.svg rename to output/dracula/most-commit-language.svg index dc67d6ed..43a37476 100644 --- a/output/dracula/2-most-commit-language.svg +++ b/output/dracula/most-commit-language.svg @@ -2,21 +2,21 @@ Most Commit Language (last year) - JavaScript 49.46% + JavaScript 48.92% - HTML 11.30% + HTML 11.18% - Go 8.14% + Go 9.11% - Java 8.01% + Java 7.92% - Dockerfile 3.95% + Dockerfile 3.92% - Other 19.13% - - - - - - + Other 18.95% + + + + + + \ No newline at end of file diff --git a/output/dracula/7-productive-time-all-time.svg b/output/dracula/productive-time-all-time.svg similarity index 88% rename from output/dracula/7-productive-time-all-time.svg rename to output/dracula/productive-time-all-time.svg index 58c34278..223fd938 100644 --- a/output/dracula/7-productive-time-all-time.svg +++ b/output/dracula/productive-time-all-time.svg @@ -45,11 +45,11 @@ 15:00 — 76 commits 16:00 — 89 commits 17:00 — 96 commits - 18:00 — 100 commits - 19:00 — 84 commits - 20:00 — 226 commits - 21:00 — 309 commits - 22:00 — 259 commits + 18:00 — 102 commits + 19:00 — 87 commits + 20:00 — 228 commits + 21:00 — 314 commits + 22:00 — 261 commits 23:00 — 240 commits hour of day \ No newline at end of file diff --git a/output/dracula/4-productive-time.svg b/output/dracula/productive-time.svg similarity index 87% rename from output/dracula/4-productive-time.svg rename to output/dracula/productive-time.svg index 17400543..644c6726 100644 --- a/output/dracula/4-productive-time.svg +++ b/output/dracula/productive-time.svg @@ -39,11 +39,11 @@ 15:00 — 45 commits 16:00 — 52 commits 17:00 — 57 commits - 18:00 — 41 commits - 19:00 — 32 commits - 20:00 — 118 commits - 21:00 — 141 commits - 22:00 — 159 commits + 18:00 — 43 commits + 19:00 — 35 commits + 20:00 — 120 commits + 21:00 — 146 commits + 22:00 — 161 commits 23:00 — 141 commits hour of day \ No newline at end of file diff --git a/output/dracula/0-profile-details.svg b/output/dracula/profile-details.svg similarity index 100% rename from output/dracula/0-profile-details.svg rename to output/dracula/profile-details.svg diff --git a/output/dracula/1-repos-per-language.svg b/output/dracula/repos-per-language.svg similarity index 100% rename from output/dracula/1-repos-per-language.svg rename to output/dracula/repos-per-language.svg diff --git a/output/dracula/3-stats.svg b/output/dracula/stats.svg similarity index 98% rename from output/dracula/3-stats.svg rename to output/dracula/stats.svg index a12a09c8..4a84728c 100644 --- a/output/dracula/3-stats.svg +++ b/output/dracula/stats.svg @@ -6,10 +6,10 @@ 4 Total Commits (all time) - 3,092 + 3,106 Total Commits (last year) - 1,720 + 1,734 Total PRs 69