Skip to content

Commit

Permalink
style: improve code structure (#2)
Browse files Browse the repository at this point in the history
* 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]>
  • Loading branch information
1 parent b07ce83 commit 4a4cec6
Show file tree
Hide file tree
Showing 38 changed files with 818 additions and 351 deletions.
2 changes: 1 addition & 1 deletion .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These are supported funding model platforms

github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
github: [anuraghazra] # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: # Replace with a single Ko-fi username
Expand Down
11 changes: 0 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,6 @@ jobs:
with:
node-version: "12.x"

- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key:
${{ runner.os }}-npm-cache-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-cache-
- name: Install & Test
run: |
npm install
Expand Down
11 changes: 10 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ Pull requests are the best way to propose changes. We actively welcome your pull
1. If you've changed APIs, update the documentation.
1. Issue that pull request!

## Under the hood of github-readme-stats

Interested in diving deeper into understanding how github-readme-stats works?

[Bohdan](https://github.com/Bogdan-Lyashenko) wrote an amazing in-depth post about it, check it out:

**[Under the hood of github-readme-stats project](https://codecrumbs.io/library/github-readme-stats)**


## Local Development

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

> **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)
> **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)
### Bug Reports

Expand Down
5 changes: 2 additions & 3 deletions api/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ module.exports = async (req, res) => {
border_color,
role,
} = req.query;
let stats;

res.setHeader("Content-Type", "image/svg+xml");

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

