Skip to content

Commit 4a4cec6

Browse files
rickstaaabrj7XUQINGyehwankim23AlexandroPerez
authored
style: improve code structure (#2)
* docs: better navigation in readme (anuraghazra#1196) * docs(cn): replace error picture (anuraghazra#1217) env name should be PAT_1, but on the picture is GITHUB_TOKEN * docs: fix grammar (anuraghazra#1242) * fix: subfolder support for api_domain wakatime api (anuraghazra#1235) * docs(theme): Auto update theme readme (anuraghazra#1263) * feat: hide wakatime languages (anuraghazra#1212) * feat: added option to hide languages * feat: recalculate percentages for hidden languages * refactor: reverted langs_count and did some formatting * doc: added hide to readme * feat: make languages var mutable and improve filter logic Co-authored-by: Adrian Kunz <[email protected]> * refactor: improve code and added tests Co-authored-by: Adrian Kunz <[email protected]> Co-authored-by: Anurag <[email protected]> * fix: text overlap (anuraghazra#1207) * feat(statCard): added more concise description * fix: removed isLongLocale param * Revert "fix: removed isLongLocale param" This reverts commit 55f1e2d. * feat: add de and nl to longLocal to fix padding * chore: grammar error on CONTRIBUTING.md (anuraghazra#1272) * chore: update funding link (anuraghazra#1289) * chore: revert total stars naming * chore: change `total stars` to `total stars earned` (anuraghazra#1293) * docs: replace '?theme' with '&theme' (anuraghazra#1307) * style(theme): added aura_dark themes (anuraghazra#1312) * feat(layout): improve flexLayout & fixed layout overlaps (anuraghazra#1314) * feat(layout): improve flexLayout & fixed layout overlaps * chore: fix vercel build * chore: added under-the-hood blogpost link in contributing.md * style(theme): added panda theme (anuraghazra#1319) * refactor: refactor repo card (anuraghazra#1325) * refactor: refactored repo-card * test: fix tests * test: fixed tests * fix: unprovided description error * chore: update theme preview bot content (anuraghazra#1326) * docs: match link with section title (anuraghazra#1341) * Match link with section title Match the link of Top Languages Card with the title of his section ("Tarjeta de Lenguajes Principales"). * Fix typo * style(theme): added cobalt2 theme (anuraghazra#1343) * style(theme): added noctis minimus theme (anuraghazra#1342) * Add Noctis minimus theme * Add Noctis minimus theme Co-authored-by: Anurag Hazra <[email protected]> * chore: fix grammatical errors in the scripts (anuraghazra#1346) * Fix grammatical errors * Fix grammatical errors * chore: reduce vercel memory & timeout duration (anuraghazra#1366) * fix: change serverless function memory to 128mb * chore: change maxDuration * fix: wakatime card translations (anuraghazra#1363) * refactor: jsdoc in utils & minor changes (anuraghazra#1377) * refactor: jsdoc in utils & minor changes * chore: jsdoc Card class * chore: jsdoc for getStyles * ci(workflow): add 'npm' cache for actions/setup-node in .github/workflows (anuraghazra#1382) * Revert "ci(workflow): add 'npm' cache for actions/setup-node in .github/workflows (anuraghazra#1382)" This reverts commit 2723f00. * chore: remove action cache * style(theme): add gruvbox_light theme (anuraghazra#1379) * docs(theme): Auto update theme readme (anuraghazra#1384) Co-authored-by: Github Readme Stats Bot <[email protected]> * fix: word-wrap bug (anuraghazra#1378) * Fixed word-wrap bug * ci(workflow): add 'npm' cache for actions/setup-node in .github/workflows (anuraghazra#1382) * Revert "ci(workflow): add 'npm' cache for actions/setup-node in .github/workflows (anuraghazra#1382)" This reverts commit 2723f00. * chore: remove action cache * chore: minor change Co-authored-by: Markus Tyrkkö <[email protected]> Co-authored-by: Oscar Dominguez <[email protected]> Co-authored-by: Anurag <[email protected]> * fix: hotfix for graphql api error (anuraghazra#1409) * docs: add fork instructions (anuraghazra#1418) * docs: add fork instructions * chore: revert toc * fix: bug where wakatime api returns undefined languages (anuraghazra#1403) Co-authored-by: Markus Tyrkkö <[email protected]> * style(themes): aura theme (anuraghazra#1423) * style(theme): added swift theme (anuraghazra#1395) Co-authored-by: Anurag Hazra <[email protected]> * docs(theme): Auto update theme readme (anuraghazra#1440) Co-authored-by: Github Readme Stats Bot <[email protected]> * feat(script): improved theme preview script (anuraghazra#1439) * feat: improved theme preview script * chore: add getPRNumber * feat(theme-preview): added ability to upsert comments (anuraghazra#1442) * chore: added ability upsert comments * chore: new event * chore: update github action trigger * chore: remove edit event from action * chore(deps): update axios to 0.24.0 (axios/axios#3410) (anuraghazra#1446) * style(theme): add apprentice theme (anuraghazra#1466) * fix: auth token header (anuraghazra#1474) * Include all repo w/ access to * parameterize affiliation * Use GraphQL variable syntax * Custom ownerAffiliations for general stats * Add default affiliation * style: improve code structure Co-authored-by: OldWizard209 <[email protected]> Co-authored-by: XUQING <[email protected]> Co-authored-by: 김예환 Ye-Hwan Kim (Sam) <[email protected]> Co-authored-by: Alexandro Perez <[email protected]> Co-authored-by: Masahiro Furudate <[email protected]> Co-authored-by: Julian Holfeld <[email protected]> Co-authored-by: Adrian Kunz <[email protected]> Co-authored-by: Anurag <[email protected]> Co-authored-by: Philip Jake <[email protected]> Co-authored-by: Moe Bachrouch <[email protected]> Co-authored-by: Horeb Parraud <[email protected]> Co-authored-by: Chandrika Deb <[email protected]> Co-authored-by: Danix <[email protected]> Co-authored-by: Red Headphone <[email protected]> Co-authored-by: Anant Mishra <[email protected]> Co-authored-by: CleanMachine1 <[email protected]> Co-authored-by: Julián Sanmartino <[email protected]> Co-authored-by: Oscar Dominguez <[email protected]> Co-authored-by: Michael Schnerring <[email protected]> Co-authored-by: Github Readme Stats Bot <[email protected]> Co-authored-by: Markus Tyrkkö <[email protected]> Co-authored-by: Markus Tyrkkö <[email protected]> Co-authored-by: Tuhana GAYRETLİ <[email protected]> Co-authored-by: Eduardo Santi <[email protected]> Co-authored-by: Abhijith N T <[email protected]> Co-authored-by: Çınar Yılmaz <[email protected]> Co-authored-by: Raymond Nook <[email protected]>
1 parent b07ce83 commit 4a4cec6

38 files changed

+818
-351
lines changed

.github/FUNDING.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# These are supported funding model platforms
22

3-
github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
3+
github: [anuraghazra] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
44
patreon: # Replace with a single Patreon username
55
open_collective: # Replace with a single Open Collective username
66
ko_fi: # Replace with a single Ko-fi username

.github/workflows/test.yml

-11
Original file line numberDiff line numberDiff line change
@@ -20,17 +20,6 @@ jobs:
2020
with:
2121
node-version: "12.x"
2222

23-
- name: Cache node modules
24-
uses: actions/cache@v2
25-
env:
26-
cache-name: cache-node-modules
27-
with:
28-
path: ~/.npm
29-
key:
30-
${{ runner.os }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
31-
restore-keys: |
32-
${{ runner.os }}-npm-cache-
33-
3423
- name: Install & Test
3524
run: |
3625
npm install

CONTRIBUTING.md

+10-1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@ Pull requests are the best way to propose changes. We actively welcome your pull
1717
1. If you've changed APIs, update the documentation.
1818
1. Issue that pull request!
1919

20+
## Under the hood of github-readme-stats
21+
22+
Interested in diving deeper into understanding how github-readme-stats works?
23+
24+
[Bohdan](https://github.com/Bogdan-Lyashenko) wrote an amazing in-depth post about it, check it out:
25+
26+
**[Under the hood of github-readme-stats project](https://codecrumbs.io/library/github-readme-stats)**
27+
28+
2029
## Local Development
2130

2231
To run & test github-readme-stats you need to follow few simple steps :-
@@ -71,7 +80,7 @@ We use GitHub issues to track public bugs. Report a bug by [opening a new issue]
7180
7281
**Q:** How to count private stats?
7382

74-
> **Ans:** We can only count private commits & we cannot access any other private info of any users, so it's not possible. only way is to deploy on your own instance & use your own PAT (Personal Access Token)
83+
> **Ans:** We can only count public commits & we cannot access any other private info of any users, so it's not possible. The only way to count your personal private stats is to deploy on your own instance & use your own PAT (Personal Access Token)
7584
7685
### Bug Reports
7786

api/index.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@ module.exports = async (req, res) => {
3535
border_color,
3636
role,
3737
} = req.query;
38-
let stats;
39-
4038
res.setHeader("Content-Type", "image/svg+xml");
4139

4240
if (blacklist.includes(username)) {
@@ -48,8 +46,9 @@ module.exports = async (req, res) => {
4846
}
4947

5048
try {
51-
stats = await fetchStats(
49+
const stats = await fetchStats(
5250
username,
51+
parseArray(role),
5352
parseBoolean(count_private),
5453
parseBoolean(include_all_commits),
5554
parseArray(role),

api/pin.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@ module.exports = async (req, res) => {
2727
border_color,
2828
} = req.query;
2929

30-
let repoData;
31-
3230
res.setHeader("Content-Type", "image/svg+xml");
3331

3432
if (blacklist.includes(username)) {
@@ -40,7 +38,7 @@ module.exports = async (req, res) => {
4038
}
4139

4240
try {
43-
repoData = await fetchRepo(username, repo);
41+
const repoData = await fetchRepo(username, repo);
4442

4543
let cacheSeconds = clampValue(
4644
parseInt(cache_seconds || CONSTANTS.TWO_HOURS, 10),
@@ -53,7 +51,7 @@ module.exports = async (req, res) => {
5351
and if both are zero we are not showing the stats
5452
so we can just make the cache longer, since there is no need to frequent updates
5553
*/
56-
const stars = repoData.stargazers.totalCount;
54+
const stars = repoData.starCount;
5755
const forks = repoData.forkCount;
5856
const isBothOver1K = stars > 1000 && forks > 1000;
5957
const isBothUnder1 = stars < 1 && forks < 1;

api/top-langs.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@ module.exports = async (req, res) => {
3232
border_color,
3333
role,
3434
} = req.query;
35-
let topLangs;
36-
3735
res.setHeader("Content-Type", "image/svg+xml");
3836

3937
if (blacklist.includes(username)) {
@@ -45,8 +43,9 @@ module.exports = async (req, res) => {
4543
}
4644

4745
try {
48-
topLangs = await fetchTopLanguages(
46+
const topLangs = await fetchTopLanguages(
4947
username,
48+
parseArray(role),
5049
parseArray(exclude_repo),
5150
parseArray(role),
5251
parseArray(hide),

api/wakatime.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ const {
33
renderError,
44
parseBoolean,
55
clampValue,
6+
parseArray,
67
CONSTANTS,
7-
isLocaleAvailable,
88
} = require("../src/common/utils");
9+
const { isLocaleAvailable } = require("../src/translations");
910
const { fetchWakatimeStats } = require("../src/fetchers/wakatime-fetcher");
1011
const wakatimeCard = require("../src/cards/wakatime-card");
1112

@@ -26,6 +27,7 @@ module.exports = async (req, res) => {
2627
locale,
2728
layout,
2829
langs_count,
30+
hide,
2931
api_domain,
3032
range,
3133
border_radius,
@@ -58,6 +60,7 @@ module.exports = async (req, res) => {
5860
custom_title,
5961
hide_title: parseBoolean(hide_title),
6062
hide_border: parseBoolean(hide_border),
63+
hide: parseArray(hide),
6164
line_height,
6265
title_color,
6366
icon_color,

docs/readme_cn.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ _注意:热门语言并不表示我的技能水平或类似的水平,它是
325325
1. 选择 `Import Git Repository`
326326
![](https://files.catbox.moe/pqub9q.png)
327327
1. 选择 root 并将所有内容保持不变,并且只需添加名为 PAT_1 的环境变量(如图所示),其中将包含一个个人访问令牌(PAT),你可以在[这里](https://github.com/settings/tokens/new)轻松创建(保留默认,并且只需要命名下,名字随便)
328-
![](https://files.catbox.moe/caem5b.png)
328+
![](https://files.catbox.moe/0ez4g7.png)
329329
1. 点击 deploy,这就完成了,查看你的域名就可使用 API 了!
330330

331331
</details>

docs/readme_es.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464

6565
- [Tarjeta de estadísticas de GitHub](#tarjeta-de-estadísticas-de-github)
6666
- [Pins adicionales de GitHub](#pines-adicionales-de-github)
67-
- [Top Languages Card](#tarjeta-de-lenguajes-principales)
67+
- [Tarjeta de Lenguajes Principales](#tarjeta-de-lenguajes-principales)
6868
- [Wakatime Week Stats](#estadísticas-de-la-semana-de-wakatime)
6969
- [Temas](#temas)
7070
- [Personalización](#personalización)

package.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616
"@actions/github": "^4.0.0",
1717
"@testing-library/dom": "^7.20.0",
1818
"@testing-library/jest-dom": "^5.11.0",
19-
"axios": "^0.19.2",
19+
"axios": "^0.24.0",
2020
"axios-mock-adapter": "^1.18.1",
21+
"color-contrast-checker": "^2.1.0",
2122
"css-to-object": "^1.1.0",
23+
"hjson": "^3.2.2",
2224
"husky": "^4.2.5",
2325
"jest": "^26.1.0",
26+
"lodash.snakecase": "^4.1.1",
2427
"parse-diff": "^0.7.0"
2528
},
2629
"dependencies": {

readme.md

+9-2
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,11 @@ Your small help goes a long way. :heart:
8383
- [Wakatime Week Stats](#wakatime-week-stats)
8484
- [Themes](#themes)
8585
- [Customization](#customization)
86+
- [Common Options](#common-options)
87+
- [Stats Card Exclusive Options](#stats-card-exclusive-options)
88+
- [Repo Card Exclusive Options](#repo-card-exclusive-options)
89+
- [Language Card Exclusive Options](#language-card-exclusive-options)
90+
- [Wakatime Card Exclusive Option](#wakatime-card-exclusive-options)
8691
- [Deploy Yourself](#deploy-on-your-own-vercel-instance)
8792

8893
# GitHub Stats Card
@@ -113,7 +118,7 @@ To hide any specific stats, you can pass a query parameter `?hide=` with comma-s
113118

114119
You can add the count of all your private contributions to the total commits count by using the query parameter `?count_private=true`.
115120

116-
_Note: If you are deploying this project yourself, the private contributions will be counted by default otherwise you need to chose to share your private contribution counts._
121+
_Note: If you are deploying this project yourself, the private contributions will be counted by default. Otherwise, you need to choose to share your private contribution counts._
117122

118123
> Options: `&count_private=true`
119124
@@ -133,7 +138,7 @@ To enable icons, you can pass `show_icons=true` in the query param, like so:
133138

134139
With inbuilt themes, you can customize the look of the card without doing any [manual customization](#customization).
135140

136-
Use `?theme=THEME_NAME` parameter like so :-
141+
Use `&theme=THEME_NAME` parameter like so :-
137142

138143
```md
139144
![Anurag's GitHub stats](https://github-readme-stats.vercel.app/api?username=anuraghazra&show_icons=true&theme=radical)
@@ -207,6 +212,7 @@ You can provide multiple comma-separated values in bg_color option to render a g
207212
208213
#### Wakatime Card Exclusive Options:
209214

215+
- `hide` - Hide the languages specified from the card _(Comma-separated values)_
210216
- `hide_title` - _(boolean)_
211217
- `line_height` - Sets the line-height between text _(number)_
212218
- `hide_progress` - Hides the progress bar and percentage _(boolean)_
@@ -405,6 +411,7 @@ NOTE: Since [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) we
405411
![](https://files.catbox.moe/btd78j.jpeg)
406412
1. Sign into GitHub and allow access to all repositories, if prompted
407413
1. Fork this repo
414+
1. After forking the repo, open the [`vercel.json`](https://github.com/anuraghazra/github-readme-stats/blob/master/vercel.json#L5) file and change the `maxDuration` field to `10`
408415
1. Go back to your [Vercel dashboard](https://vercel.com/dashboard)
409416
1. Select `Import Project`
410417
![](https://files.catbox.moe/qckos0.png)

scripts/generate-theme-doc.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const THEME_TEMPLATE = `## Available Themes
1212
1313
<!-- DO NOT EDIT THIS FILE DIRECTLY -->
1414
15-
With inbuilt themes you can customize the look of the card without doing any manual customization.
15+
With inbuilt themes, you can customize the look of the card without doing any manual customization.
1616
1717
Use \`?theme=THEME_NAME\` parameter like so :-
1818
@@ -43,7 +43,7 @@ ${REPO_CARD_LINKS_FLAG}
4343
4444
[add-theme]: https://github.com/anuraghazra/github-readme-stats/edit/master/themes/index.js
4545
46-
Wanted to add a new theme? Consider reading the [contribution guidelines](../CONTRIBUTING.md#themes-contribution) :D
46+
Want to add a new theme? Consider reading the [contribution guidelines](../CONTRIBUTING.md#themes-contribution) :D
4747
`;
4848

4949
const createRepoMdLink = (theme) => {

0 commit comments

Comments
 (0)