Compare commits

..
Author SHA1 Message Date
rickstaa 8d2da8ff4f ci: fix id-token 'read' bug
This commit fixes a bug that is present when the `read` option is used
for the `id-token` permission (see https://github.com/github/docs/issues/26481).
2023-07-02 12:06:34 +02:00
Alexandr Garbuzov 888c4cee94 CI: Resolve OSSF GitHub token permissions security alert (#2891) 2023-07-02 09:06:04 +02:00
ecac85edd5 refactor: update languages JSON (#2899)
Co-authored-by: rickstaa <rickstaa@users.noreply.github.com>
Co-authored-by: Alexandr <qwerty541zxc@gmail.com>
2023-07-01 15:38:30 +03:00
Alexandr Garbuzov 720617a817 Docs: reorder themes contributing guidelines (#2897) 2023-07-01 00:18:58 +02:00
Alexandr Garbuzov 5d959bc76c Docs: add link to themes contribution guidelines (#2898) 2023-07-01 00:16:52 +02:00
Alexandr Garbuzov 0d74d5a25d Docs (translations): Add missing alt attributes for codecov badges (#2895) 2023-06-29 22:52:49 +02:00
Alexandr Garbuzov c3a8086e45 Docs: Add contrast ration check notice into themes contributing guide (#2894) 2023-06-29 22:52:19 +02:00
Alexandr Garbuzov 40c5f41caf Docs: Add missing alt attribute for codecov badge (#2892) 2023-06-28 21:42:41 +02:00
Alexandr Garbuzov 9f7184cc9e Top langs card tests: Fixed helper functions docstrings (#2893) 2023-06-28 20:25:26 +02:00
Alexandr Garbuzov ee978f332b CI: Fix warnings variable usage inside theme preview workflow (#2886) 2023-06-27 13:19:26 +02:00
Alexandr Garbuzov f0268559e0 Docs (translations): Add missing GitHub contributors badges (#2887) 2023-06-27 13:18:57 +02:00
Alexandr Garbuzov 0b642d4fd6 Docs (translations): Add OSSF badges (#2884) 2023-06-26 15:16:59 +02:00
Alexandr Garbuzov e2fa7ad423 CI: Add OSSF scorecard analysis workflow (#2879)
* CI: Add OSSF scorecard analysis workflow

* dev

* dev

* dev

* replace action versions with hashes

* readme badge
2023-06-26 15:27:54 +03:00
Max Duval 18c9de0a18 refactor: object shorthand (#2882) 2023-06-26 10:40:54 +02:00
Alexandr Garbuzov b7eb65f819 I18n: Fixed docstring for statsCardLocales function and enable ts-check (#2883) 2023-06-25 22:07:46 +02:00
Alexandr Garbuzov a7998f0186 Top langs card: Fixed getLongestLang function docstring to resolve vscode errors (#2881) 2023-06-24 11:39:23 +02:00
Alexandr Garbuzov 5486e2ca06 Increase e2e tests timeout secs (#2878) 2023-06-23 09:24:17 +02:00
Rick Staa e5f1399cc2 docs: remove progress rank icon example (#2876) 2023-06-22 16:52:46 +03:00
iwbc-mzkandrickstaa a48d653fa4 Fixed resizing of stats card when all metrics except rank are hidden (#2868)
* fixed card resizing in case of rank only

* fixed to display error when both stats and rank are hidden

* fix: fix visual alignment

---------

Co-authored-by: rickstaa <rick.staa@outlook.com>
2023-06-22 12:07:52 +02:00
35 changed files with 351 additions and 63 deletions
+2
View File
@@ -2,6 +2,8 @@ name: Test Deployment
on: on:
deployment_status: deployment_status:
permissions: read-all
jobs: jobs:
e2eTests: e2eTests:
if: if:
@@ -6,6 +6,21 @@ on:
- opened - opened
- edited - edited
permissions:
actions: read
checks: read
contents: read
deployments: read
id-token: none
issues: write
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs: jobs:
closeEmptyIssuesAndTemplates: closeEmptyIssuesAndTemplates:
if: github.repository == 'anuraghazra/github-readme-stats' if: github.repository == 'anuraghazra/github-readme-stats'
+15
View File
@@ -6,6 +6,21 @@ on:
paths: paths:
- "themes/index.js" - "themes/index.js"
permissions:
actions: read
checks: read
contents: write
deployments: read
id-token: none
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs: jobs:
generateThemeDoc: generateThemeDoc:
runs-on: ubuntu-latest runs-on: ubuntu-latest
+15
View File
@@ -2,6 +2,21 @@ name: "Pull Request Labeler"
on: on:
- pull_request_target - pull_request_target
permissions:
actions: read
checks: read
contents: read
deployments: read
id-token: none
issues: read
discussions: read
packages: read
pages: read
pull-requests: write
repository-projects: read
security-events: read
statuses: read
jobs: jobs:
triage: triage:
if: github.repository == 'anuraghazra/github-readme-stats' if: github.repository == 'anuraghazra/github-readme-stats'
+48
View File
@@ -0,0 +1,48 @@
name: OSSF Scorecard analysis workflow
on:
push:
branches:
- master
pull_request:
branches:
- master
permissions: read-all
jobs:
analysis:
name: Scorecard analysis
runs-on: ubuntu-latest
permissions:
# Needed if using Code scanning alerts
security-events: write
# Needed for GitHub OIDC token if publish_results is true
id-token: write
steps:
- name: "Checkout code"
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2
with:
persist-credentials: false
- name: "Run analysis"
uses: ossf/scorecard-action@80e868c13c90f172d68d1f4501dee99e2479f7af # v2.1.3
with:
results_file: results.sarif
results_format: sarif
publish_results: true
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
# format to the repository Actions tab.
- name: "Upload artifact"
uses: actions/upload-artifact@0b7f8abb1508181956e8e162db84b466c27e18ce # v3.1.2
with:
name: SARIF file
path: results.sarif
retention-days: 5
# required for Code scanning alerts
- name: "Upload SARIF results to code scanning"
uses: github/codeql-action/upload-sarif@83f0fe6c4988d98a455712a27f0255212bba9bd4 # v2.3.6
with:
sarif_file: results.sarif
+15
View File
@@ -7,6 +7,21 @@ on:
paths: paths:
- "themes/index.js" - "themes/index.js"
permissions:
actions: read
checks: read
contents: read
deployments: read
id-token: none
issues: read
discussions: read
packages: read
pages: read
pull-requests: write
repository-projects: read
security-events: read
statuses: read
jobs: jobs:
previewTheme: previewTheme:
name: Install & Preview name: Install & Preview
+15
View File
@@ -4,6 +4,21 @@ on:
types: types:
- closed - closed
permissions:
actions: write
checks: read
contents: read
deployments: read
id-token: none
issues: read
discussions: read
packages: read
pages: read
pull-requests: read
repository-projects: read
security-events: read
statuses: read
jobs: jobs:
cleanup: cleanup:
runs-on: ubuntu-latest runs-on: ubuntu-latest
@@ -3,6 +3,21 @@ on:
schedule: schedule:
- cron: "0 0 */7 * *" - cron: "0 0 */7 * *"
permissions:
actions: read
checks: read
contents: read
deployments: read
id-token: none
issues: read
discussions: read
packages: read
pages: read
pull-requests: write
repository-projects: read
security-events: read
statuses: read
jobs: jobs:
closeOldThemePrs: closeOldThemePrs:
if: github.repository == 'anuraghazra/github-readme-stats' if: github.repository == 'anuraghazra/github-readme-stats'
+2
View File
@@ -7,6 +7,8 @@ on:
branches: branches:
- master - master
permissions: read-all
jobs: jobs:
build: build:
name: Perform tests name: Perform tests
@@ -4,6 +4,21 @@ on:
- cron: "0 0 */3 * *" - cron: "0 0 */3 * *"
workflow_dispatch: workflow_dispatch:
permissions:
actions: read
checks: read
contents: read
deployments: read
id-token: none
issues: write
discussions: read
packages: read
pages: read
pull-requests: write
repository-projects: read
security-events: read
statuses: read
jobs: jobs:
showAndLabelTopIssues: showAndLabelTopIssues:
if: github.repository == 'anuraghazra/github-readme-stats' if: github.repository == 'anuraghazra/github-readme-stats'
+15
View File
@@ -3,6 +3,21 @@ on:
schedule: schedule:
- cron: "0 0 */30 * *" - cron: "0 0 */30 * *"
permissions:
actions: read
checks: read
contents: read
deployments: read
id-token: none
issues: read
discussions: read
packages: read
pages: read
pull-requests: write
repository-projects: read
security-events: read
statuses: read
jobs: jobs:
updateLanguages: updateLanguages:
if: github.repository == 'anuraghazra/github-readme-stats' if: github.repository == 'anuraghazra/github-readme-stats'
+5 -2
View File
@@ -47,14 +47,17 @@ _(make sure you already have a [Vercel](https://vercel.com/) account)_
GitHub Readme Stats supports custom theming, and you can also contribute new themes! GitHub Readme Stats supports custom theming, and you can also contribute new themes!
All you need to do is edit the [themes/index.js](./themes/index.js) file and add your theme at the end of the file.
> **Note** > **Note**
> If you are contributing your theme just because you are using it personally, then you can [customize the looks](./readme.md#customization) of your card with URL params instead. > If you are contributing your theme just because you are using it personally, then you can [customize the looks](./readme.md#customization) of your card with URL params instead.
> **Note** > **Note**
> Keep in mind that we already have a vast collection of different themes. To keep their number manageable, we began to add only themes supported by the community. Your pull request with theme addition will be merged once we get enough positive feedback from the community in the form of thumbs up (see [#1935](https://github.com/anuraghazra/github-readme-stats/issues/1935#top-themes-prs)). Remember that you can also support themes of other contributors that you liked to speed up their merge. > Keep in mind that we already have a vast collection of different themes. To keep their number manageable, we began to add only themes supported by the community. Your pull request with theme addition will be merged once we get enough positive feedback from the community in the form of thumbs up (see [#1935](https://github.com/anuraghazra/github-readme-stats/issues/1935#top-themes-prs)). Remember that you can also support themes of other contributors that you liked to speed up their merge.
> **Note**
> Before submitting pull request, please make sure that your theme pass WCAG 2.0 level AA constrast ration test. You can use [this tool](https://webaim.org/resources/contrastchecker/) to check it.
To contribute your theme you need to edit the [themes/index.js](./themes/index.js) file and add it at the end of the file.
## Any contributions you make will be under the MIT Software License ## Any contributions you make will be under the MIT Software License
In short, when you submit changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern. In short, when you submit changes, your submissions are understood to be under the same [MIT License](http://choosealicense.com/licenses/mit/) that covers the project. Feel free to contact the maintainers if that's a concern.
+7 -1
View File
@@ -7,8 +7,11 @@
<a href="https://github.com/anuraghazra/github-readme-stats/actions"> <a href="https://github.com/anuraghazra/github-readme-stats/actions">
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" /> <img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
</a>
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats"> <a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
<img src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" /> <img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/issues"> <a href="https://github.com/anuraghazra/github-readme-stats/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
@@ -16,6 +19,9 @@
<a href="https://github.com/anuraghazra/github-readme-stats/pulls"> <a href="https://github.com/anuraghazra/github-readme-stats/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
</a> </a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
</a>
<br /> <br />
<br /> <br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227"> <a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
+7 -1
View File
@@ -8,8 +8,11 @@
<a href="https://github.com/anuraghazra/github-readme-stats/actions"> <a href="https://github.com/anuraghazra/github-readme-stats/actions">
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" /> <img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
</a>
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats"> <a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
<img src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" /> <img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/issues"> <a href="https://github.com/anuraghazra/github-readme-stats/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
@@ -17,6 +20,9 @@
<a href="https://github.com/anuraghazra/github-readme-stats/pulls"> <a href="https://github.com/anuraghazra/github-readme-stats/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
</a> </a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
</a>
<br /> <br />
<br /> <br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227"> <a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
+7 -1
View File
@@ -8,8 +8,11 @@
<a href="https://github.com/anuraghazra/github-readme-stats/actions"> <a href="https://github.com/anuraghazra/github-readme-stats/actions">
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" /> <img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
</a>
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats"> <a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
<img src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" /> <img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/issues"> <a href="https://github.com/anuraghazra/github-readme-stats/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
@@ -17,6 +20,9 @@
<a href="https://github.com/anuraghazra/github-readme-stats/pulls"> <a href="https://github.com/anuraghazra/github-readme-stats/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
</a> </a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
</a>
<br /> <br />
<br /> <br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227"> <a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
+7 -1
View File
@@ -7,8 +7,11 @@
<a href="https://github.com/anuraghazra/github-readme-stats/actions"> <a href="https://github.com/anuraghazra/github-readme-stats/actions">
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" /> <img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
</a>
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats"> <a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
<img src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" /> <img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/issues"> <a href="https://github.com/anuraghazra/github-readme-stats/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
@@ -16,6 +19,9 @@
<a href="https://github.com/anuraghazra/github-readme-stats/pulls"> <a href="https://github.com/anuraghazra/github-readme-stats/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
</a> </a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
</a>
<br /> <br />
<br /> <br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227"> <a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
+7 -1
View File
@@ -7,8 +7,11 @@
<a href="https://github.com/anuraghazra/github-readme-stats/actions"> <a href="https://github.com/anuraghazra/github-readme-stats/actions">
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" /> <img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
</a>
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats"> <a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
<img src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" /> <img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/issues"> <a href="https://github.com/anuraghazra/github-readme-stats/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
@@ -16,6 +19,9 @@
<a href="https://github.com/anuraghazra/github-readme-stats/pulls"> <a href="https://github.com/anuraghazra/github-readme-stats/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
</a> </a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
</a>
<br /> <br />
<br /> <br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227"> <a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
+7 -1
View File
@@ -7,8 +7,11 @@
<a href="https://github.com/anuraghazra/github-readme-stats/actions"> <a href="https://github.com/anuraghazra/github-readme-stats/actions">
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" /> <img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
</a>
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats"> <a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
<img src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" /> <img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/issues"> <a href="https://github.com/anuraghazra/github-readme-stats/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
@@ -16,6 +19,9 @@
<a href="https://github.com/anuraghazra/github-readme-stats/pulls"> <a href="https://github.com/anuraghazra/github-readme-stats/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
</a> </a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
</a>
<br /> <br />
<br /> <br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227"> <a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
+7 -1
View File
@@ -7,8 +7,11 @@
<a href="https://github.com/anuraghazra/github-readme-stats/actions"> <a href="https://github.com/anuraghazra/github-readme-stats/actions">
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" /> <img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
</a>
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats"> <a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
<img src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" /> <img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/issues"> <a href="https://github.com/anuraghazra/github-readme-stats/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
@@ -16,6 +19,9 @@
<a href="https://github.com/anuraghazra/github-readme-stats/pulls"> <a href="https://github.com/anuraghazra/github-readme-stats/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
</a> </a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
</a>
<br /> <br />
<br /> <br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227"> <a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
+7 -1
View File
@@ -7,8 +7,11 @@
<a href="https://github.com/anuraghazra/github-readme-stats/actions"> <a href="https://github.com/anuraghazra/github-readme-stats/actions">
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" /> <img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
</a>
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats"> <a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
<img src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" /> <img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/issues"> <a href="https://github.com/anuraghazra/github-readme-stats/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
@@ -16,6 +19,9 @@
<a href="https://github.com/anuraghazra/github-readme-stats/pulls"> <a href="https://github.com/anuraghazra/github-readme-stats/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
</a> </a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
</a>
<br /> <br />
<br /> <br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227"> <a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
+7 -1
View File
@@ -7,8 +7,11 @@
<a href="https://github.com/anuraghazra/github-readme-stats/actions"> <a href="https://github.com/anuraghazra/github-readme-stats/actions">
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" /> <img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
</a>
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats"> <a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
<img src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" /> <img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/issues"> <a href="https://github.com/anuraghazra/github-readme-stats/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
@@ -16,6 +19,9 @@
<a href="https://github.com/anuraghazra/github-readme-stats/pulls"> <a href="https://github.com/anuraghazra/github-readme-stats/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
</a> </a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
</a>
<br /> <br />
<br /> <br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227"> <a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
+7 -1
View File
@@ -7,8 +7,11 @@
<a href="https://github.com/anuraghazra/github-readme-stats/actions"> <a href="https://github.com/anuraghazra/github-readme-stats/actions">
<img alt="Testes aprovados" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" /> <img alt="Testes aprovados" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
</a>
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats"> <a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
<img src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" /> <img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/issues"> <a href="https://github.com/anuraghazra/github-readme-stats/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
@@ -16,6 +19,9 @@
<a href="https://github.com/anuraghazra/github-readme-stats/pulls"> <a href="https://github.com/anuraghazra/github-readme-stats/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
</a> </a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
</a>
<br /> <br />
<br /> <br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227"> <a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
+7 -1
View File
@@ -7,8 +7,11 @@
<a href="https://github.com/anuraghazra/github-readme-stats/actions"> <a href="https://github.com/anuraghazra/github-readme-stats/actions">
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" /> <img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
</a>
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats"> <a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
<img src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" /> <img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/issues"> <a href="https://github.com/anuraghazra/github-readme-stats/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
@@ -16,6 +19,9 @@
<a href="https://github.com/anuraghazra/github-readme-stats/pulls"> <a href="https://github.com/anuraghazra/github-readme-stats/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
</a> </a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
</a>
<br /> <br />
<br /> <br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227"> <a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
+6 -7
View File
@@ -11,7 +11,7 @@
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" /> <img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
</a> </a>
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats"> <a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
<img src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" /> <img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
</a> </a>
<a href="https://github.com/anuraghazra/github-readme-stats/issues"> <a href="https://github.com/anuraghazra/github-readme-stats/issues">
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
@@ -19,6 +19,9 @@
<a href="https://github.com/anuraghazra/github-readme-stats/pulls"> <a href="https://github.com/anuraghazra/github-readme-stats/pulls">
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" /> <img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
</a> </a>
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
</a>
<br /> <br />
<br /> <br />
<a href="https://a.paddle.com/v2/click/16413/119403?link=1227"> <a href="https://a.paddle.com/v2/click/16413/119403?link=1227">
@@ -181,7 +184,7 @@ GitHub readme stats comes with several built-in themes (e.g. `dark`, `radical`,
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Stats Themes" width="600px"/> <img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Stats Themes" width="600px"/>
You can look at a preview for [all available themes](./themes/README.md) or checkout the [theme config file](./themes/index.js) & **you can also contribute new themes** if you like :D You can look at a preview for [all available themes](./themes/README.md) or checkout the [theme config file](./themes/index.js). You can also contribute new themes if you like, contributing guidelines can be found [here](./CONTRIBUTING.md#themes-contribution).
#### Responsive Card Theme #### Responsive Card Theme
@@ -304,7 +307,7 @@ You can provide multiple comma-separated values in the bg\_color option to rende
* `hide_title` - *(boolean)*. Default: `false`. * `hide_title` - *(boolean)*. Default: `false`.
* `card_width` - Set the card's width manually *(number)*. Default: `500px (approx.)`. * `card_width` - Set the card's width manually *(number)*. Default: `500px (approx.)`.
* `hide_rank` - *(boolean)* hides the rank and automatically resizes the card width. Default: `false`. * `hide_rank` - *(boolean)* hides the rank and automatically resizes the card width. Default: `false`.
* `rank_icon` - Shows alternative rank icon (i.e. `github`, `percentile`, `progress` or `default`). Default: `default`. * `rank_icon` - Shows alternative rank icon (i.e. `github`, `percentile` or `default`). Default: `default`.
* `show_icons` - *(boolean)*. Default: `false`. * `show_icons` - *(boolean)*. Default: `false`.
* `include_all_commits` - Count total commits instead of just the current year commits *(boolean)*. Default: `false`. * `include_all_commits` - Count total commits instead of just the current year commits *(boolean)*. Default: `false`.
* `line_height` - Sets the line height between text *(number)*. Default: `25`. * `line_height` - Sets the line height between text *(number)*. Default: `25`.
@@ -553,10 +556,6 @@ Change the `?username=` value to your [Wakatime](https://wakatime.com) username.
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra\&rank_icon=github) ![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra\&rank_icon=github)
* Shows rank progress instead of rank level
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra\&rank_icon=progress)
* Shows user rank percentile instead of rank level * Shows user rank percentile instead of rank level
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra\&rank_icon=percentile) ![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra\&rank_icon=percentile)
+1 -1
View File
@@ -451,7 +451,7 @@ export const run = async () => {
debug("Theme preview body: Check if the theme colors are valid..."); debug("Theme preview body: Check if the theme colors are valid...");
let invalidColors = false; let invalidColors = false;
if (!colors) { if (!colors) {
warning.push("Theme colors are missing"); warnings.push("Theme colors are missing");
invalidColors = true; invalidColors = true;
} else { } else {
const missingKeys = REQUIRED_COLOR_PROPS.filter( const missingKeys = REQUIRED_COLOR_PROPS.filter(
+1 -1
View File
@@ -61,7 +61,7 @@ function calculateRank({
const level = LEVELS[THRESHOLDS.findIndex((t) => rank * 100 <= t)]; const level = LEVELS[THRESHOLDS.findIndex((t) => rank * 100 <= t)];
return { level: level, percentile: rank * 100 }; return { level, percentile: rank * 100 };
} }
export { calculateRank }; export { calculateRank };
+39 -11
View File
@@ -3,6 +3,7 @@ import { Card } from "../common/Card.js";
import { I18n } from "../common/I18n.js"; import { I18n } from "../common/I18n.js";
import { icons, rankIcon } from "../common/icons.js"; import { icons, rankIcon } from "../common/icons.js";
import { import {
CustomError,
clampValue, clampValue,
flexLayout, flexLayout,
getCardColors, getCardColors,
@@ -16,6 +17,8 @@ const CARD_MIN_WIDTH = 287;
const CARD_DEFAULT_WIDTH = 287; const CARD_DEFAULT_WIDTH = 287;
const RANK_CARD_MIN_WIDTH = 420; const RANK_CARD_MIN_WIDTH = 420;
const RANK_CARD_DEFAULT_WIDTH = 450; const RANK_CARD_DEFAULT_WIDTH = 450;
const RANK_ONLY_CARD_MIN_WIDTH = 290;
const RANK_ONLY_CARD_DEFAULT_WIDTH = 290;
/** /**
* Create a stats card text item. * Create a stats card text item.
@@ -234,11 +237,18 @@ const renderStatsCard = (stats = {}, options = {}) => {
}), }),
); );
if (statItems.length === 0 && hide_rank) {
throw new CustomError(
"Could not render stats card.",
"Either stats or rank are required.",
);
}
// Calculate the card height depending on how many items there are // Calculate the card height depending on how many items there are
// but if rank circle is visible clamp the minimum height to `150` // but if rank circle is visible clamp the minimum height to `150`
let height = Math.max( let height = Math.max(
45 + (statItems.length + 1) * lheight, 45 + (statItems.length + 1) * lheight,
hide_rank ? 0 : 150, hide_rank ? 0 : statItems.length ? 150 : 180,
); );
// the lower the user's percentile the better // the lower the user's percentile the better
@@ -253,7 +263,13 @@ const renderStatsCard = (stats = {}, options = {}) => {
}); });
const calculateTextWidth = () => { const calculateTextWidth = () => {
return measureText(custom_title ? custom_title : i18n.t("statcard.title")); return measureText(
custom_title
? custom_title
: statItems.length
? i18n.t("statcard.title")
: i18n.t("statcard.ranktitle"),
);
}; };
/* /*
@@ -261,7 +277,7 @@ const renderStatsCard = (stats = {}, options = {}) => {
When hide_rank=false, the minimum card_width is 340 px + the icon width (if show_icons=true). When hide_rank=false, the minimum card_width is 340 px + the icon width (if show_icons=true).
Numbers are picked by looking at existing dimensions on production. Numbers are picked by looking at existing dimensions on production.
*/ */
const iconWidth = show_icons ? 16 + /* padding */ 1 : 0; const iconWidth = show_icons && statItems.length ? 16 + /* padding */ 1 : 0;
const minCardWidth = const minCardWidth =
(hide_rank (hide_rank
? clampValue( ? clampValue(
@@ -269,9 +285,15 @@ const renderStatsCard = (stats = {}, options = {}) => {
CARD_MIN_WIDTH, CARD_MIN_WIDTH,
Infinity, Infinity,
) )
: RANK_CARD_MIN_WIDTH) + iconWidth; : statItems.length
? RANK_CARD_MIN_WIDTH
: RANK_ONLY_CARD_MIN_WIDTH) + iconWidth;
const defaultCardWidth = const defaultCardWidth =
(hide_rank ? CARD_DEFAULT_WIDTH : RANK_CARD_DEFAULT_WIDTH) + iconWidth; (hide_rank
? CARD_DEFAULT_WIDTH
: statItems.length
? RANK_CARD_DEFAULT_WIDTH
: RANK_ONLY_CARD_DEFAULT_WIDTH) + iconWidth;
let width = isNaN(card_width) ? defaultCardWidth : card_width; let width = isNaN(card_width) ? defaultCardWidth : card_width;
if (width < minCardWidth) { if (width < minCardWidth) {
width = minCardWidth; width = minCardWidth;
@@ -279,7 +301,9 @@ const renderStatsCard = (stats = {}, options = {}) => {
const card = new Card({ const card = new Card({
customTitle: custom_title, customTitle: custom_title,
defaultTitle: i18n.t("statcard.title"), defaultTitle: statItems.length
? i18n.t("statcard.title")
: i18n.t("statcard.ranktitle"),
width, width,
height, height,
border_radius, border_radius,
@@ -309,12 +333,16 @@ const renderStatsCard = (stats = {}, options = {}) => {
* @returns {number} - Rank circle translation value. * @returns {number} - Rank circle translation value.
*/ */
const calculateRankXTranslation = () => { const calculateRankXTranslation = () => {
const minXTranslation = RANK_CARD_MIN_WIDTH + iconWidth - 70; if (statItems.length) {
if (width > RANK_CARD_DEFAULT_WIDTH) { const minXTranslation = RANK_CARD_MIN_WIDTH + iconWidth - 70;
const xMaxExpansion = minXTranslation + (450 - minCardWidth) / 2; if (width > RANK_CARD_DEFAULT_WIDTH) {
return xMaxExpansion + width - RANK_CARD_DEFAULT_WIDTH; const xMaxExpansion = minXTranslation + (450 - minCardWidth) / 2;
return xMaxExpansion + width - RANK_CARD_DEFAULT_WIDTH;
} else {
return minXTranslation + (width - minCardWidth) / 2;
}
} else { } else {
return minXTranslation + (width - minCardWidth) / 2; return width / 2 + 20 - 10;
} }
}; };
+2 -2
View File
@@ -33,13 +33,13 @@ const DONUT_VERTICAL_LAYOUT_DEFAULT_LANGS_COUNT = 6;
* Retrieves the programming language whose name is the longest. * Retrieves the programming language whose name is the longest.
* *
* @param {Lang[]} arr Array of programming languages. * @param {Lang[]} arr Array of programming languages.
* @returns {Object} Longest programming language object. * @returns {{ name: string, size: number, color: string }} Longest programming language object.
*/ */
const getLongestLang = (arr) => const getLongestLang = (arr) =>
arr.reduce( arr.reduce(
(savedLang, lang) => (savedLang, lang) =>
lang.name.length > savedLang.name.length ? lang : savedLang, lang.name.length > savedLang.name.length ? lang : savedLang,
{ name: "", size: null, color: "" }, { name: "", size: 0, color: "" },
); );
/** /**
+1 -1
View File
@@ -1,5 +1,5 @@
type ThemeNames = keyof typeof import("../../themes/index.js"); type ThemeNames = keyof typeof import("../../themes/index.js");
type RankIcon = "default" | "github" | "percentile" | "progress"; type RankIcon = "default" | "github" | "percentile";
export type CommonOptions = { export type CommonOptions = {
title_color: string; title_color: string;
+1 -7
View File
@@ -36,19 +36,13 @@ const rankIcon = (rankIcon, rankLevel, percentile) => {
${percentile.toFixed(1)}% ${percentile.toFixed(1)}%
</text> </text>
`; `;
case "progress":
return `
<text x="-5" y="3" alignment-baseline="central" dominant-baseline="central" text-anchor="middle" data-testid="progress-rank-icon" class="rank-percentile-text">
${(100.0 - percentile).toFixed(1)}%
</text>
`;
case "default": case "default":
default: default:
return ` return `
<text x="-5" y="3" alignment-baseline="central" dominant-baseline="central" text-anchor="middle" data-testid="level-rank-icon"> <text x="-5" y="3" alignment-baseline="central" dominant-baseline="central" text-anchor="middle" data-testid="level-rank-icon">
${rankLevel} ${rankLevel}
</text> </text>
`; `;
} }
}; };
+3 -1
View File
@@ -217,6 +217,7 @@
"Haxe": "#df7900", "Haxe": "#df7900",
"HiveQL": "#dce200", "HiveQL": "#dce200",
"HolyC": "#ffefaf", "HolyC": "#ffefaf",
"Hosts File": "#308888",
"Hy": "#7790B2", "Hy": "#7790B2",
"IDL": "#a3522f", "IDL": "#a3522f",
"IGOR Pro": "#0000cc", "IGOR Pro": "#0000cc",
@@ -517,6 +518,8 @@
"Volt": "#1F1F1F", "Volt": "#1F1F1F",
"Vue": "#41b883", "Vue": "#41b883",
"Vyper": "#2980b9", "Vyper": "#2980b9",
"WDL": "#42f1f4",
"WGSL": "#1a5e9a",
"Web Ontology Language": "#5b70bd", "Web Ontology Language": "#5b70bd",
"WebAssembly": "#04133b", "WebAssembly": "#04133b",
"WebAssembly Interface Type": "#6250e7", "WebAssembly Interface Type": "#6250e7",
@@ -561,7 +564,6 @@
"q": "#0040cd", "q": "#0040cd",
"reStructuredText": "#141414", "reStructuredText": "#141414",
"sed": "#64b970", "sed": "#64b970",
"wdl": "#42f1f4",
"wisp": "#7582D1", "wisp": "#7582D1",
"xBase": "#403a40" "xBase": "#403a40"
} }
+37 -3
View File
@@ -1,11 +1,14 @@
// @ts-check
import { encodeHTML } from "./common/utils.js"; import { encodeHTML } from "./common/utils.js";
/** /**
* Retrieves stat card labels in the available locales. * Retrieves stat card labels in the available locales.
* *
* @param {string} name The name of the locale. * @param {object} props Function arguments.
* @param {string} apostrophe Whether to use apostrophe or not. * @param {string} props.name The name of the locale.
* @returns {Object} The locales object. * @param {string} props.apostrophe Whether to use apostrophe or not.
* @returns {object} The locales object.
* *
* @see https://www.andiamo.co.uk/resources/iso-language-codes/ for language codes. * @see https://www.andiamo.co.uk/resources/iso-language-codes/ for language codes.
*/ */
@@ -43,6 +46,37 @@ const statCardLocales = ({ name, apostrophe }) => {
vi: `Thống Kê GitHub ${encodedName}`, vi: `Thống Kê GitHub ${encodedName}`,
se: `GitHubstatistik för ${encodedName}`, se: `GitHubstatistik för ${encodedName}`,
}, },
"statcard.ranktitle": {
ar: `${encodedName} إحصائيات غيت هاب`,
cn: `${encodedName} 的 GitHub 统计数据`,
"zh-tw": `${encodedName} 的 GitHub 統計數據`,
cs: `GitHub statistiky uživatele ${encodedName}`,
de: `${encodedName + apostrophe} GitHub-Statistiken`,
en: `${encodedName}'${apostrophe} GitHub Rank`,
bn: `${encodedName} এর GitHub পরিসংখ্যান`,
es: `Estadísticas de GitHub de ${encodedName}`,
fr: `Statistiques GitHub de ${encodedName}`,
hu: `${encodedName} GitHub statisztika`,
it: `Statistiche GitHub di ${encodedName}`,
ja: `${encodedName} の GitHub ランク`,
kr: `${encodedName}의 GitHub 통계`,
nl: `${encodedName}'${apostrophe} GitHub-statistieken`,
"pt-pt": `Estatísticas do GitHub de ${encodedName}`,
"pt-br": `Estatísticas do GitHub de ${encodedName}`,
np: `${encodedName}'${apostrophe} गिटहब तथ्याङ्क`,
el: `Στατιστικά GitHub του ${encodedName}`,
ru: `Статистика GitHub пользователя ${encodedName}`,
"uk-ua": `Статистика GitHub користувача ${encodedName}`,
id: `Statistik GitHub ${encodedName}`,
ml: `${encodedName}'${apostrophe} ഗിറ്റ്ഹബ് സ്ഥിതിവിവരക്കണക്കുകൾ`,
my: `Statistik GitHub ${encodedName}`,
sk: `GitHub štatistiky používateľa ${encodedName}`,
tr: `${encodedName} Hesabının GitHub Yıldızları`,
pl: `Statystyki GitHub użytkownika ${encodedName}`,
uz: `${encodedName}ning GitHub'dagi statistikasi`,
vi: `Thống Kê GitHub ${encodedName}`,
se: `GitHubstatistik för ${encodedName}`,
},
"statcard.totalstars": { "statcard.totalstars": {
ar: "مجموع النجوم", ar: "مجموع النجوم",
cn: "获标星数(star", cn: "获标星数(star",
+4 -4
View File
@@ -108,7 +108,7 @@ describe("Fetch Cards", () => {
// Check if stats card from deployment matches the stats card from local. // Check if stats card from deployment matches the stats card from local.
expect(serverStatsSvg.data).toEqual(localStatsCardSVG); expect(serverStatsSvg.data).toEqual(localStatsCardSVG);
}, 7000); }, 15000);
test("retrieve language card", async () => { test("retrieve language card", async () => {
expect(VERCEL_PREVIEW_URL).toBeDefined(); expect(VERCEL_PREVIEW_URL).toBeDefined();
@@ -133,7 +133,7 @@ describe("Fetch Cards", () => {
// Check if language card from deployment matches the local language card. // Check if language card from deployment matches the local language card.
expect(severLanguageSVG.data).toEqual(localLanguageCardSVG); expect(severLanguageSVG.data).toEqual(localLanguageCardSVG);
}); }, 15000);
test("retrieve WakaTime card", async () => { test("retrieve WakaTime card", async () => {
expect(VERCEL_PREVIEW_URL).toBeDefined(); expect(VERCEL_PREVIEW_URL).toBeDefined();
@@ -153,7 +153,7 @@ describe("Fetch Cards", () => {
// Check if WakaTime card from deployment matches the local WakaTime card. // Check if WakaTime card from deployment matches the local WakaTime card.
expect(serverWakaTimeSvg.data).toEqual(localWakaCardSVG); expect(serverWakaTimeSvg.data).toEqual(localWakaCardSVG);
}); }, 15000);
test("retrieve repo card", async () => { test("retrieve repo card", async () => {
expect(VERCEL_PREVIEW_URL).toBeDefined(); expect(VERCEL_PREVIEW_URL).toBeDefined();
@@ -175,5 +175,5 @@ describe("Fetch Cards", () => {
// Check if Repo card from deployment matches the local Repo card. // Check if Repo card from deployment matches the local Repo card.
expect(serverRepoSvg.data).toEqual(localRepoCardSVG); expect(serverRepoSvg.data).toEqual(localRepoCardSVG);
}); }, 15000);
}); });
-10
View File
@@ -431,14 +431,4 @@ describe("Test renderStatsCard", () => {
queryByTestId(document.body, "percentile-rank-value").textContent.trim(), queryByTestId(document.body, "percentile-rank-value").textContent.trim(),
).toBe(stats.rank.percentile.toFixed(1) + "%"); ).toBe(stats.rank.percentile.toFixed(1) + "%");
}); });
it("should show the progress", () => {
document.body.innerHTML = renderStatsCard(stats, {
rank_icon: "progress",
});
expect(queryByTestId(document.body, "rank-progress-text")).toBeDefined();
expect(
queryByTestId(document.body, "progress-rank-icon").textContent.trim(),
).toBe((100 - stats.rank.percentile).toFixed(1) + "%");
});
}); });
+2 -2
View File
@@ -46,7 +46,7 @@ const langs = {
* Retrieve number array from SVG path definition string. * Retrieve number array from SVG path definition string.
* *
* @param {string} d SVG path definition string. * @param {string} d SVG path definition string.
* @return {number[]} Resulting numbers array. * @returns {number[]} Resulting numbers array.
*/ */
const getNumbersFromSvgPathDefinitionAttribute = (d) => { const getNumbersFromSvgPathDefinitionAttribute = (d) => {
return d return d
@@ -78,7 +78,7 @@ const langPercentFromDonutLayoutSvg = (d, centerX, centerY) => {
* *
* @param {number} partLength Length of current chart part.. * @param {number} partLength Length of current chart part..
* @param {number} totalCircleLength Total length of circle. * @param {number} totalCircleLength Total length of circle.
* @return {number} Chart part percentage. * @returns {number} Chart part percentage.
*/ */
const langPercentFromDonutVerticalLayoutSvg = ( const langPercentFromDonutVerticalLayoutSvg = (
partLength, partLength,