try {
stats = await fetchStats(
const stats = await fetchStats(
username,
parseArray(role),
parseBoolean(count_private),
parseBoolean(include_all_commits),
parseArray(role),
Expand Down
6 changes: 2 additions & 4 deletions api/pin.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ module.exports = async (req, res) => {
border_color,
} = req.query;

let repoData;

res.setHeader("Content-Type", "image/svg+xml");

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

try {
repoData = await fetchRepo(username, repo);
const repoData = await fetchRepo(username, repo);

let cacheSeconds = clampValue(
parseInt(cache_seconds || CONSTANTS.TWO_HOURS, 10),
Expand All @@ -53,7 +51,7 @@ module.exports = async (req, res) => {
and if both are zero we are not showing the stats
so we can just make the cache longer, since there is no need to frequent updates
*/
const stars = repoData.stargazers.totalCount;
const stars = repoData.starCount;
const forks = repoData.forkCount;
const isBothOver1K = stars > 1000 && forks > 1000;
const isBothUnder1 = stars < 1 && forks < 1;
Expand Down
5 changes: 2 additions & 3 deletions api/top-langs.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@ module.exports = async (req, res) => {
border_color,
role,
} = req.query;
let topLangs;

res.setHeader("Content-Type", "image/svg+xml");

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

try {
topLangs = await fetchTopLanguages(
const topLangs = await fetchTopLanguages(
username,
parseArray(role),
parseArray(exclude_repo),
parseArray(role),
parseArray(hide),
Expand Down
5 changes: 4 additions & 1 deletion api/wakatime.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ const {
renderError,
parseBoolean,
clampValue,
parseArray,
CONSTANTS,
isLocaleAvailable,
} = require("../src/common/utils");
const { isLocaleAvailable } = require("../src/translations");
const { fetchWakatimeStats } = require("../src/fetchers/wakatime-fetcher");
const wakatimeCard = require("../src/cards/wakatime-card");

Expand All @@ -26,6 +27,7 @@ module.exports = async (req, res) => {
locale,
layout,
langs_count,
hide,
api_domain,
range,
border_radius,
Expand Down Expand Up @@ -58,6 +60,7 @@ module.exports = async (req, res) => {
custom_title,
hide_title: parseBoolean(hide_title),
hide_border: parseBoolean(hide_border),
hide: parseArray(hide),
line_height,
title_color,
icon_color,
Expand Down
2 changes: 1 addition & 1 deletion docs/readme_cn.md
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ _注意:热门语言并不表示我的技能水平或类似的水平,它是
1. 选择 `Import Git Repository`
![](https://files.catbox.moe/pqub9q.png)
1. 选择 root 并将所有内容保持不变,并且只需添加名为 PAT_1 的环境变量(如图所示),其中将包含一个个人访问令牌(PAT),你可以在[这里](https://github.com/settings/tokens/new)轻松创建(保留默认,并且只需要命名下,名字随便)
![](https://files.catbox.moe/caem5b.png)
![](https://files.catbox.moe/0ez4g7.png)
1. 点击 deploy,这就完成了,查看你的域名就可使用 API 了!

</details>
Expand Down
2 changes: 1 addition & 1 deletion docs/readme_es.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

- [Tarjeta de estadísticas de GitHub](#tarjeta-de-estadísticas-de-github)
- [Pins adicionales de GitHub](#pines-adicionales-de-github)
- [Top Languages Card](#tarjeta-de-lenguajes-principales)
- [Tarjeta de Lenguajes Principales](#tarjeta-de-lenguajes-principales)
- [Wakatime Week Stats](#estadísticas-de-la-semana-de-wakatime)
- [Temas](#temas)
- [Personalización](#personalización)
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@
"@actions/github": "^4.0.0",
"@testing-library/dom": "^7.20.0",
"@testing-library/jest-dom": "^5.11.0",
"axios": "^0.19.2",
"axios": "^0.24.0",
"axios-mock-adapter": "^1.18.1",
"color-contrast-checker": "^2.1.0",
"css-to-object": "^1.1.0",
"hjson": "^3.2.2",
"husky": "^4.2.5",
"jest": "^26.1.0",
"lodash.snakecase": "^4.1.1",
"parse-diff": "^0.7.0"
},
"dependencies": {
Expand Down
11 changes: 9 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ Your small help goes a long way. :heart:
- [Wakatime Week Stats](#wakatime-week-stats)
- [Themes](#themes)
- [Customization](#customization)
- [Common Options](#common-options)
- [Stats Card Exclusive Options](#stats-card-exclusive-options)
- [Repo Card Exclusive Options](#repo-card-exclusive-options)
- [Language Card Exclusive Options](#language-card-exclusive-options)
- [Wakatime Card Exclusive Option](#wakatime-card-exclusive-options)
- [Deploy Yourself](#deploy-on-your-own-vercel-instance)

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

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

_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._
_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._

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

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

Use `?theme=THEME_NAME` parameter like so :-
Use `&theme=THEME_NAME` parameter like so :-

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

- `hide` - Hide the languages specified from the card _(Comma-separated values)_
- `hide_title` - _(boolean)_
- `line_height` - Sets the line-height between text _(number)_
- `hide_progress` - Hides the progress bar and percentage _(boolean)_
Expand Down Expand Up @@ -405,6 +411,7 @@ NOTE: Since [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) we
![](https://files.catbox.moe/btd78j.jpeg)
1. Sign into GitHub and allow access to all repositories, if prompted
1. Fork this repo
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`
1. Go back to your [Vercel dashboard](https://vercel.com/dashboard)
1. Select `Import Project`
![](https://files.catbox.moe/qckos0.png)
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate-theme-doc.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const THEME_TEMPLATE = `## Available Themes
<!-- DO NOT EDIT THIS FILE DIRECTLY -->
With inbuilt themes you can customize the look of the card without doing any manual customization.
With inbuilt themes, you can customize the look of the card without doing any manual customization.
Use \`?theme=THEME_NAME\` parameter like so :-
Expand Down Expand Up @@ -43,7 +43,7 @@ ${REPO_CARD_LINKS_FLAG}
[add-theme]: https://github.com/anuraghazra/github-readme-stats/edit/master/themes/index.js
Wanted to add a new theme? Consider reading the [contribution guidelines](../CONTRIBUTING.md#themes-contribution) :D
Want to add a new theme? Consider reading the [contribution guidelines](../CONTRIBUTING.md#themes-contribution) :D
`;

const createRepoMdLink = (theme) => {
Expand Down
Loading

1 comment on commit 4a4cec6

@vercel
Copy link

@vercel vercel bot commented on 4a4cec6 Dec 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deployment failed with the following error:

The value for maxDuration must be between 1 second and 10 seconds, in order to increase this limit upgrade your plan: https://vercel.com/pricing

Please sign in to comment.