Compare commits

..
Author SHA1 Message Date
Zohan Subhash 33ad0f4ee8 Documentation update 2 2023-02-22 13:41:56 +05:30
Zohan Subhash 26a8a23421 Documentation update 1 2023-02-22 13:22:53 +05:30
21 changed files with 253 additions and 377 deletions
-1
View File
@@ -1,4 +1,3 @@
themes: themes/index.js themes: themes/index.js
doc-translation: docs/* doc-translation: docs/*
card-i18n: src/translations.js card-i18n: src/translations.js
documentation: readme.md
-4
View File
@@ -23,10 +23,6 @@ jobs:
node-version: ${{ matrix.node-version }} node-version: ${{ matrix.node-version }}
cache: npm cache: npm
# Fix the unsafe repo error which was introduced by the CVE-2022-24765 git patches.
- name: Fix unsafe repo error
run: git config --global --add safe.directory ${{ github.workspace }}
- name: npm install, generate readme - name: npm install, generate readme
run: | run: |
npm ci npm ci
-2
View File
@@ -10,5 +10,3 @@ vercel_token
# IDE # IDE
.vscode .vscode
*.code-workspace *.code-workspace
.vercel
-2
View File
@@ -35,7 +35,6 @@ export default async (req, res) => {
locale, locale,
disable_animations, disable_animations,
border_radius, border_radius,
number_format,
border_color, border_color,
} = req.query; } = req.query;
res.setHeader("Content-Type", "image/svg+xml"); res.setHeader("Content-Type", "image/svg+xml");
@@ -89,7 +88,6 @@ export default async (req, res) => {
custom_title, custom_title,
border_radius, border_radius,
border_color, border_color,
number_format,
locale: locale ? locale.toLowerCase() : null, locale: locale ? locale.toLowerCase() : null,
disable_animations: parseBoolean(disable_animations), disable_animations: parseBoolean(disable_animations),
}), }),
+2 -2
View File
@@ -2,11 +2,11 @@
* @file Contains a simple cloud function that can be used to check which PATs are no * @file Contains a simple cloud function that can be used to check which PATs are no
* longer working. It returns a list of valid PATs, expired PATs and PATs with errors. * longer working. It returns a list of valid PATs, expired PATs and PATs with errors.
* *
* @description This function is currently rate limited to 1 request per 5 minutes. * @description This function is currently rate limited to 1 request per 10 minutes.
*/ */
import { logger, request, dateDiff } from "../../src/common/utils.js"; import { logger, request, dateDiff } from "../../src/common/utils.js";
export const RATE_LIMIT_SECONDS = 60 * 5; // 1 request per 5 minutes export const RATE_LIMIT_SECONDS = 60 * 5; // 1 request per 10 minutes
/** /**
* Simple uptime check fetcher for the PATs. * Simple uptime check fetcher for the PATs.
+2 -2
View File
@@ -2,13 +2,13 @@
* @file Contains a simple cloud function that can be used to check if the PATs are still * @file Contains a simple cloud function that can be used to check if the PATs are still
* functional. * functional.
* *
* @description This function is currently rate limited to 1 request per 5 minutes. * @description This function is currently rate limited to 1 request per 10 minutes.
*/ */
import retryer from "../../src/common/retryer.js"; import retryer from "../../src/common/retryer.js";
import { logger, request } from "../../src/common/utils.js"; import { logger, request } from "../../src/common/utils.js";
export const RATE_LIMIT_SECONDS = 60 * 5; // 1 request per 5 minutes export const RATE_LIMIT_SECONDS = 60 * 10; // 1 request per 10 minutes
/** /**
* Simple uptime check fetcher for the PATs. * Simple uptime check fetcher for the PATs.
-15
View File
@@ -1,15 +0,0 @@
import statsCard from "./api/index.js";
import repoCard from "./api/pin.js";
import langCard from "./api/top-langs.js";
import wakatimeCard from "./api/wakatime.js";
import express from "express";
import dotenv from "dotenv";
dotenv.config();
const app = express();
app.listen(process.env.port || 9000);
app.get("/", statsCard);
app.get("/pin", repoCard);
app.get("/top-langs", langCard);
app.get("/wakatime", wakatimeCard);
+171 -66
View File
@@ -66,7 +66,7 @@
<p align="center">Love the project? Please consider <a href="https://www.paypal.me/anuraghazra">donating</a> to help it improve!</p> <p align="center">Love the project? Please consider <a href="https://www.paypal.me/anuraghazra">donating</a> to help it improve!</p>
<a href="https://indiafightscorona.giveindia.org"> <a href="https://indiafightscorona.giveindia.org">
<img src="https://cfstatic.give.do/logo.png" alt="Give india logo" width="200" /> <img src="https://indiaspora.org/wp-content/uploads/2021/04/give-India-logo.png" alt="Give india logo" width="200" />
</a> </a>
Are you considering supporting the project by donating? Please DO NOT!! Are you considering supporting the project by donating? Please DO NOT!!
@@ -80,6 +80,9 @@ Visit <https://indiafightscorona.giveindia.org> and make a small donation to hel
# Features # Features
- [Getting Started](#getting-started)
- [GitHub Actions](#github-actions-recommended)
- [Community Deployment](#community-deployment)
- [GitHub Stats Card](#github-stats-card) - [GitHub Stats Card](#github-stats-card)
- [GitHub Extra Pins](#github-extra-pins) - [GitHub Extra Pins](#github-extra-pins)
- [Top Languages Card](#top-languages-card) - [Top Languages Card](#top-languages-card)
@@ -92,21 +95,143 @@ Visit <https://indiafightscorona.giveindia.org> and make a small donation to hel
- [Repo Card Exclusive Options](#repo-card-exclusive-options) - [Repo Card Exclusive Options](#repo-card-exclusive-options)
- [Language Card Exclusive Options](#language-card-exclusive-options) - [Language Card Exclusive Options](#language-card-exclusive-options)
- [Wakatime Card Exclusive Option](#wakatime-card-exclusive-options) - [Wakatime Card Exclusive Option](#wakatime-card-exclusive-options)
- [Deploy Yourself](#deploy-on-your-own) - [Deploy Yourself](#deploy-on-your-own-vercel-instance)
- [On Vercel](#on-vercel)
- [On other platforms](#on-other-platforms)
- [Keep your fork up to date](#keep-your-fork-up-to-date) - [Keep your fork up to date](#keep-your-fork-up-to-date)
# Getting Started
# GitHub Stats Card ## GitHub Actions (Recommended)
Copy-paste this into your markdown content, and that is it. Simple! Using GitHub Actions over the community deployment is recommended because it provides more accurate stats and 100% uptime. Simply copy-paste the following into the `/.github/workflows/grs.yml` file in your README repo (`USERNAME/USERNAME`).
Change the `?username=` value to your GitHub username. ```yml
name: GitHub Readme Stats
on:
workflow_dispatch:
schedule:
- cron: 0 * * * *
jobs:
grs:
permissions: write-all
runs-on: ubuntu-latest
name: Generate Stats
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate Stats
uses: Zo-Bro-23/grs-action@v1
id: generate
with:
token: ${{ secrets.GITHUB_TOKEN }}
options: 'username=${{ github.repository_owner }}'
- name: Push
uses: crazy-max/ghaction-github-pages@v3
with:
target_branch: grs
build_dir: grs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
If you want to generate multiple stats, such as top languages, wakatime, etc, you can use the following code.
```yml
name: GitHub Readme Stats
on:
workflow_dispatch:
schedule:
- cron: 0 * * * *
jobs:
stats:
permissions: write-all
runs-on: ubuntu-latest
name: Stats Card
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate Stats
uses: Zo-Bro-23/grs-action@v1
id: generate
with:
token: ${{ secrets.GITHUB_TOKEN }}
options: 'username=${{ github.repository_owner }}'
- uses: actions/upload-artifact@master
with:
name: stats
path: grs
top-langs:
permissions: write-all
runs-on: ubuntu-latest
name: Top Languages Card
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Generate Top Languages
uses: Zo-Bro-23/grs-action@v1
id: generate
with:
token: ${{ secrets.GITHUB_TOKEN }}
options: 'username=${{ github.repository_owner }}'
card: 'top-langs'
- uses: actions/upload-artifact@master
with:
name: top-langs
path: grs
push:
permissions: write-all
runs-on: ubuntu-latest
name: Push
needs: [stats, top-langs]
steps:
- uses: actions/download-artifact@master
with:
name: stats
path: grs
- uses: actions/download-artifact@master
with:
name: top-langs
path: grs
- name: Push
uses: crazy-max/ghaction-github-pages@v3
with:
target_branch: grs
build_dir: grs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
```
You can now include the stats in your README by using the following markdown code (replace `USERNAME` with your GitHub username).
```md
[![Your GitHub stats](https://github.com/USERNAME/USERNAME/raw/grs/stats.svg)](https://github.com/anuraghazra/github-readme-stats)
```
You can also enable GitHub Pages on the `grs` branch (root) and use that URL (replace `GH_PAGES_URL` with your GitHub Pages URL).
```md
[![Your GitHub stats](https://GH_PAGES_URL/stats.svg)](https://github.com/anuraghazra/github-readme-stats)
```
The GitHub Action accepts the following inputs:
- `token` - `REQUIRED` - Your GitHub Personal Access Token (PAT), or any other token that GitHub accepts.
- `options` - `REQUIRED` - Any customization options. More below. (This is the same as the query string you would pass to the API if using the community deployment)
- `card` - The type of card to generate. `repo`, `top-langs`, or `wakatime` (leave empty for stats card).
- `path` - Output path for SVG file. Relative path; include filename with `.svg`.
- `fetch_multipage` - Experimental feature that gives more accurate stats if you have >100 repos.
## Community Deployment
Copy-paste the following markdown code. Change the `?username=` value to your GitHub username.
```md ```md
[![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra)](https://github.com/anuraghazra/github-readme-stats) [![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra)](https://github.com/anuraghazra/github-readme-stats)
``` ```
Other cards can be included by using `/api/top-langs`, `/api/pin`, or `/api/wakatime`. More customization options can be added by using query parameters (`&option1=value1&option2=value2&...`).
# GitHub Stats Card
> **Note** > **Note**
> Available ranks are S+ (top 1%), S (top 25%), A++ (top 45%), A+ (top 60%), and B+ (everyone). The values are calculated by using the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) using commits, contributions, issues, stars, pull requests, followers, and owned repositories. The implementation can be investigated at [src/calculateRank.js](./src/calculateRank.js). > Available ranks are S+ (top 1%), S (top 25%), A++ (top 45%), A+ (top 60%), and B+ (everyone). The values are calculated by using the [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) using commits, contributions, issues, stars, pull requests, followers, and owned repositories. The implementation can be investigated at [src/calculateRank.js](./src/calculateRank.js).
@@ -117,7 +242,7 @@ You can pass a query parameter `&hide=` to hide any specific stats with comma-se
> Options: `&hide=stars,commits,prs,issues,contribs` > Options: `&hide=stars,commits,prs,issues,contribs`
```md ```md
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&hide=contribs,prs) ?username=anuraghazra&hide=contribs,prs
``` ```
### Adding private contributions count to total commits count ### Adding private contributions count to total commits count
@@ -130,15 +255,15 @@ You can add the count of all your private contributions to the total commits cou
> Options: `&count_private=true` > Options: `&count_private=true`
```md ```md
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&count_private=true) ?username=anuraghazra&count_private=true
``` ```
### Showing icons ### Showing icons
To enable icons, you can pass `&show_icons=true` in the query param, like so: To enable icons, you can pass `show_icons=true` in the query param, like so:
```md ```md
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true) ?username=anuraghazra&show_icons=true
``` ```
### Themes ### Themes
@@ -148,7 +273,7 @@ With inbuilt themes, you can customize the look of the card without doing any [m
Use `&theme=THEME_NAME` parameter like so : Use `&theme=THEME_NAME` parameter like so :
```md ```md
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=radical) ?username=anuraghazra&show_icons=true&theme=radical
``` ```
#### All inbuilt themes #### All inbuilt themes
@@ -171,7 +296,7 @@ Since GitHub will re-upload the cards and serve them from their [CDN](https://do
We have included a `transparent` theme that has a transparent background. This theme is optimized to look good on GitHub's dark and light default themes. You can enable this theme using the `&theme=transparent` parameter like so: We have included a `transparent` theme that has a transparent background. This theme is optimized to look good on GitHub's dark and light default themes. You can enable this theme using the `&theme=transparent` parameter like so:
```md ```md
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=transparent) ?username=anuraghazra&show_icons=true&theme=transparent
``` ```
<details> <details>
@@ -186,7 +311,7 @@ We have included a `transparent` theme that has a transparent background. This t
You can use the `bg_color` parameter to make any of [the available themes](./themes/README.md) transparent. This is done by setting the `bg_color` to a colour with a transparent alpha channel (i.e. `bg_color=00000000`): You can use the `bg_color` parameter to make any of [the available themes](./themes/README.md) transparent. This is done by setting the `bg_color` to a colour with a transparent alpha channel (i.e. `bg_color=00000000`):
```md ```md
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&bg_color=00000000) ?username=anuraghazra&show_icons=true&bg_color=00000000
``` ```
<details> <details>
@@ -201,8 +326,8 @@ You can use the `bg_color` parameter to make any of [the available themes](./the
You can use [GitHub's theme context](https://github.blog/changelog/2021-11-24-specify-theme-context-for-images-in-markdown/) tags to switch the theme based on the user GitHub theme automatically. This is done by appending `#gh-dark-mode-only` or `#gh-light-mode-only` to the end of an image URL. This tag will define whether the image specified in the markdown is only shown to viewers using a light or a dark GitHub theme: You can use [GitHub's theme context](https://github.blog/changelog/2021-11-24-specify-theme-context-for-images-in-markdown/) tags to switch the theme based on the user GitHub theme automatically. This is done by appending `#gh-dark-mode-only` or `#gh-light-mode-only` to the end of an image URL. This tag will define whether the image specified in the markdown is only shown to viewers using a light or a dark GitHub theme:
```md ```md
[![Anurag's GitHub stats-Dark](https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=dark#gh-dark-mode-only)](https://github.com/anuraghazra/github-readme-stats#gh-dark-mode-only) [![Anurag's GitHub stats-Dark](https://DARK_SVG_URL/#gh-dark-mode-only)](https://github.com/anuraghazra/github-readme-stats#gh-dark-mode-only)
[![Anurag's GitHub stats-Light](https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=default#gh-light-mode-only)](https://github.com/anuraghazra/github-readme-stats#gh-light-mode-only) [![Anurag's GitHub stats-Light](https://LIGHT_SVG_URL/#gh-light-mode-only)](https://github.com/anuraghazra/github-readme-stats#gh-light-mode-only)
``` ```
<details> <details>
@@ -220,14 +345,14 @@ You can use [GitHub's new media feature](https://github.blog/changelog/2022-05-1
```html ```html
<picture> <picture>
<source <source
srcset="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=dark" srcset="https://DARK_SVG_URL/"
media="(prefers-color-scheme: dark)" media="(prefers-color-scheme: dark)"
/> />
<source <source
srcset="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true" srcset="https://LIGHT_SVG_URL/"
media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)" media="(prefers-color-scheme: light), (prefers-color-scheme: no-preference)"
/> />
<img src="https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true" /> <img src="https://DEFAULT_SVG_URL/" />
</picture> </picture>
``` ```
@@ -250,7 +375,7 @@ You can use [GitHub's new media feature](https://github.blog/changelog/2022-05-1
### Customization ### Customization
You can customize the appearance of your `Stats Card` or `Repo Card` however you wish with URL parameters. You can customize the appearance of your cards however you wish with these parameters.
#### Common Options #### Common Options
@@ -266,7 +391,7 @@ You can customize the appearance of your `Stats Card` or `Repo Card` however you
- `border_radius` - Corner rounding on the card. Default: `4.5`. - `border_radius` - Corner rounding on the card. Default: `4.5`.
> **Warning** > **Warning**
> We use caching to decrease the load on our servers (see <https://github.com/anuraghazra/github-readme-stats/issues/1471#issuecomment-1271551425>). Our cards have a default cache of 4 hours (14400 seconds). Also, note that the cache is clamped to a minimum of 4 hours and a maximum of 24 hours. > We use caching to decrease the load on our servers (see <https://github.com/anuraghazra/github-readme-stats/issues/1471#issuecomment-1271551425>). Our cards have a default cache of 4 hours (14400 seconds). Also, note that the cache is clamped to a minimum of 4 hours and a maximum of 24 hours. This is why we recommend using our GitHub Action :)
##### Gradient in bg_color ##### Gradient in bg_color
@@ -289,7 +414,6 @@ You can provide multiple comma-separated values in the bg_color option to render
- `text_bold` - Use bold text _(boolean)_. Default: `true`. - `text_bold` - Use bold text _(boolean)_. Default: `true`.
- `disable_animations` - Disables all animations in the card _(boolean)_. Default: `false`. - `disable_animations` - Disables all animations in the card _(boolean)_. Default: `false`.
- `ring_color` - Color of the rank circle _(hex color)_. Defaults to the theme ring color if it exists and otherwise the title color. - `ring_color` - Color of the rank circle _(hex color)_. Defaults to the theme ring color if it exists and otherwise the title color.
- `number_format` - Switch between two available formats for displaying the card values `short` (i.e. `6.6k`) and `long` (i.e. `6626`). Default: `short`.
> **Note** > **Note**
> When hide_rank=`true`, the minimum card width is 270 px + the title length and padding. > When hide_rank=`true`, the minimum card width is 270 px + the title length and padding.
@@ -337,13 +461,7 @@ Yay! You are no longer limited to 6 pinned repositories.
### Usage ### Usage
Copy-paste this code into your readme and change the links. Use the `api/pin` endpoint with the API or the `card: 'repo'` option with the GitHub Action.
Endpoint: `api/pin?username=anuraghazra&repo=github-readme-stats`
```md
[![Readme Card](https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats)](https://github.com/anuraghazra/github-readme-stats)
```
### Demo ### Demo
@@ -358,24 +476,18 @@ Use [show_owner](#customization) variable to include the repo's owner username
The top languages card shows a GitHub user's most frequently used top language. The top languages card shows a GitHub user's most frequently used top language.
> **Note** > **Note**
> Top Languages does not indicate my skill level or anything like that; it's a GitHub metric to determine which languages have the most code on GitHub. It is a new feature of github-readme-stats. > Top Languages does not indicate skill level or anything like that; it's a GitHub metric to determine which languages have the most code on GitHub.
### Usage ### Usage
Copy-paste this code into your readme and change the links. Use the `api/top-langs` endpoint with the API or the `card: 'top-langs'` option with the GitHub Action.
Endpoint: `api/top-langs?username=anuraghazra`
```md
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra)](https://github.com/anuraghazra/github-readme-stats)
```
### Exclude individual repositories ### Exclude individual repositories
You can use the `&exclude_repo=repo1,repo2` parameter to exclude individual repositories. You can use the `&exclude_repo=repo1,repo2` parameter to exclude individual repositories.
```md ```md
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&exclude_repo=github-readme-stats,anuraghazra.github.io)](https://github.com/anuraghazra/github-readme-stats) ?username=anuraghazra&exclude_repo=github-readme-stats,anuraghazra.github.io
``` ```
### Hide individual languages ### Hide individual languages
@@ -383,7 +495,7 @@ You can use the `&exclude_repo=repo1,repo2` parameter to exclude individual repo
You can use `&hide=language1,language2` parameter to hide individual languages. You can use `&hide=language1,language2` parameter to hide individual languages.
```md ```md
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&hide=javascript,html)](https://github.com/anuraghazra/github-readme-stats) ?username=anuraghazra&hide=javascript,html
``` ```
### Show more languages ### Show more languages
@@ -391,7 +503,7 @@ You can use `&hide=language1,language2` parameter to hide individual languages.
You can use the `&langs_count=` option to increase or decrease the number of languages shown on the card. Valid values are integers between 1 and 10 (inclusive), and the default is 5. You can use the `&langs_count=` option to increase or decrease the number of languages shown on the card. Valid values are integers between 1 and 10 (inclusive), and the default is 5.
```md ```md
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&langs_count=8)](https://github.com/anuraghazra/github-readme-stats) ?username=anuraghazra&langs_count=8
``` ```
### Compact Language Card Layout ### Compact Language Card Layout
@@ -399,7 +511,7 @@ You can use the `&langs_count=` option to increase or decrease the number of lan
You can use the `&layout=compact` option to change the card design. You can use the `&layout=compact` option to change the card design.
```md ```md
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&layout=compact)](https://github.com/anuraghazra/github-readme-stats) ?username=anuraghazra&layout=compact
``` ```
### Hide Progress Bars ### Hide Progress Bars
@@ -407,7 +519,7 @@ You can use the `&layout=compact` option to change the card design.
You can use the `&hide_progress=true` option to hide the percentages and the progress bars (layout will be automatically set to `compact`). You can use the `&hide_progress=true` option to hide the percentages and the progress bars (layout will be automatically set to `compact`).
```md ```md
[![Top Langs](https://github-readme-stats.vercel.app/api/top-langs/?username=anuraghazra&hide_progress=true)](https://github.com/anuraghazra/github-readme-stats) ?username=anuraghazra&hide_progress=true
``` ```
### Demo ### Demo
@@ -424,15 +536,27 @@ You can use the `&hide_progress=true` option to hide the percentages and the pro
# Wakatime Week Stats # Wakatime Week Stats
### Usage
Use the `api/wkatime` endpoint with the API or the `card: 'wakatime'` option with the GitHub Action.
Change the `?username=` value to your [Wakatime](https://wakatime.com) username. Change the `?username=` value to your [Wakatime](https://wakatime.com) username.
```md ```md
[![willianrod's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=willianrod)](https://github.com/anuraghazra/github-readme-stats) ?username=willianrod
``` ```
> **Note**: > **Note**:
> Please be aware that we currently only show data from Wakatime profiles that are public. > Please be aware that we currently only show data from Wakatime profiles that are public.
### Compact Wakatime Card Layout
You can use the `&layout=compact` option to change the card design.
```md
?username=willianrod&layout=compact
```
### Demo ### Demo
[![willianrod's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=willianrod)](https://github.com/anuraghazra/github-readme-stats) [![willianrod's wakatime stats](https://github-readme-stats.vercel.app/api/wakatime?username=willianrod)](https://github.com/anuraghazra/github-readme-stats)
@@ -505,16 +629,14 @@ By default, GitHub does not lay out the cards side by side. To do that, you can
```html ```html
<a href="https://github.com/anuraghazra/github-readme-stats"> <a href="https://github.com/anuraghazra/github-readme-stats">
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats" /> <img align="center" src="https://SVG_URL/" />
</a> </a>
<a href="https://github.com/anuraghazra/convoychat"> <a href="https://github.com/anuraghazra/convoychat">
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=convoychat" /> <img align="center" src="https://SVG_URL/" />
</a> </a>
``` ```
## Deploy on your own ## Deploy your own Vercel instance
### On Vercel
#### :film_projector: [Check Out Step By Step Video Tutorial By @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107) #### :film_projector: [Check Out Step By Step Video Tutorial By @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
@@ -551,26 +673,9 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme
</details> </details>
### On other platforms
> **Warning**
> This way of using GRS is not officially supported and was added to cater to some particular use cases where Vercel could not be used (e.g. #2341). The support for this method, therefore, is limited.
<details>
<summary><b>:hammer_and_wrench: Step-by-step guide for deploying on other platforms</b></summary>
1. Fork or clone this repo as per your needs
2. Add `express` to the dependencies section of `package.json`
https://github.com/anuraghazra/github-readme-stats/blob/ba7c2f8b55eac8452e479c8bd38b044d204d0424/package.json#L54-L61
3. Run `npm i` if needed (initial setup)
4. Run `node express.js` to start the server, or set the entry point to `express.js` in `package.json` if you're deploying on a managed service
https://github.com/anuraghazra/github-readme-stats/blob/ba7c2f8b55eac8452e479c8bd38b044d204d0424/package.json#L11
5. You're done 🎉
</details>
### Keep your fork up to date ### Keep your fork up to date
You can keep your fork, and thus your private Vercel instance up to date with the upstream using GitHubs' [Sync Fork button](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork). You can also use the [pull](https://github.com/wei/pull) package created by [@wei](https://github.com/wei) to automate this process. You can keep your fork, and thus your private Vercel instance up to date with the upstream using GitHub's [Sync Fork button](https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork). You can also use the [pull](https://github.com/wei/pull) package created by [@wei](https://github.com/wei) to automate this process.
## :sparkling_heart: Support the project ## :sparkling_heart: Support the project
+60 -128
View File
@@ -43,23 +43,6 @@ const ACCEPTED_COLOR_PROPS = Object.keys(COLOR_PROPS);
const REQUIRED_COLOR_PROPS = ACCEPTED_COLOR_PROPS.slice(0, 4); const REQUIRED_COLOR_PROPS = ACCEPTED_COLOR_PROPS.slice(0, 4);
const INVALID_REVIEW_COMMENT = (commentUrl) => const INVALID_REVIEW_COMMENT = (commentUrl) =>
`Some themes are invalid. See the [Automated Theme Preview](${commentUrl}) comment above for more information.`; `Some themes are invalid. See the [Automated Theme Preview](${commentUrl}) comment above for more information.`;
var OCTOKIT;
var OWNER;
var REPO;
var PULL_REQUEST_ID;
/**
* Incorrect JSON format error.
* @extends Error
* @param {string} message Error message.
* @returns {Error} IncorrectJsonFormatError.
*/
class IncorrectJsonFormatError extends Error {
constructor(message) {
super(message);
this.name = "IncorrectJsonFormatError";
}
}
/** /**
* Retrieve PR number from the event payload. * Retrieve PR number from the event payload.
@@ -143,36 +126,15 @@ const findComment = async (octokit, issueNumber, owner, repo, commenter) => {
* Create or update the preview comment. * Create or update the preview comment.
* *
* @param {Object} octokit Octokit instance. * @param {Object} octokit Octokit instance.
* @param {number} issueNumber Issue number. * @param {Object} props Comment properties.
* @param {Object} repo Repository name.
* @param {Object} owner Owner of the repository.
* @param {number} commentId Comment ID.
* @param {string} body Comment body.
* @return {string} The comment URL. * @return {string} The comment URL.
*/ */
const upsertComment = async ( const upsertComment = async (octokit, props) => {
octokit,
issueNumber,
repo,
owner,
commentId,
body,
) => {
let resp; let resp;
if (commentId !== undefined) { if (props.comment_id !== undefined) {
resp = await octokit.issues.updateComment({ resp = await octokit.issues.updateComment(props);
owner,
repo,
comment_id: commentId,
body,
});
} else { } else {
resp = await octokit.issues.createComment({ resp = await octokit.issues.createComment(props);
owner,
repo,
issue_number: issueNumber,
body,
});
} }
return resp.data.html_url; return resp.data.html_url;
}; };
@@ -307,38 +269,22 @@ const parseJSON = (json) => {
if (typeof parsedJson === "object") { if (typeof parsedJson === "object") {
return parsedJson; return parsedJson;
} else { } else {
throw new IncorrectJsonFormatError( throw new Error("PR diff is not a valid theme JSON object.");
"PR diff is not a valid theme JSON object.",
);
} }
} catch (error) { } catch (error) {
// Remove trailing commas (if any). let parsedJson = json
let parsedJson = json.replace(/(,\s*})/g, "}");
// Remove JS comments (if any).
parsedJson = parsedJson.replace(/\/\/[A-z\s]*\s/g, "");
// Fix incorrect open bracket (if any).
const splitJson = parsedJson
.split(/([\s\r\s]*}[\s\r\s]*,[\s\r\s]*)(?=[\w"-]+:)/) .split(/([\s\r\s]*}[\s\r\s]*,[\s\r\s]*)(?=[\w"-]+:)/)
.filter((x) => typeof x !== "string" || !!x.trim()); // Split json into array of strings and objects. .filter((x) => typeof x !== "string" || !!x.trim());
if (splitJson[0].replace(/\s+/g, "") === "},") { if (parsedJson[0].replace(/\s+/g, "") === "},") {
splitJson[0] = "},"; parsedJson[0] = "},";
if (!/\s*}\s*,?\s*$/.test(splitJson[1])) { if (!/\s*}\s*,?\s*$/.test(parsedJson[1])) {
splitJson.push(splitJson.shift()); parsedJson.push(parsedJson.shift());
} else { } else {
splitJson.shift(); parsedJson.shift();
} }
parsedJson = splitJson.join(""); return Hjson.parse(parsedJson.join(""));
} } else {
throw error;
// Try to parse the fixed json.
try {
return Hjson.parse(parsedJson);
} catch (error) {
throw new IncorrectJsonFormatError(
`Theme JSON file could not be parsed: ${error.message}`,
);
} }
} }
}; };
@@ -352,13 +298,12 @@ const themeNameAlreadyExists = (name) => {
return themes[name] !== undefined; return themes[name] !== undefined;
}; };
const DRY_RUN = process.env.DRY_RUN === "true" || false;
/** /**
* Main function. * Main function.
*/ */
export const run = async () => { export const run = async (prNumber) => {
try { try {
const dryRun = process.env.DRY_RUN === "true" || false;
debug("Retrieve action information from context..."); debug("Retrieve action information from context...");
debug(`Context: ${inspect(github.context)}`); debug(`Context: ${inspect(github.context)}`);
let commentBody = ` let commentBody = `
@@ -366,50 +311,40 @@ export const run = async () => {
\r${THEME_CONTRIB_GUIDELINESS} \r${THEME_CONTRIB_GUIDELINESS}
`; `;
const ccc = new ColorContrastChecker(); const ccc = new ColorContrastChecker();
OCTOKIT = github.getOctokit(getGithubToken()); const octokit = github.getOctokit(getGithubToken());
PULL_REQUEST_ID = getPrNumber(); const pullRequestId = prNumber ? prNumber : getPrNumber();
const { owner, repo } = getRepoInfo(github.context);
OWNER = owner;
REPO = repo;
const commenter = getCommenter(); const commenter = getCommenter();
PULL_REQUEST_ID = getPrNumber(); const { owner, repo } = getRepoInfo(github.context);
debug(`Owner: ${OWNER}`); debug(`Owner: ${owner}`);
debug(`Repo: ${REPO}`); debug(`Repo: ${repo}`);
debug(`Commenter: ${commenter}`); debug(`Commenter: ${commenter}`);
// Retrieve the PR diff and preview-theme comment. // Retrieve the PR diff and preview-theme comment.
debug("Retrieve PR diff..."); debug("Retrieve PR diff...");
const res = await OCTOKIT.pulls.get({ const res = await octokit.pulls.get({
owner: OWNER, owner,
repo: REPO, repo,
pull_number: PULL_REQUEST_ID, pull_number: pullRequestId,
mediaType: { mediaType: {
format: "diff", format: "diff",
}, },
}); });
debug("Retrieve preview-theme comment..."); debug("Retrieve preview-theme comment...");
const comment = await findComment( const comment = await findComment(
OCTOKIT, octokit,
PULL_REQUEST_ID, pullRequestId,
OWNER, owner,
REPO, repo,
commenter, commenter,
); );
// Retrieve theme changes from the PR diff. // Retrieve theme changes from the PR diff.
debug("Retrieve themes..."); debug("Retrieve themes...");
const diff = parse(res.data); const diff = parse(res.data);
// Retrieve all theme changes from the PR diff and convert to JSON.
debug("Retrieve theme changes...");
const content = diff const content = diff
.find((file) => file.to === "themes/index.js") .find((file) => file.to === "themes/index.js")
.chunks.map((chunk) => .chunks[0].changes.filter((c) => c.type === "add")
chunk.changes .map((c) => c.content.replace("+", ""))
.filter((c) => c.type === "add")
.map((c) => c.content.replace("+", ""))
.join(""),
)
.join(""); .join("");
const themeObject = parseJSON(content); const themeObject = parseJSON(content);
if ( if (
@@ -578,15 +513,14 @@ export const run = async () => {
// Create or update theme-preview comment. // Create or update theme-preview comment.
debug("Create or update theme-preview comment..."); debug("Create or update theme-preview comment...");
let comment_url; let comment_url;
if (!DRY_RUN) { if (!dryRun) {
comment_url = await upsertComment( comment_url = await upsertComment(octokit, {
OCTOKIT, comment_id: comment?.id,
PULL_REQUEST_ID, issue_number: pullRequestId,
REPO, owner,
OWNER, repo,
comment?.id, body: commentBody,
commentBody, });
);
} else { } else {
info(`DRY_RUN: Comment body: ${commentBody}`); info(`DRY_RUN: Comment body: ${commentBody}`);
comment_url = ""; comment_url = "";
@@ -601,20 +535,20 @@ export const run = async () => {
const reviewReason = themesValid const reviewReason = themesValid
? undefined ? undefined
: INVALID_REVIEW_COMMENT(comment_url); : INVALID_REVIEW_COMMENT(comment_url);
if (!DRY_RUN) { if (!dryRun) {
await addReview( await addReview(
OCTOKIT, octokit,
PULL_REQUEST_ID, pullRequestId,
OWNER, owner,
REPO, repo,
reviewState, reviewState,
reviewReason, reviewReason,
); );
await addRemoveLabel( await addRemoveLabel(
OCTOKIT, octokit,
PULL_REQUEST_ID, pullRequestId,
OWNER, owner,
REPO, repo,
"invalid", "invalid",
!themesValid, !themesValid,
); );
@@ -624,22 +558,20 @@ export const run = async () => {
} }
} catch (error) { } catch (error) {
debug("Set review state to `REQUEST_CHANGES` and add `invalid` label..."); debug("Set review state to `REQUEST_CHANGES` and add `invalid` label...");
if (!DRY_RUN) { if (!dryRun) {
await addReview( await addReview(
OCTOKIT, octokit,
PULL_REQUEST_ID, pullRequestId,
OWNER, owner,
REPO, repo,
"REQUEST_CHANGES", "REQUEST_CHANGES",
"**Something went wrong in the theme preview action:** `" + error.message,
error.message +
"`",
); );
await addRemoveLabel( await addRemoveLabel(
OCTOKIT, octokit,
PULL_REQUEST_ID, pullRequestId,
OWNER, owner,
REPO, repo,
"invalid", "invalid",
true, true,
); );
-1
View File
@@ -6,7 +6,6 @@ export BRANCH_NAME=updated-theme-readme
git --version git --version
git config --global user.email "no-reply@githubreadmestats.com" git config --global user.email "no-reply@githubreadmestats.com"
git config --global user.name "GitHub Readme Stats Bot" git config --global user.name "GitHub Readme Stats Bot"
git config --global --add safe.directory ${GITHUB_WORKSPACE}
git branch -d $BRANCH_NAME || true git branch -d $BRANCH_NAME || true
git checkout -b $BRANCH_NAME git checkout -b $BRANCH_NAME
git add --all git add --all
+1 -5
View File
@@ -39,10 +39,8 @@ const createTextNode = ({
showIcons, showIcons,
shiftValuePos, shiftValuePos,
bold, bold,
number_format,
}) => { }) => {
const kValue = const kValue = kFormatter(value);
number_format.toLowerCase() === "long" ? value : kFormatter(value);
const staggerDelay = (index + 3) * 150; const staggerDelay = (index + 3) * 150;
const labelOffset = showIcons ? `x="25"` : ""; const labelOffset = showIcons ? `x="25"` : "";
@@ -105,7 +103,6 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
custom_title, custom_title,
border_radius, border_radius,
border_color, border_color,
number_format = "short",
locale, locale,
disable_animations = false, disable_animations = false,
} = options; } = options;
@@ -195,7 +192,6 @@ const renderStatsCard = (stats = {}, options = { hide: [] }) => {
showIcons: show_icons, showIcons: show_icons,
shiftValuePos: 79.01 + (isLongLocale ? 50 : 0), shiftValuePos: 79.01 + (isLongLocale ? 50 : 0),
bold: text_bold, bold: text_bold,
number_format,
}), }),
); );
+2 -1
View File
@@ -13,7 +13,7 @@ import {
import { langCardLocales } from "../translations.js"; import { langCardLocales } from "../translations.js";
const DEFAULT_CARD_WIDTH = 300; const DEFAULT_CARD_WIDTH = 300;
const MIN_CARD_WIDTH = 280; const MIN_CARD_WIDTH = 230;
const DEFAULT_LANGS_COUNT = 5; const DEFAULT_LANGS_COUNT = 5;
const DEFAULT_LANG_COLOR = "#858585"; const DEFAULT_LANG_COLOR = "#858585";
const CARD_PADDING = 25; const CARD_PADDING = 25;
@@ -317,6 +317,7 @@ const renderTopLanguages = (topLangs, options = {}) => {
let finalLayout = ""; let finalLayout = "";
if (layout === "compact" || hide_progress == true) { if (layout === "compact" || hide_progress == true) {
width = width + 50; // padding
height = height =
calculateCompactLayoutHeight(langs.length) + (hide_progress ? -25 : 0); calculateCompactLayoutHeight(langs.length) + (hide_progress ? -25 : 0);
-1
View File
@@ -22,7 +22,6 @@ export type StatCardOptions = CommonOptions & {
line_height: number | string; line_height: number | string;
custom_title: string; custom_title: string;
disable_animations: boolean; disable_animations: boolean;
number_format: string;
}; };
export type RepoCardOptions = CommonOptions & { export type RepoCardOptions = CommonOptions & {
+1 -25
View File
@@ -118,7 +118,6 @@ const createTextNode = ({
// @ts-ignore // @ts-ignore
name: label, name: label,
progressBarBackgroundColor, progressBarBackgroundColor,
delay: staggerDelay + 300,
}); });
return ` return `
@@ -277,12 +276,11 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
} else { } else {
finalLayout = flexLayout({ finalLayout = flexLayout({
items: filteredLanguages.length items: filteredLanguages.length
? filteredLanguages.map((language, index) => { ? filteredLanguages.map((language) => {
return createTextNode({ return createTextNode({
id: language.name, id: language.name,
label: language.name, label: language.name,
value: language.text, value: language.text,
index: index,
percent: language.percent, percent: language.percent,
// @ts-ignore // @ts-ignore
progressBarColor: titleColor, progressBarColor: titleColor,
@@ -323,29 +321,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
card.setCSS( card.setCSS(
` `
${cssStyles} ${cssStyles}
@keyframes slideInAnimation {
from {
width: 0;
}
to {
width: calc(100%-100px);
}
}
@keyframes growWidthAnimation {
from {
width: 0;
}
to {
width: 100%;
}
}
.lang-name { font: 400 11px 'Segoe UI', Ubuntu, Sans-Serif; fill: ${textColor} } .lang-name { font: 400 11px 'Segoe UI', Ubuntu, Sans-Serif; fill: ${textColor} }
#rect-mask rect{
animation: slideInAnimation 1s ease-in-out forwards;
}
.lang-progress{
animation: growWidthAnimation 0.6s ease-in-out forwards;
}
`, `,
); );
+2 -13
View File
@@ -79,7 +79,6 @@
"Ceylon": "#dfa535", "Ceylon": "#dfa535",
"Chapel": "#8dc63f", "Chapel": "#8dc63f",
"ChucK": "#3f8000", "ChucK": "#3f8000",
"Circom": "#707575",
"Cirru": "#ccccff", "Cirru": "#ccccff",
"Clarion": "#db901e", "Clarion": "#db901e",
"Clarity": "#5546ff", "Clarity": "#5546ff",
@@ -117,7 +116,6 @@
"DirectX 3D File": "#aace60", "DirectX 3D File": "#aace60",
"Dockerfile": "#384d54", "Dockerfile": "#384d54",
"Dogescript": "#cca760", "Dogescript": "#cca760",
"Dotenv": "#e5d559",
"Dylan": "#6c616e", "Dylan": "#6c616e",
"E": "#ccce35", "E": "#ccce35",
"ECL": "#8a1267", "ECL": "#8a1267",
@@ -133,7 +131,6 @@
"Elixir": "#6e4a7e", "Elixir": "#6e4a7e",
"Elm": "#60B5CC", "Elm": "#60B5CC",
"Elvish": "#55BB55", "Elvish": "#55BB55",
"Elvish Transcript": "#55BB55",
"Emacs Lisp": "#c065db", "Emacs Lisp": "#c065db",
"EmberScript": "#FFF4F3", "EmberScript": "#FFF4F3",
"Erlang": "#B83998", "Erlang": "#B83998",
@@ -152,7 +149,7 @@
"Forth": "#341708", "Forth": "#341708",
"Fortran": "#4d41b1", "Fortran": "#4d41b1",
"Fortran Free Form": "#4d41b1", "Fortran Free Form": "#4d41b1",
"FreeBasic": "#141AC9", "FreeBasic": "#867db1",
"FreeMarker": "#0050b2", "FreeMarker": "#0050b2",
"Frege": "#00cafe", "Frege": "#00cafe",
"Futhark": "#5f021f", "Futhark": "#5f021f",
@@ -185,7 +182,6 @@
"Go": "#00ADD8", "Go": "#00ADD8",
"Go Checksums": "#00ADD8", "Go Checksums": "#00ADD8",
"Go Module": "#00ADD8", "Go Module": "#00ADD8",
"Godot Resource": "#355570",
"Golo": "#88562A", "Golo": "#88562A",
"Gosu": "#82937f", "Gosu": "#82937f",
"Grace": "#615f8b", "Grace": "#615f8b",
@@ -196,7 +192,6 @@
"Groovy": "#4298b8", "Groovy": "#4298b8",
"Groovy Server Pages": "#4298b8", "Groovy Server Pages": "#4298b8",
"HAProxy": "#106da9", "HAProxy": "#106da9",
"HCL": "#844FBA",
"HLSL": "#aace60", "HLSL": "#aace60",
"HOCON": "#9ff8ee", "HOCON": "#9ff8ee",
"HTML": "#e34c26", "HTML": "#e34c26",
@@ -230,7 +225,6 @@
"Isabelle ROOT": "#FEFE00", "Isabelle ROOT": "#FEFE00",
"J": "#9EEDFF", "J": "#9EEDFF",
"JAR Manifest": "#b07219", "JAR Manifest": "#b07219",
"JCL": "#d90e09",
"JFlex": "#DBCA00", "JFlex": "#DBCA00",
"JSON": "#292929", "JSON": "#292929",
"JSON with Comments": "#292929", "JSON with Comments": "#292929",
@@ -253,11 +247,9 @@
"Jsonnet": "#0064bd", "Jsonnet": "#0064bd",
"Julia": "#a270ba", "Julia": "#a270ba",
"Jupyter Notebook": "#DA5B0B", "Jupyter Notebook": "#DA5B0B",
"Just": "#384d54",
"KRL": "#28430A", "KRL": "#28430A",
"Kaitai Struct": "#773b37", "Kaitai Struct": "#773b37",
"KakouneScript": "#6f8042", "KakouneScript": "#6f8042",
"KerboScript": "#41adf0",
"KiCad Layout": "#2f4aab", "KiCad Layout": "#2f4aab",
"KiCad Legacy Layout": "#2f4aab", "KiCad Legacy Layout": "#2f4aab",
"KiCad Schematic": "#2f4aab", "KiCad Schematic": "#2f4aab",
@@ -370,7 +362,6 @@
"PicoLisp": "#6067af", "PicoLisp": "#6067af",
"PigLatin": "#fcd7de", "PigLatin": "#fcd7de",
"Pike": "#005390", "Pike": "#005390",
"PlantUML": "#fbbd16",
"PogoScript": "#d80074", "PogoScript": "#d80074",
"Polar": "#ae81ff", "Polar": "#ae81ff",
"Portugol": "#f8bd00", "Portugol": "#f8bd00",
@@ -388,7 +379,6 @@
"Puppet": "#302B6D", "Puppet": "#302B6D",
"PureBasic": "#5a6986", "PureBasic": "#5a6986",
"PureScript": "#1D222D", "PureScript": "#1D222D",
"Pyret": "#ee1e10",
"Python": "#3572A5", "Python": "#3572A5",
"Python console": "#3572A5", "Python console": "#3572A5",
"Python traceback": "#3572A5", "Python traceback": "#3572A5",
@@ -454,7 +444,6 @@
"Smalltalk": "#596706", "Smalltalk": "#596706",
"Smarty": "#f0c040", "Smarty": "#f0c040",
"Smithy": "#c44536", "Smithy": "#c44536",
"Snakemake": "#419179",
"Solidity": "#AA6746", "Solidity": "#AA6746",
"SourcePawn": "#f69e1d", "SourcePawn": "#f69e1d",
"Squirrel": "#800000", "Squirrel": "#800000",
@@ -468,7 +457,6 @@
"SugarSS": "#2fcc9f", "SugarSS": "#2fcc9f",
"SuperCollider": "#46390b", "SuperCollider": "#46390b",
"Svelte": "#ff3e00", "Svelte": "#ff3e00",
"Sway": "#dea584",
"Swift": "#F05138", "Swift": "#F05138",
"SystemVerilog": "#DAE1C2", "SystemVerilog": "#DAE1C2",
"TI Program": "#A0AA87", "TI Program": "#A0AA87",
@@ -543,6 +531,7 @@
"fish": "#4aae47", "fish": "#4aae47",
"hoon": "#00b171", "hoon": "#00b171",
"jq": "#c7254e", "jq": "#c7254e",
"just": "#384d54",
"kvlang": "#1da6e0", "kvlang": "#1da6e0",
"mIRC Script": "#3d57c3", "mIRC Script": "#3d57c3",
"mcfunction": "#E22837", "mcfunction": "#E22837",
@@ -69,29 +69,7 @@ exports[`Test Render Wakatime Card should render correctly with compact layout 1
} }
@keyframes slideInAnimation {
from {
width: 0;
}
to {
width: calc(100%-100px);
}
}
@keyframes growWidthAnimation {
from {
width: 0;
}
to {
width: 100%;
}
}
.lang-name { font: 400 11px 'Segoe UI', Ubuntu, Sans-Serif; fill: #434d58 } .lang-name { font: 400 11px 'Segoe UI', Ubuntu, Sans-Serif; fill: #434d58 }
#rect-mask rect{
animation: slideInAnimation 1s ease-in-out forwards;
}
.lang-progress{
animation: growWidthAnimation 0.6s ease-in-out forwards;
}
@@ -249,29 +227,7 @@ exports[`Test Render Wakatime Card should render correctly with compact layout w
} }
@keyframes slideInAnimation {
from {
width: 0;
}
to {
width: calc(100%-100px);
}
}
@keyframes growWidthAnimation {
from {
width: 0;
}
to {
width: 100%;
}
}
.lang-name { font: 400 11px 'Segoe UI', Ubuntu, Sans-Serif; fill: #434d58 } .lang-name { font: 400 11px 'Segoe UI', Ubuntu, Sans-Serif; fill: #434d58 }
#rect-mask rect{
animation: slideInAnimation 1s ease-in-out forwards;
}
.lang-progress{
animation: growWidthAnimation 0.6s ease-in-out forwards;
}
+3 -3
View File
@@ -15,14 +15,14 @@ const REPO = "curly-fiesta";
const USER = "catelinemnemosyne"; const USER = "catelinemnemosyne";
const STATS_DATA = { const STATS_DATA = {
name: "Cateline Mnemosyne", name: "Cateline Mnemosyne",
totalPRs: 2, totalPRs: 1,
totalCommits: 8, totalCommits: 7,
totalIssues: 1, totalIssues: 1,
totalStars: 1, totalStars: 1,
contributedTo: 1, contributedTo: 1,
rank: { rank: {
level: "A+", level: "A+",
score: 50.88831151384285, score: 50.893750297869225,
}, },
}; };
-9
View File
@@ -357,13 +357,4 @@ describe("Test renderStatsCard", () => {
document.body.innerHTML = renderStatsCard(stats, {}); document.body.innerHTML = renderStatsCard(stats, {});
expect(document.querySelector("rect")).toHaveAttribute("rx", "4.5"); expect(document.querySelector("rect")).toHaveAttribute("rx", "4.5");
}); });
it("should shorten values", () => {
stats["totalCommits"] = 1999;
document.body.innerHTML = renderStatsCard(stats);
expect(getByTestId(document.body, "commits").textContent).toBe("2k");
document.body.innerHTML = renderStatsCard(stats, { number_format: "long" });
expect(getByTestId(document.body, "commits").textContent).toBe("1999");
});
}); });
+3 -3
View File
@@ -216,7 +216,7 @@ describe("Test renderTopLanguages", () => {
); );
expect(queryAllByTestId(document.body, "lang-progress")[0]).toHaveAttribute( expect(queryAllByTestId(document.body, "lang-progress")[0]).toHaveAttribute(
"width", "width",
"100", "120",
); );
expect(queryAllByTestId(document.body, "lang-name")[1]).toHaveTextContent( expect(queryAllByTestId(document.body, "lang-name")[1]).toHaveTextContent(
@@ -224,7 +224,7 @@ describe("Test renderTopLanguages", () => {
); );
expect(queryAllByTestId(document.body, "lang-progress")[1]).toHaveAttribute( expect(queryAllByTestId(document.body, "lang-progress")[1]).toHaveAttribute(
"width", "width",
"100", "120",
); );
expect(queryAllByTestId(document.body, "lang-name")[2]).toHaveTextContent( expect(queryAllByTestId(document.body, "lang-name")[2]).toHaveTextContent(
@@ -232,7 +232,7 @@ describe("Test renderTopLanguages", () => {
); );
expect(queryAllByTestId(document.body, "lang-progress")[2]).toHaveAttribute( expect(queryAllByTestId(document.body, "lang-progress")[2]).toHaveAttribute(
"width", "width",
"50", "60",
); );
}); });
+6 -8
View File
@@ -32,11 +32,10 @@ Use `?theme=THEME_NAME` parameter like so :-
| `jolly` ![jolly][jolly] | `maroongold` ![maroongold][maroongold] | `yeblu` ![yeblu][yeblu] | | `jolly` ![jolly][jolly] | `maroongold` ![maroongold][maroongold] | `yeblu` ![yeblu][yeblu] |
| `blueberry` ![blueberry][blueberry] | `slateorange` ![slateorange][slateorange] | `kacho_ga` ![kacho_ga][kacho_ga] | | `blueberry` ![blueberry][blueberry] | `slateorange` ![slateorange][slateorange] | `kacho_ga` ![kacho_ga][kacho_ga] |
| `outrun` ![outrun][outrun] | `ocean_dark` ![ocean_dark][ocean_dark] | `city_lights` ![city_lights][city_lights] | | `outrun` ![outrun][outrun] | `ocean_dark` ![ocean_dark][ocean_dark] | `city_lights` ![city_lights][city_lights] |
| `github_dark` ![github_dark][github_dark] | `github_dark_dimmed` ![github_dark_dimmed][github_dark_dimmed] | `discord_old_blurple` ![discord_old_blurple][discord_old_blurple] | | `github_dark` ![github_dark][github_dark] | `discord_old_blurple` ![discord_old_blurple][discord_old_blurple] | `aura_dark` ![aura_dark][aura_dark] |
| `panda` ![panda][panda] | `noctis_minimus` ![noctis_minimus][noctis_minimus] | `cobalt2` ![cobalt2][cobalt2] | | `panda` ![panda][panda] | `noctis_minimus` ![noctis_minimus][noctis_minimus] | `cobalt2` ![cobalt2][cobalt2] |
| `swift` ![swift][swift] | `aura` ![aura][aura] | `apprentice` ![apprentice][apprentice] | | `swift` ![swift][swift] | `aura` ![aura][aura] | `apprentice` ![apprentice][apprentice] |
| `moltack` ![moltack][moltack] | `codeSTACKr` ![codeSTACKr][codeSTACKr] | `rose_pine` ![rose_pine][rose_pine] | | `moltack` ![moltack][moltack] | `codeSTACKr` ![codeSTACKr][codeSTACKr] | `rose_pine` ![rose_pine][rose_pine] |
| `aura_dark` ![aura_dark][aura_dark] | | |
| [Add your theme][add-theme] | | | | [Add your theme][add-theme] | | |
## Repo Card ## Repo Card
@@ -61,11 +60,10 @@ Use `?theme=THEME_NAME` parameter like so :-
| `jolly` ![jolly][jolly_repo] | `maroongold` ![maroongold][maroongold_repo] | `yeblu` ![yeblu][yeblu_repo] | | `jolly` ![jolly][jolly_repo] | `maroongold` ![maroongold][maroongold_repo] | `yeblu` ![yeblu][yeblu_repo] |
| `blueberry` ![blueberry][blueberry_repo] | `slateorange` ![slateorange][slateorange_repo] | `kacho_ga` ![kacho_ga][kacho_ga_repo] | | `blueberry` ![blueberry][blueberry_repo] | `slateorange` ![slateorange][slateorange_repo] | `kacho_ga` ![kacho_ga][kacho_ga_repo] |
| `outrun` ![outrun][outrun_repo] | `ocean_dark` ![ocean_dark][ocean_dark_repo] | `city_lights` ![city_lights][city_lights_repo] | | `outrun` ![outrun][outrun_repo] | `ocean_dark` ![ocean_dark][ocean_dark_repo] | `city_lights` ![city_lights][city_lights_repo] |
| `github_dark` ![github_dark][github_dark_repo] | `github_dark_dimmed` ![github_dark_dimmed][github_dark_dimmed_repo] | `discord_old_blurple` ![discord_old_blurple][discord_old_blurple_repo] | | `github_dark` ![github_dark][github_dark_repo] | `discord_old_blurple` ![discord_old_blurple][discord_old_blurple_repo] | `aura_dark` ![aura_dark][aura_dark_repo] |
| `panda` ![panda][panda_repo] | `noctis_minimus` ![noctis_minimus][noctis_minimus_repo] | `cobalt2` ![cobalt2][cobalt2_repo] | | `panda` ![panda][panda_repo] | `noctis_minimus` ![noctis_minimus][noctis_minimus_repo] | `cobalt2` ![cobalt2][cobalt2_repo] |
| `swift` ![swift][swift_repo] | `aura` ![aura][aura_repo] | `apprentice` ![apprentice][apprentice_repo] | | `swift` ![swift][swift_repo] | `aura` ![aura][aura_repo] | `apprentice` ![apprentice][apprentice_repo] |
| `moltack` ![moltack][moltack_repo] | `codeSTACKr` ![codeSTACKr][codeSTACKr_repo] | `rose_pine` ![rose_pine][rose_pine_repo] | | `moltack` ![moltack][moltack_repo] | `codeSTACKr` ![codeSTACKr][codeSTACKr_repo] | `rose_pine` ![rose_pine][rose_pine_repo] |
| `aura_dark` ![aura_dark][aura_dark_repo] | | |
| [Add your theme][add-theme] | | | | [Add your theme][add-theme] | | |
@@ -119,8 +117,8 @@ Use `?theme=THEME_NAME` parameter like so :-
[ocean_dark]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=ocean_dark [ocean_dark]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=ocean_dark
[city_lights]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=city_lights [city_lights]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=city_lights
[github_dark]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=github_dark [github_dark]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=github_dark
[github_dark_dimmed]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=github_dark_dimmed
[discord_old_blurple]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=discord_old_blurple [discord_old_blurple]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=discord_old_blurple
[aura_dark]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=aura_dark
[panda]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=panda [panda]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=panda
[noctis_minimus]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=noctis_minimus [noctis_minimus]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=noctis_minimus
[cobalt2]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=cobalt2 [cobalt2]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=cobalt2
@@ -130,7 +128,7 @@ Use `?theme=THEME_NAME` parameter like so :-
[moltack]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=moltack [moltack]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=moltack
[codeSTACKr]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=codeSTACKr [codeSTACKr]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=codeSTACKr
[rose_pine]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=rose_pine [rose_pine]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=rose_pine
[aura_dark]: https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&hide=contribs,prs&cache_seconds=86400&theme=aura_dark
[default_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=default [default_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=default
[default_repocard_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=default_repocard [default_repocard_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=default_repocard
@@ -182,8 +180,8 @@ Use `?theme=THEME_NAME` parameter like so :-
[ocean_dark_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=ocean_dark [ocean_dark_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=ocean_dark
[city_lights_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=city_lights [city_lights_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=city_lights
[github_dark_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=github_dark [github_dark_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=github_dark
[github_dark_dimmed_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=github_dark_dimmed
[discord_old_blurple_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=discord_old_blurple [discord_old_blurple_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=discord_old_blurple
[aura_dark_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=aura_dark
[panda_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=panda [panda_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=panda
[noctis_minimus_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=noctis_minimus [noctis_minimus_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=noctis_minimus
[cobalt2_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=cobalt2 [cobalt2_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=cobalt2
@@ -193,7 +191,7 @@ Use `?theme=THEME_NAME` parameter like so :-
[moltack_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=moltack [moltack_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=moltack
[codeSTACKr_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=codeSTACKr [codeSTACKr_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=codeSTACKr
[rose_pine_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=rose_pine [rose_pine_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=rose_pine
[aura_dark_repo]: https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=github-readme-stats&cache_seconds=86400&theme=aura_dark
[add-theme]: https://github.com/anuraghazra/github-readme-stats/edit/master/themes/index.js [add-theme]: https://github.com/anuraghazra/github-readme-stats/edit/master/themes/index.js
-42
View File
@@ -18,27 +18,6 @@ export const themes = {
text_color: "417E87", text_color: "417E87",
bg_color: "ffffff00", bg_color: "ffffff00",
}, },
shadow_red: {
title_color: "9A0000",
text_color: "444",
icon_color: "4F0000",
border_color: "4F0000",
bg_color: "ffffff00",
},
shadow_green: {
title_color: "007A00",
text_color: "444",
icon_color: "003D00",
border_color: "003D00",
bg_color: "ffffff00",
},
shadow_blue: {
title_color: "00779A",
text_color: "444",
icon_color: "004450",
border_color: "004490",
bg_color: "ffffff00",
},
dark: { dark: {
title_color: "fff", title_color: "fff",
icon_color: "79ff97", icon_color: "79ff97",
@@ -321,13 +300,6 @@ export const themes = {
text_color: "C3D1D9", text_color: "C3D1D9",
bg_color: "0D1117", bg_color: "0D1117",
}, },
github_dark_dimmed: {
title_color: "539bf5",
icon_color: "539bf5",
text_color: "ADBAC7",
bg_color: "24292F",
border_color: "373E47",
},
discord_old_blurple: { discord_old_blurple: {
title_color: "7289DA", title_color: "7289DA",
icon_color: "7289DA", icon_color: "7289DA",
@@ -402,13 +374,6 @@ export const themes = {
border_color: "170F0C", border_color: "170F0C",
bg_color: "170F0C", bg_color: "170F0C",
}, },
one_dark_pro: {
title_color: "61AFEF",
text_color: "E5C06E",
icon_color: "C678DD",
border_color: "3B4048",
bg_color: "23272E",
},
rose: { rose: {
title_color: "8d192b", title_color: "8d192b",
text_color: "862931", text_color: "862931",
@@ -416,13 +381,6 @@ export const themes = {
border_color: "e9d8d4", border_color: "e9d8d4",
bg_color: "e9d8d4", bg_color: "e9d8d4",
}, },
holi: {
title_color: "5FABEE",
text_color: "D6E7FF",
icon_color: "5FABEE",
border_color: "85A4C0",
bg_color: "030314",
},
}; };
export default themes; export default themes;