forked from mirrored/github-readme-stats
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a596d6a8fa | ||
|
|
94379d943e | ||
|
|
682c126702 | ||
|
|
bb12eef59c | ||
|
|
5a3ce60099 | ||
|
|
12216a3a05 | ||
|
|
8d0a4aa704 | ||
|
|
5df91f9bfa | ||
|
|
65e00a4e07 | ||
|
|
08924c997e | ||
|
|
8108ba1417 | ||
|
|
7d8dad0130 | ||
|
|
a92b817795 | ||
|
|
903588b300 | ||
|
|
6ade6b4ef1 | ||
|
|
696dd6c774 | ||
|
|
61b9adbf60 | ||
|
|
8ee077b14b | ||
|
|
a3f234a4c3 | ||
|
|
e807e167ef | ||
|
|
8994937bd1 | ||
|
|
2c51a67a55 | ||
|
|
f8a4a2626b | ||
|
|
68a8dcbbdb | ||
|
|
e42de59a33 | ||
|
|
5f020e91ec | ||
|
|
7b45628291 | ||
|
|
453f77fd8a | ||
|
|
24c335f942 | ||
|
|
daa8ee3ce0 | ||
|
|
e6c560f75e | ||
|
|
2a626d7684 | ||
|
|
d1a88db5a9 | ||
|
|
45973cf12d | ||
|
|
c6f7365cc6 | ||
|
|
adf2a65dcc | ||
|
|
ec8b25f1cb | ||
|
|
2a552410ff | ||
|
|
d1912d0665 | ||
|
|
a625dab7db | ||
|
|
549ed26d72 | ||
|
|
f744de1f0c | ||
|
|
b18d03defd | ||
|
|
376b7ac04d | ||
|
|
30860b84b1 | ||
|
|
2c30941065 | ||
|
|
8a77b11149 | ||
|
|
86b0a557aa | ||
|
|
12cad0f7e9 | ||
|
|
f72f03d873 | ||
|
|
0a060bab32 | ||
|
|
98ab3d4172 | ||
|
|
6d90255d05 | ||
|
|
f023d9e74c | ||
|
|
08d7b25d23 | ||
|
|
79162359c1 | ||
|
|
5de1aa8706 | ||
|
|
0b21b2b542 | ||
|
|
7a5ac44604 | ||
|
|
570619752f | ||
|
|
74a5648349 | ||
|
|
237ef65864 | ||
|
|
5871c68cff | ||
|
|
81ad1c736f | ||
|
|
c9eb6752c5 | ||
|
|
a11169e2f1 | ||
|
|
f5de29fa67 | ||
|
|
a72d88fd54 | ||
|
|
b240a06e7b | ||
|
|
af1d8cad6f | ||
|
|
351da081cf | ||
|
|
432595e9d7 | ||
|
|
62c43e9f3a | ||
|
|
c43fd65bdd | ||
|
|
33f6276b0b | ||
|
|
516472f17a | ||
|
|
93e48939d5 | ||
|
|
a97ab2dc7a | ||
|
|
dff0cfec58 | ||
|
|
e158f0d27f | ||
|
|
6d1a5e51bc | ||
|
|
bf021b0670 | ||
|
|
2df35521d7 | ||
|
|
da318a6751 | ||
|
|
4e44891844 | ||
|
|
306d0a34ce | ||
|
|
d574feb667 | ||
|
|
fda29161e8 | ||
|
|
ab53e3052d | ||
|
|
b9c3bf6251 | ||
|
|
5df2e634e9 | ||
|
|
c4a59b5afa | ||
|
|
c1d13eac19 | ||
|
|
4143c6dec3 | ||
|
|
7caaa21e73 | ||
|
|
adbed1ee2f | ||
|
|
d3a7a90bf9 | ||
|
|
90955dca00 | ||
|
|
92d6dfa226 | ||
|
|
33f0c9153e | ||
|
|
701068b8bc | ||
|
|
6a542c870d | ||
|
|
0849165c6e | ||
|
|
6d6b87c359 | ||
|
|
3d3786dad9 | ||
|
|
b507f55ecd | ||
|
|
16e5bb5b19 | ||
|
|
9648e8c67b | ||
|
|
3fd9ce0778 | ||
|
|
99b95fbc95 | ||
|
|
b164ecebda | ||
|
|
f6e5d507ad | ||
|
|
7b0b366781 | ||
|
|
0afa6c4e78 | ||
|
|
3c22841a82 | ||
|
|
b3995211fe | ||
|
|
abda6d3663 | ||
|
|
756a601079 | ||
|
|
4ce7b8bb66 | ||
|
|
4f0aadcbcf | ||
|
|
956d6deded | ||
|
|
879463b14e | ||
|
|
12caf46c6d | ||
|
|
e9cc6c0556 | ||
|
|
e8e5cf86fb | ||
|
|
66764616fa | ||
|
|
e9d0e8fd17 | ||
|
|
f7920901b6 | ||
|
|
195e2fc72d | ||
|
|
09627ce715 | ||
|
|
ade7d53653 | ||
|
|
fde13639aa | ||
|
|
e5f40eb09c | ||
|
|
f5b1ffa5e3 | ||
|
|
24b1df0d28 | ||
|
|
a697215f8e | ||
|
|
39b93b57c8 | ||
|
|
361e8279cc | ||
|
|
41317e848e | ||
|
|
f5de3eb918 | ||
|
|
3456ceb4b4 | ||
|
|
9abfce8ca0 | ||
|
|
e09f69c82b | ||
|
|
2641d69331 | ||
|
|
7b7f78127f | ||
|
|
9f3223fb35 | ||
|
|
35485384e0 | ||
|
|
ba9406e84c | ||
|
|
3ce1fd74ae | ||
|
|
bfa895d2e7 | ||
|
|
a8dd06537f | ||
|
|
29560fe856 | ||
|
|
811f4582ee | ||
|
|
cacc32a2cb | ||
|
|
0e3056243e | ||
|
|
98412a1c73 | ||
|
|
b25904c123 | ||
|
|
5031e32781 | ||
|
|
e0d573e91b | ||
|
|
02cf32ce22 | ||
|
|
a38ff1003e | ||
|
|
aac573569f | ||
|
|
8e8a15ba63 | ||
|
|
df8f7a6cef | ||
|
|
ca3c5d5641 | ||
|
|
c689c516f0 | ||
|
|
ed942e846c | ||
|
|
0d60641b7c | ||
|
|
651de3afe4 | ||
|
|
e466ada34e | ||
|
|
d286fa39be | ||
|
|
18c808afcf | ||
|
|
c6380b7f88 | ||
|
|
e9bf75e915 | ||
|
|
b118aee08c | ||
|
|
bce273dcad | ||
|
|
b246514379 | ||
|
|
4c30073ed9 | ||
|
|
1b579cda01 | ||
|
|
fd15fcebf7 | ||
|
|
3131cf7fc5 | ||
|
|
31f34d9f52 | ||
|
|
8d0d044517 | ||
|
|
d34a7068e7 | ||
|
|
a298e1cd41 | ||
|
|
c81f3eb92d | ||
|
|
4f17194684 | ||
|
|
be0dba8986 | ||
|
|
3dd8095d5c | ||
|
|
4859cc7689 | ||
|
|
42130f1f96 | ||
|
|
51664ce7fa | ||
|
|
e91880231d | ||
|
|
c3585cc1d0 | ||
|
|
68e5862b0b | ||
|
|
3e6ce83a42 | ||
|
|
f48a59b9bf | ||
|
|
4f33921e9e | ||
|
|
6bda67effc | ||
|
|
a8c56ff4c9 | ||
|
|
10526a0b7e | ||
|
|
5306118587 | ||
|
|
f441d1696c | ||
|
|
b594b57b56 | ||
|
|
63b402177d | ||
|
|
f179fbe840 | ||
|
|
ef7f139440 | ||
|
|
1655c957ce | ||
|
|
d210391e7d | ||
|
|
078040d26e | ||
|
|
485c2247f8 | ||
|
|
aa1caba1d4 | ||
|
|
1b06e7117e | ||
|
|
3987991058 | ||
|
|
70add4cfcf | ||
|
|
b13d6a9ca2 | ||
|
|
116d255bf1 | ||
|
|
affd6f458f | ||
|
|
c966becb9a | ||
|
|
3cdfa8826e | ||
|
|
5320bc8c83 | ||
|
|
ea6ef1124d | ||
|
|
b0b14091e7 | ||
|
|
b907fba9b0 | ||
|
|
71ff198609 | ||
|
|
25dced4363 | ||
|
|
44cc74d6c6 | ||
|
|
e4d4e9e284 | ||
|
|
d3ee38f154 | ||
|
|
20721f7fa8 | ||
|
|
edc5d7762c | ||
|
|
3fa9c1df76 | ||
|
|
104dfbf340 | ||
|
|
c8e6976f35 | ||
|
|
ac3924e10b | ||
|
|
3fd11653f1 | ||
|
|
62658da1e2 | ||
|
|
6db8385346 | ||
|
|
fe5ba3d641 | ||
|
|
62069d08dd | ||
|
|
7a2d13430d | ||
|
|
71dd0da906 | ||
|
|
9f0b9c7846 | ||
|
|
891e31952b | ||
|
|
3adf254fb8 | ||
|
|
309f4a2749 | ||
|
|
57ababf1c2 | ||
|
|
8d620f6085 | ||
|
|
647f2e1c88 | ||
|
|
3878de9783 | ||
|
|
794dc6bd23 | ||
|
|
68084d9f67 | ||
|
|
e27f7ed6d0 | ||
|
|
a5cdd3f531 | ||
|
|
b0da0850cc | ||
|
|
b8b89d82df | ||
|
|
d2b8d47a9f | ||
|
|
a8db2001ee | ||
|
|
0a5fe6f7a6 | ||
|
|
0425bc7b05 | ||
|
|
87c8cbaa58 | ||
|
|
32964d1b25 | ||
|
|
0015129e2c | ||
|
|
5ecf80b4d2 | ||
|
|
bbadc0b212 | ||
|
|
411e799d1d | ||
|
|
070dbd312c | ||
|
|
dd7582db8f | ||
|
|
09cb2a596e | ||
|
|
a92cc03e92 | ||
|
|
8ae6980056 | ||
|
|
6b457d04f1 | ||
|
|
ff7e1e283c | ||
|
|
0cf6b18fa1 | ||
|
|
2d143645b7 | ||
|
|
76bcea5dec | ||
|
|
147f8350fe | ||
|
|
74b41f10b1 | ||
|
|
99eafb4721 | ||
|
|
4e16d7b964 | ||
|
|
6522de0e0a | ||
|
|
096c9a93c0 | ||
|
|
6257ba51f6 | ||
|
|
9f34eef992 | ||
|
|
407bcb9d4f | ||
|
|
71dbeca70c | ||
|
|
c84d18d852 | ||
|
|
ac02053f20 | ||
|
|
3e97401177 | ||
|
|
ffe0e8219e | ||
|
|
54bcc91847 | ||
|
|
32feaa328c | ||
|
|
24ceff3ce4 | ||
|
|
2fe5ccd9f5 | ||
|
|
3da15d0a1e | ||
|
|
12a082de92 | ||
|
|
9d222a3af5 | ||
|
|
2d18f87bdd | ||
|
|
6518b93b36 | ||
|
|
27ffc1aec6 | ||
|
|
3740527fb5 | ||
|
|
67c769f2fc | ||
|
|
51c355065a | ||
|
|
4306568359 | ||
|
|
c3c6ee2d79 | ||
|
|
618127f837 | ||
|
|
eb5b652b73 | ||
|
|
19b1a798c6 | ||
|
|
d865ffc934 | ||
|
|
278ccfeeca | ||
|
|
f1dcc800f1 | ||
|
|
5b97176340 | ||
|
|
8fa0efe80a | ||
|
|
17e3a7bb8d | ||
|
|
a9bf883308 | ||
|
|
b0cc0529e4 | ||
|
|
5b7ee50436 | ||
|
|
12f4f57e25 | ||
|
|
8c9a24eb25 | ||
|
|
4fb518effa | ||
|
|
ea0561215c | ||
|
|
a2b372f582 | ||
|
|
aebe00a0b2 | ||
|
|
8f7b9372e0 | ||
|
|
e31e2f8037 | ||
|
|
3ee3feddfe | ||
|
|
ff5a2a1ffa | ||
|
|
7d4844f25f | ||
|
|
5da00d1f35 | ||
|
|
78c40da3ca | ||
|
|
54348a36d2 | ||
|
|
228da691fa | ||
|
|
578c4fb836 | ||
|
|
25a9dabf13 | ||
|
|
e1dabe450c | ||
|
|
db7a90736d | ||
|
|
29977629ce | ||
|
|
0d80aa5b7c | ||
|
|
58863dec28 | ||
|
|
b0d7c9303f | ||
|
|
c932465ad4 | ||
|
|
2e713d4f46 | ||
|
|
5208b3d52a | ||
|
|
806bce1bac | ||
|
|
3417e41a7e | ||
|
|
9c3bd5a82f | ||
|
|
e3ddfe0274 | ||
|
|
5c8d6369cb | ||
|
|
3ab6a2b6d4 | ||
|
|
a6501d53f0 | ||
|
|
e263e4eb02 | ||
|
|
ae57475bf4 | ||
|
|
3ec430b08a | ||
|
|
46e3aa15be | ||
|
|
66326589d9 | ||
|
|
e5890f6115 | ||
|
|
a7d1bef2e9 | ||
|
|
81689b9123 | ||
|
|
8e30f23664 | ||
|
|
25796c3ad0 | ||
|
|
6e14c49c3d | ||
|
|
06b61f1682 | ||
|
|
2817001891 | ||
|
|
c8af8c52db | ||
|
|
232270d74d | ||
|
|
63abbdc2e2 | ||
|
|
935e5b3eda | ||
|
|
ad8ba37d51 | ||
|
|
81b651d58e | ||
|
|
13754b3d1f | ||
|
|
d07b088a85 | ||
|
|
4d2e77bfec | ||
|
|
e54b15ea69 | ||
|
|
eeefd7e6a4 | ||
|
|
ef3139f015 | ||
|
|
cea9e64a70 | ||
|
|
bc601863f6 | ||
|
|
490b022618 | ||
|
|
7d311d5c65 | ||
|
|
a3cfe1b602 | ||
|
|
3344bfd150 | ||
|
|
e4f8c521a4 | ||
|
|
e86b74d7df | ||
|
|
290d0946c6 | ||
|
|
7905f8e5c2 | ||
|
|
01d4705e1c | ||
|
|
b88bf687af | ||
|
|
590dab64ba | ||
|
|
5b6b399d6e | ||
|
|
74142f012f | ||
|
|
2861fb4781 | ||
|
|
b2fbca83b3 | ||
|
|
318a3c83b4 | ||
|
|
194db99da7 | ||
|
|
d234202c83 | ||
|
|
024db90fa8 | ||
|
|
7c9bfeab17 | ||
|
|
244ac4df31 | ||
|
|
0810a1d844 | ||
|
|
03c1974a73 | ||
|
|
90e415b698 | ||
|
|
5fdf20e7f6 | ||
|
|
3b2c8885fc | ||
|
|
2bdb5359cd | ||
|
|
396105ee60 | ||
|
|
5ba83c5663 | ||
|
|
6da4265302 | ||
|
|
9bfae5883f | ||
|
|
bb68a8621d | ||
|
|
4bc92a5929 | ||
|
|
cdbf21249d | ||
|
|
a091154ab2 | ||
|
|
d3886588bd | ||
|
|
5c9d4fdf5b | ||
|
|
764b4c9493 | ||
|
|
221831bfed | ||
|
|
abea3ee49f | ||
|
|
5c4faa2274 | ||
|
|
0cbe58a867 | ||
|
|
f86a12b34d | ||
|
|
745433a153 | ||
|
|
c85d5920e7 | ||
|
|
7e60f6c950 | ||
|
|
9a0d9ae2c1 | ||
|
|
78cef88da6 | ||
|
|
4e8345a5a9 | ||
|
|
3bd266c1e0 | ||
|
|
706d311bd6 | ||
|
|
bebcb26431 | ||
|
|
53e40413e7 | ||
|
|
cdc6ad1eaf | ||
|
|
37bf205914 | ||
|
|
4a795c66e6 | ||
|
|
212eb2c842 | ||
|
|
b59745c09c | ||
|
|
a148495a2e | ||
|
|
3b0699a14e | ||
|
|
af2a595f27 | ||
|
|
c2c825424b | ||
|
|
92237caa2f | ||
|
|
57ccffc795 | ||
|
|
2dd1ea1c03 | ||
|
|
c0a9cc6615 | ||
|
|
27ba0bd8a3 | ||
|
|
f86a548799 | ||
|
|
c13c03a0d8 | ||
|
|
ea935528ce | ||
|
|
43009e2bf8 | ||
|
|
d87baf51c5 | ||
|
|
e331475796 | ||
|
|
e7d086046b | ||
|
|
4720be4c98 | ||
|
|
7a1edb21b1 | ||
|
|
87dd0fa735 | ||
|
|
3645362350 | ||
|
|
856ea613e6 | ||
|
|
a8e44580fe | ||
|
|
8ecc085cc5 | ||
|
|
9a5b007e1d | ||
|
|
ce831da0a9 | ||
|
|
11219b1275 | ||
|
|
30db7790d6 | ||
|
|
08c94ac28c | ||
|
|
5e9445112b | ||
|
|
9ce55231a8 | ||
|
|
d0c290408f | ||
|
|
e559268be4 | ||
|
|
d0cc449e64 | ||
|
|
911958f5a0 | ||
|
|
d52deb0758 | ||
|
|
16b4382269 | ||
|
|
5325e6afe5 | ||
|
|
8aa4c0776b | ||
|
|
120f176f21 | ||
|
|
bf7a3b0f45 | ||
|
|
975d38b9f0 | ||
|
|
d91f6295f6 | ||
|
|
13b3660b6c | ||
|
|
af839e9609 | ||
|
|
dc4717af57 | ||
|
|
20fb82fa0a | ||
|
|
6c6888e516 | ||
|
|
0496044a76 | ||
|
|
b6f5077d58 | ||
|
|
62cdee3c6e | ||
|
|
368d3414c1 | ||
|
|
26571cab88 | ||
|
|
bf4fbc2fa8 | ||
|
|
66579b1466 | ||
|
|
6999c86048 | ||
|
|
127a5076dc | ||
|
|
e48d073ac4 | ||
|
|
e26c013593 | ||
|
|
54d6e2e585 | ||
|
|
45edbcdfe4 | ||
|
|
8811f28e50 | ||
|
|
1a269d6fa4 | ||
|
|
2ec2716ec0 | ||
|
|
e7e13c3dad | ||
|
|
47b3cbf8f3 | ||
|
|
e80dacb176 |
@@ -0,0 +1,33 @@
|
||||
{
|
||||
"name": "GitHub Readme Stats Dev",
|
||||
"image": "mcr.microsoft.com/devcontainers/base:ubuntu",
|
||||
"features": {
|
||||
"ghcr.io/devcontainers/features/node:1": { "version": "22" }
|
||||
},
|
||||
"forwardPorts": [3000],
|
||||
"portsAttributes": {
|
||||
"3000": { "label": "HTTP" }
|
||||
},
|
||||
"appPort": [],
|
||||
|
||||
// Use 'postCreateCommand' to run commands after the container is created.
|
||||
"postCreateCommand": "npm install -g vercel",
|
||||
|
||||
// Use 'postStartCommand' to run commands after the container is started.
|
||||
"postStartCommand": "hostname dev && npm install",
|
||||
|
||||
// Configure tool-specific properties.
|
||||
"customizations": {
|
||||
"vscode": {
|
||||
"extensions": [
|
||||
"yzhang.markdown-all-in-one",
|
||||
"esbenp.prettier-vscode",
|
||||
"dbaeumer.vscode-eslint",
|
||||
"github.vscode-github-actions"
|
||||
]
|
||||
}
|
||||
},
|
||||
|
||||
"remoteUser": "root",
|
||||
"privileged": true
|
||||
}
|
||||
+208
-208
@@ -1,234 +1,234 @@
|
||||
{
|
||||
"env": {
|
||||
"node": true,
|
||||
"browser": true,
|
||||
"es2021": true
|
||||
},
|
||||
"extends": [
|
||||
// "eslint:recommended",
|
||||
"prettier"
|
||||
],
|
||||
"parserOptions": {
|
||||
"sourceType": "module",
|
||||
"ecmaVersion": 2022
|
||||
},
|
||||
"rules": {
|
||||
// Possible Errors (overrides from recommended set)
|
||||
// {
|
||||
// "env": {
|
||||
// "node": true,
|
||||
// "browser": true,
|
||||
// "es2021": true
|
||||
// },
|
||||
// "extends": [
|
||||
// // "eslint:recommended",
|
||||
// "prettier"
|
||||
// ],
|
||||
// "parserOptions": {
|
||||
// "sourceType": "module",
|
||||
// "ecmaVersion": 2022
|
||||
// },
|
||||
// "rules": {
|
||||
// // Possible Errors (overrides from recommended set)
|
||||
|
||||
// "no-extra-parens": "error",
|
||||
"no-unexpected-multiline": "error",
|
||||
// // "no-extra-parens": "error",
|
||||
// "no-unexpected-multiline": "error",
|
||||
|
||||
// All JSDoc comments must be valid
|
||||
// // All JSDoc comments must be valid
|
||||
|
||||
"valid-jsdoc": [ "error", {
|
||||
"requireReturn": true,
|
||||
"requireReturnDescription": true,
|
||||
"requireParamDescription": true,
|
||||
"prefer": {
|
||||
"return": "returns"
|
||||
}
|
||||
}],
|
||||
// "valid-jsdoc": [ "error", {
|
||||
// "requireReturn": true,
|
||||
// "requireReturnDescription": true,
|
||||
// "requireParamDescription": true,
|
||||
// "prefer": {
|
||||
// "return": "returns"
|
||||
// }
|
||||
// }],
|
||||
|
||||
// Best Practices
|
||||
// // Best Practices
|
||||
|
||||
// Allowed a getter without setter, but all setters require getters
|
||||
// // Allowed a getter without setter, but all setters require getters
|
||||
|
||||
"accessor-pairs": [ "error", {
|
||||
"getWithoutSet": false,
|
||||
"setWithoutGet": true
|
||||
}],
|
||||
"block-scoped-var": "warn",
|
||||
"consistent-return": "error",
|
||||
"curly": "error",
|
||||
// "default-case": "warn",
|
||||
// "accessor-pairs": [ "error", {
|
||||
// "getWithoutSet": false,
|
||||
// "setWithoutGet": true
|
||||
// }],
|
||||
// "block-scoped-var": "warn",
|
||||
// "consistent-return": "error",
|
||||
// "curly": "error",
|
||||
// // "default-case": "warn",
|
||||
|
||||
// the dot goes with the property when doing multiline
|
||||
// // the dot goes with the property when doing multiline
|
||||
|
||||
// "dot-location": [ "warn", "property" ],
|
||||
// "dot-notation": "warn",
|
||||
// "eqeqeq": [ "error", "smart" ],
|
||||
// "guard-for-in": "warn",
|
||||
"no-alert": "error",
|
||||
"no-caller": "error",
|
||||
// "no-case-declarations": "warn",
|
||||
// "no-div-regex": "warn",
|
||||
// "no-else-return": "warn",
|
||||
// "no-empty-label": "warn",
|
||||
// "no-empty-pattern": "warn",
|
||||
// "no-eq-null": "warn",
|
||||
// "no-eval": "error",
|
||||
// "no-extend-native": "error",
|
||||
// "no-extra-bind": "warn",
|
||||
// "no-floating-decimal": "warn",
|
||||
// "no-implicit-coercion": [ "warn", {
|
||||
// "boolean": true,
|
||||
// "number": true,
|
||||
// "string": true
|
||||
// }],
|
||||
// "no-implied-eval": "error",
|
||||
// "no-invalid-this": "error",
|
||||
// "no-iterator": "error",
|
||||
// "no-labels": "warn",
|
||||
// "no-lone-blocks": "warn",
|
||||
// "no-loop-func": "error",
|
||||
// "no-magic-numbers": "warn",
|
||||
// "no-multi-spaces": "error",
|
||||
// "no-multi-str": "warn",
|
||||
// "no-native-reassign": "error",
|
||||
// "no-new-func": "error",
|
||||
// "no-new-wrappers": "error",
|
||||
// "no-new": "error",
|
||||
// "no-octal-escape": "error",
|
||||
// "no-param-reassign": "error",
|
||||
// "no-process-env": "warn",
|
||||
// "no-proto": "error",
|
||||
// "no-redeclare": "error",
|
||||
// "no-return-assign": "error",
|
||||
// "no-script-url": "error",
|
||||
// "no-self-compare": "error",
|
||||
// "no-throw-literal": "error",
|
||||
// "no-unused-expressions": "error",
|
||||
// "no-useless-call": "error",
|
||||
// "no-useless-concat": "error",
|
||||
// "no-void": "warn",
|
||||
// // "dot-location": [ "warn", "property" ],
|
||||
// // "dot-notation": "warn",
|
||||
// // "eqeqeq": [ "error", "smart" ],
|
||||
// // "guard-for-in": "warn",
|
||||
// "no-alert": "error",
|
||||
// "no-caller": "error",
|
||||
// // "no-case-declarations": "warn",
|
||||
// // "no-div-regex": "warn",
|
||||
// // "no-else-return": "warn",
|
||||
// // "no-empty-label": "warn",
|
||||
// // "no-empty-pattern": "warn",
|
||||
// // "no-eq-null": "warn",
|
||||
// // "no-eval": "error",
|
||||
// // "no-extend-native": "error",
|
||||
// // "no-extra-bind": "warn",
|
||||
// // "no-floating-decimal": "warn",
|
||||
// // "no-implicit-coercion": [ "warn", {
|
||||
// // "boolean": true,
|
||||
// // "number": true,
|
||||
// // "string": true
|
||||
// // }],
|
||||
// // "no-implied-eval": "error",
|
||||
// // "no-invalid-this": "error",
|
||||
// // "no-iterator": "error",
|
||||
// // "no-labels": "warn",
|
||||
// // "no-lone-blocks": "warn",
|
||||
// // "no-loop-func": "error",
|
||||
// // "no-magic-numbers": "warn",
|
||||
// // "no-multi-spaces": "error",
|
||||
// // "no-multi-str": "warn",
|
||||
// // "no-native-reassign": "error",
|
||||
// // "no-new-func": "error",
|
||||
// // "no-new-wrappers": "error",
|
||||
// // "no-new": "error",
|
||||
// // "no-octal-escape": "error",
|
||||
// // "no-param-reassign": "error",
|
||||
// // "no-process-env": "warn",
|
||||
// // "no-proto": "error",
|
||||
// // "no-redeclare": "error",
|
||||
// // "no-return-assign": "error",
|
||||
// // "no-script-url": "error",
|
||||
// // "no-self-compare": "error",
|
||||
// // "no-throw-literal": "error",
|
||||
// // "no-unused-expressions": "error",
|
||||
// // "no-useless-call": "error",
|
||||
// // "no-useless-concat": "error",
|
||||
// // "no-void": "warn",
|
||||
|
||||
// Produce warnings when something is commented as TODO or FIXME
|
||||
// // Produce warnings when something is commented as TODO or FIXME
|
||||
|
||||
"no-warning-comments": [ "warn", {
|
||||
"terms": [ "TODO", "FIXME" ],
|
||||
"location": "start"
|
||||
}],
|
||||
"no-with": "warn",
|
||||
"radix": "warn",
|
||||
// "vars-on-top": "error",
|
||||
// "no-warning-comments": [ "warn", {
|
||||
// "terms": [ "TODO", "FIXME" ],
|
||||
// "location": "start"
|
||||
// }],
|
||||
// "no-with": "warn",
|
||||
// "radix": "warn",
|
||||
// // "vars-on-top": "error",
|
||||
|
||||
// Enforces the style of wrapped functions
|
||||
// "wrap-iife": [ "error", "outside" ],
|
||||
// "yoda": "error",
|
||||
// // Enforces the style of wrapped functions
|
||||
// // "wrap-iife": [ "error", "outside" ],
|
||||
// // "yoda": "error",
|
||||
|
||||
// Strict Mode - for ES6, never use strict.
|
||||
// "strict": [ "error", "never" ],
|
||||
// // Strict Mode - for ES6, never use strict.
|
||||
// // "strict": [ "error", "never" ],
|
||||
|
||||
// Variables
|
||||
// // Variables
|
||||
|
||||
// "init-declarations": [ "error", "always" ],
|
||||
// "no-catch-shadow": "warn",
|
||||
"no-delete-var": "error",
|
||||
// "no-label-var": "error",
|
||||
// "no-shadow-restricted-names": "error",
|
||||
// "no-shadow": "warn",
|
||||
// // "init-declarations": [ "error", "always" ],
|
||||
// // "no-catch-shadow": "warn",
|
||||
// "no-delete-var": "error",
|
||||
// // "no-label-var": "error",
|
||||
// // "no-shadow-restricted-names": "error",
|
||||
// // "no-shadow": "warn",
|
||||
|
||||
// We require all vars to be initialized (see init-declarations)
|
||||
// If we NEED a var to be initialized to undefined, it needs to be explicit
|
||||
// // We require all vars to be initialized (see init-declarations)
|
||||
// // If we NEED a var to be initialized to undefined, it needs to be explicit
|
||||
|
||||
"no-undef-init": "off",
|
||||
"no-undef": "error",
|
||||
"no-undefined": "off",
|
||||
"no-unused-vars": "warn",
|
||||
// "no-undef-init": "off",
|
||||
// "no-undef": "error",
|
||||
// "no-undefined": "off",
|
||||
// "no-unused-vars": "warn",
|
||||
|
||||
// Disallow hoisting - let & const don't allow hoisting anyhow
|
||||
// // Disallow hoisting - let & const don't allow hoisting anyhow
|
||||
|
||||
"no-use-before-define": "error",
|
||||
// "no-use-before-define": "error",
|
||||
|
||||
// Node.js and CommonJS
|
||||
// // Node.js and CommonJS
|
||||
|
||||
// "callback-return": [ "warn", [ "callback", "next" ]],
|
||||
// "global-require": "error",
|
||||
// "handle-callback-err": "warn",
|
||||
// "no-mixed-requires": "warn",
|
||||
// "no-new-require": "error",
|
||||
// // "callback-return": [ "warn", [ "callback", "next" ]],
|
||||
// // "global-require": "error",
|
||||
// // "handle-callback-err": "warn",
|
||||
// // "no-mixed-requires": "warn",
|
||||
// // "no-new-require": "error",
|
||||
|
||||
// Use path.concat instead
|
||||
// // Use path.concat instead
|
||||
|
||||
// "no-path-concat": "error",
|
||||
// "no-process-exit": "error",
|
||||
// "no-restricted-modules": "off",
|
||||
// "no-sync": "warn",
|
||||
// // "no-path-concat": "error",
|
||||
// // "no-process-exit": "error",
|
||||
// // "no-restricted-modules": "off",
|
||||
// // "no-sync": "warn",
|
||||
|
||||
// ECMAScript 6 support
|
||||
// // ECMAScript 6 support
|
||||
|
||||
// "arrow-body-style": [ "error", "always" ],
|
||||
// "arrow-parens": [ "error", "always" ],
|
||||
// "arrow-spacing": [ "error", { "before": true, "after": true }],
|
||||
"constructor-super": "error",
|
||||
// "generator-star-spacing": [ "error", "before" ],
|
||||
// "no-arrow-condition": "error",
|
||||
"no-class-assign": "error",
|
||||
"no-const-assign": "error",
|
||||
"no-dupe-class-members": "error",
|
||||
"no-this-before-super": "error",
|
||||
// "no-var": "warn",
|
||||
"object-shorthand": [ "warn" ],
|
||||
// "prefer-arrow-callback": "warn",
|
||||
// "prefer-spread": "warn",
|
||||
// "prefer-template": "warn",
|
||||
// "require-yield": "error",
|
||||
// // "arrow-body-style": [ "error", "always" ],
|
||||
// // "arrow-parens": [ "error", "always" ],
|
||||
// // "arrow-spacing": [ "error", { "before": true, "after": true }],
|
||||
// "constructor-super": "error",
|
||||
// // "generator-star-spacing": [ "error", "before" ],
|
||||
// // "no-arrow-condition": "error",
|
||||
// "no-class-assign": "error",
|
||||
// "no-const-assign": "error",
|
||||
// "no-dupe-class-members": "error",
|
||||
// "no-this-before-super": "error",
|
||||
// // "no-var": "warn",
|
||||
// "object-shorthand": [ "warn" ],
|
||||
// // "prefer-arrow-callback": "warn",
|
||||
// // "prefer-spread": "warn",
|
||||
// // "prefer-template": "warn",
|
||||
// // "require-yield": "error",
|
||||
|
||||
// Stylistic - everything here is a warning because of style.
|
||||
// // Stylistic - everything here is a warning because of style.
|
||||
|
||||
// "array-bracket-spacing": [ "warn", "always" ],
|
||||
// "block-spacing": [ "warn", "always" ],
|
||||
// "brace-style": [ "warn", "1tbs", { "allowSingleLine": false } ],
|
||||
// "camelcase": "warn",
|
||||
// "comma-spacing": [ "warn", { "before": false, "after": true } ],
|
||||
// "comma-style": [ "warn", "last" ],
|
||||
// "computed-property-spacing": [ "warn", "never" ],
|
||||
// "consistent-this": [ "warn", "self" ],
|
||||
// "eol-last": "warn",
|
||||
// "func-names": "warn",
|
||||
// "func-style": [ "warn", "declaration" ],
|
||||
// "id-length": [ "warn", { "min": 2, "max": 32 } ],
|
||||
// "indent": [ "warn", 4 ],
|
||||
// "jsx-quotes": [ "warn", "prefer-double" ],
|
||||
// "linebreak-style": [ "warn", "unix" ],
|
||||
// "lines-around-comment": [ "warn", { "beforeBlockComment": true } ],
|
||||
// "max-depth": [ "warn", 8 ],
|
||||
// "max-len": [ "warn", 132 ],
|
||||
// "max-nested-callbacks": [ "warn", 8 ],
|
||||
// "max-params": [ "warn", 8 ],
|
||||
// "new-cap": "warn",
|
||||
// "new-parens": "warn",
|
||||
// "no-array-constructor": "warn",
|
||||
// "no-bitwise": "off",
|
||||
// "no-continue": "off",
|
||||
// "no-inline-comments": "off",
|
||||
// "no-lonely-if": "warn",
|
||||
"no-mixed-spaces-and-tabs": "warn",
|
||||
"no-multiple-empty-lines": "warn",
|
||||
"no-negated-condition": "warn",
|
||||
// "no-nested-ternary": "warn",
|
||||
// "no-new-object": "warn",
|
||||
// "no-plusplus": "off",
|
||||
// "no-spaced-func": "warn",
|
||||
// "no-ternary": "off",
|
||||
// "no-trailing-spaces": "warn",
|
||||
// "no-underscore-dangle": "warn",
|
||||
"no-unneeded-ternary": "warn",
|
||||
// "object-curly-spacing": [ "warn", "always" ],
|
||||
// "one-var": "off",
|
||||
// "operator-assignment": [ "warn", "never" ],
|
||||
// "operator-linebreak": [ "warn", "after" ],
|
||||
// "padded-blocks": [ "warn", "never" ],
|
||||
// "quote-props": [ "warn", "consistent-as-needed" ],
|
||||
// "quotes": [ "warn", "single" ],
|
||||
"require-jsdoc": [ "warn", {
|
||||
"require": {
|
||||
"FunctionDeclaration": true,
|
||||
"MethodDefinition": true,
|
||||
"ClassDeclaration": false
|
||||
}
|
||||
}],
|
||||
// "semi-spacing": [ "warn", { "before": false, "after": true }],
|
||||
// "semi": [ "error", "always" ],
|
||||
// "sort-vars": "off",
|
||||
"keyword-spacing": ["error", { "before": true, "after": true }]
|
||||
// "space-before-blocks": [ "warn", "always" ],
|
||||
// "space-before-function-paren": [ "warn", "never" ],
|
||||
// "space-in-parens": [ "warn", "never" ],
|
||||
// "space-infix-ops": [ "warn", { "int32Hint": true } ],
|
||||
// "space-return-throw-case": "error",
|
||||
// "space-unary-ops": "error",
|
||||
// "spaced-comment": [ "warn", "always" ],
|
||||
// "wrap-regex": "warn"
|
||||
}
|
||||
}
|
||||
// // "array-bracket-spacing": [ "warn", "always" ],
|
||||
// // "block-spacing": [ "warn", "always" ],
|
||||
// // "brace-style": [ "warn", "1tbs", { "allowSingleLine": false } ],
|
||||
// // "camelcase": "warn",
|
||||
// // "comma-spacing": [ "warn", { "before": false, "after": true } ],
|
||||
// // "comma-style": [ "warn", "last" ],
|
||||
// // "computed-property-spacing": [ "warn", "never" ],
|
||||
// // "consistent-this": [ "warn", "self" ],
|
||||
// // "eol-last": "warn",
|
||||
// // "func-names": "warn",
|
||||
// // "func-style": [ "warn", "declaration" ],
|
||||
// // "id-length": [ "warn", { "min": 2, "max": 32 } ],
|
||||
// // "indent": [ "warn", 4 ],
|
||||
// // "jsx-quotes": [ "warn", "prefer-double" ],
|
||||
// // "linebreak-style": [ "warn", "unix" ],
|
||||
// // "lines-around-comment": [ "warn", { "beforeBlockComment": true } ],
|
||||
// // "max-depth": [ "warn", 8 ],
|
||||
// // "max-len": [ "warn", 132 ],
|
||||
// // "max-nested-callbacks": [ "warn", 8 ],
|
||||
// // "max-params": [ "warn", 8 ],
|
||||
// // "new-cap": "warn",
|
||||
// // "new-parens": "warn",
|
||||
// // "no-array-constructor": "warn",
|
||||
// // "no-bitwise": "off",
|
||||
// // "no-continue": "off",
|
||||
// // "no-inline-comments": "off",
|
||||
// // "no-lonely-if": "warn",
|
||||
// "no-mixed-spaces-and-tabs": "warn",
|
||||
// "no-multiple-empty-lines": "warn",
|
||||
// "no-negated-condition": "warn",
|
||||
// // "no-nested-ternary": "warn",
|
||||
// // "no-new-object": "warn",
|
||||
// // "no-plusplus": "off",
|
||||
// // "no-spaced-func": "warn",
|
||||
// // "no-ternary": "off",
|
||||
// // "no-trailing-spaces": "warn",
|
||||
// // "no-underscore-dangle": "warn",
|
||||
// "no-unneeded-ternary": "warn",
|
||||
// // "object-curly-spacing": [ "warn", "always" ],
|
||||
// // "one-var": "off",
|
||||
// // "operator-assignment": [ "warn", "never" ],
|
||||
// // "operator-linebreak": [ "warn", "after" ],
|
||||
// // "padded-blocks": [ "warn", "never" ],
|
||||
// // "quote-props": [ "warn", "consistent-as-needed" ],
|
||||
// // "quotes": [ "warn", "single" ],
|
||||
// "require-jsdoc": [ "warn", {
|
||||
// "require": {
|
||||
// "FunctionDeclaration": true,
|
||||
// "MethodDefinition": true,
|
||||
// "ClassDeclaration": false
|
||||
// }
|
||||
// }],
|
||||
// // "semi-spacing": [ "warn", { "before": false, "after": true }],
|
||||
// // "semi": [ "error", "always" ],
|
||||
// // "sort-vars": "off",
|
||||
// "keyword-spacing": ["error", { "before": true, "after": true }]
|
||||
// // "space-before-blocks": [ "warn", "always" ],
|
||||
// // "space-before-function-paren": [ "warn", "never" ],
|
||||
// // "space-in-parens": [ "warn", "never" ],
|
||||
// // "space-infix-ops": [ "warn", { "int32Hint": true } ],
|
||||
// // "space-return-throw-case": "error",
|
||||
// // "space-unary-ops": "error",
|
||||
// // "spaced-comment": [ "warn", "always" ],
|
||||
// // "wrap-regex": "warn"
|
||||
// }
|
||||
// }
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
dist/* linguist-vendored=false
|
||||
@@ -0,0 +1,36 @@
|
||||
name: Push Develop
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'develop'
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile
|
||||
# for this project, we keep docker in its own folder, to keep it isolated from upstream
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: |
|
||||
${{ vars.DOCKERHUB_TARGET }}:develop
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
name: Push Docker
|
||||
|
||||
on:
|
||||
push:
|
||||
tags:
|
||||
- '*-*-*'
|
||||
# for this project, we do "YYYY-MM-DD" for version numbers, due to unversioned upstream
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Setup Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to Docker Hub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
|
||||
- name: Build image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
file: docker/Dockerfile
|
||||
# for this project, we keep docker in its own folder, to keep it isolated from upstream
|
||||
push: true
|
||||
platforms: linux/amd64,linux/arm64
|
||||
tags: |
|
||||
${{ vars.DOCKERHUB_TARGET }}:latest
|
||||
${{ vars.DOCKERHUB_TARGET }}:${{ github.ref_name }}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
name: Sync GitHub
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- '**'
|
||||
|
||||
jobs:
|
||||
sync:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Configure Git
|
||||
run: |
|
||||
git config --global user.name "Andrew Sync"
|
||||
git config --global user.email "sync@digitaladapt.com"
|
||||
|
||||
- name: Add GitHub Remote
|
||||
env:
|
||||
SYNC_TOKEN: ${{ secrets.SYNC_GITHUB_TOKEN }}
|
||||
SYNC_TARGET: ${{ vars.SYNC_GITHUB_TARGET }}
|
||||
run: |
|
||||
git remote add github "https://digitaladapt:${SYNC_TOKEN}@github.com/$SYNC_TARGET"
|
||||
|
||||
- name: Push Current Branch
|
||||
run: |
|
||||
git push github HEAD:${GITHUB_REF_NAME}
|
||||
|
||||
- name: Push Tags
|
||||
run: |
|
||||
git push github --tags
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
# This file is used to define code owners for the repository.
|
||||
# Code owners are automatically requested for review when someone opens a pull request that modifies code they own.
|
||||
|
||||
# Assign @qwerty541 as the owner for package.json and package-lock.json
|
||||
package.json @qwerty541
|
||||
package-lock.json @qwerty541
|
||||
+11
-5
@@ -1,6 +1,6 @@
|
||||
version: 2
|
||||
updates:
|
||||
# Maintain dependencies for NPM
|
||||
# Maintain dependencies for npm
|
||||
- package-ecosystem: npm
|
||||
directory: "/"
|
||||
schedule:
|
||||
@@ -9,8 +9,6 @@ updates:
|
||||
commit-message:
|
||||
prefix: "build(deps)"
|
||||
prefix-development: "build(deps-dev)"
|
||||
reviewers:
|
||||
- "qwerty541"
|
||||
|
||||
# Maintain dependencies for GitHub Actions
|
||||
- package-ecosystem: github-actions
|
||||
@@ -21,5 +19,13 @@ updates:
|
||||
commit-message:
|
||||
prefix: "ci(deps)"
|
||||
prefix-development: "ci(deps-dev)"
|
||||
reviewers:
|
||||
- "qwerty541"
|
||||
|
||||
# Maintain dependencies for Devcontainers
|
||||
- package-ecosystem: devcontainers
|
||||
directory: "/"
|
||||
schedule:
|
||||
interval: weekly
|
||||
open-pull-requests-limit: 10
|
||||
commit-message:
|
||||
prefix: "build(deps)"
|
||||
prefix-development: "build(deps-dev)"
|
||||
|
||||
+10
-15
@@ -3,11 +3,6 @@ themes:
|
||||
- any-glob-to-any-file:
|
||||
- themes/index.js
|
||||
|
||||
doc-translation:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- docs/*
|
||||
|
||||
card-i18n:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
@@ -32,8 +27,8 @@ lang-card:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- api/top-langs.js
|
||||
- src/cards/top-languages-card.js
|
||||
- src/fetchers/top-languages-fetcher.js
|
||||
- src/cards/top-languages.js
|
||||
- src/fetchers/top-languages.js
|
||||
- tests/fetchTopLanguages.test.js
|
||||
- tests/renderTopLanguagesCard.test.js
|
||||
- tests/top-langs.test.js
|
||||
@@ -42,8 +37,8 @@ repo-card:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- api/pin.js
|
||||
- src/cards/repo-card.js
|
||||
- src/fetchers/repo-fetcher.js
|
||||
- src/cards/repo.js
|
||||
- src/fetchers/repo.js
|
||||
- tests/fetchRepo.test.js
|
||||
- tests/renderRepoCard.test.js
|
||||
- tests/pin.test.js
|
||||
@@ -52,8 +47,8 @@ stats-card:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- api/index.js
|
||||
- src/cards/stats-card.js
|
||||
- src/fetchers/stats-fetcher.js
|
||||
- src/cards/stats.js
|
||||
- src/fetchers/stats.js
|
||||
- tests/fetchStats.test.js
|
||||
- tests/renderStatsCard.test.js
|
||||
- tests/api.test.js
|
||||
@@ -62,8 +57,8 @@ wakatime-card:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- api/wakatime.js
|
||||
- src/cards/wakatime-card.js
|
||||
- src/fetchers/wakatime-fetcher.js
|
||||
- src/cards/wakatime.js
|
||||
- src/fetchers/wakatime.js
|
||||
- tests/fetchWakatime.test.js
|
||||
- tests/renderWakatimeCard.test.js
|
||||
- tests/wakatime.test.js
|
||||
@@ -72,8 +67,8 @@ gist-card:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file:
|
||||
- api/gist.js
|
||||
- src/cards/gist-card.js
|
||||
- src/fetchers/gist-fetcher.js
|
||||
- src/cards/gist.js
|
||||
- src/fetchers/gist.js
|
||||
- tests/fetchGist.test.js
|
||||
- tests/renderGistCard.test.js
|
||||
- tests/gist.test.js
|
||||
|
||||
@@ -24,12 +24,14 @@ permissions:
|
||||
|
||||
jobs:
|
||||
CodeQL-Build:
|
||||
if: github.repository == 'anuraghazra/github-readme-stats'
|
||||
|
||||
# CodeQL runs on ubuntu-latest, windows-latest, and macos-latest
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
# Initializes the CodeQL tools for scanning.
|
||||
- name: Initialize CodeQL
|
||||
|
||||
@@ -4,7 +4,7 @@ file = open('./vercel.json', 'r')
|
||||
str = file.read()
|
||||
file = open('./vercel.json', 'w')
|
||||
|
||||
str = str.replace('"maxDuration": 10', '"maxDuration": 30')
|
||||
str = str.replace('"maxDuration": 10', '"maxDuration": 15')
|
||||
|
||||
file.write(str)
|
||||
file.close()
|
||||
|
||||
@@ -10,10 +10,10 @@ jobs:
|
||||
if: github.repository == 'anuraghazra/github-readme-stats'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
- name: Deployment Prep
|
||||
run: python ./.github/workflows/deploy-prep.py
|
||||
- uses: stefanzweifel/git-auto-commit-action@8621497c8c39c72f3e2a999a26b4ca1b5058a842 # v5.0.1
|
||||
- uses: stefanzweifel/git-auto-commit-action@28e16e81777b558cc906c8750092100bbb34c5e3 # v7.0.0
|
||||
with:
|
||||
branch: vercel
|
||||
create_branch: true
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
name: Test Deployment
|
||||
on:
|
||||
deployment_status:
|
||||
# Temporarily disabled automatic triggers; manual-only for now.
|
||||
workflow_dispatch:
|
||||
# Original trigger (restore to re-enable):
|
||||
# deployment_status:
|
||||
|
||||
permissions: read-all
|
||||
|
||||
jobs:
|
||||
e2eTests:
|
||||
if:
|
||||
github.repository == 'anuraghazra/github-readme-stats' &&
|
||||
github.event_name == 'deployment_status' &&
|
||||
github.event.deployment_status.state == 'success'
|
||||
name: Perform 2e2 tests
|
||||
# Temporarily disabled; set to the original condition to re-enable.
|
||||
# if:
|
||||
# github.repository == 'anuraghazra/github-readme-stats' &&
|
||||
# github.event_name == 'deployment_status' &&
|
||||
# github.event.deployment_status.state == 'success'
|
||||
if: false
|
||||
name: Perform e2e tests
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18.x]
|
||||
node-version: [22.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: npm
|
||||
@@ -32,5 +37,5 @@ jobs:
|
||||
|
||||
- name: Run end-to-end tests.
|
||||
run: npm run test:e2e
|
||||
env:
|
||||
VERCEL_PREVIEW_URL: ${{ github.event.deployment_status.target_url }}
|
||||
# env:
|
||||
# VERCEL_PREVIEW_URL: ${{ github.event.deployment_status.target_url }}
|
||||
|
||||
@@ -27,7 +27,7 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# NOTE: Retrieve issue templates.
|
||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: Run empty issues closer action
|
||||
uses: rickstaa/empty-issues-closer-action@e96914613221511279ca25f50fd4acc85e331d99 # v1.1.74
|
||||
|
||||
@@ -5,6 +5,7 @@ on:
|
||||
- master
|
||||
paths:
|
||||
- "themes/index.js"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
@@ -26,13 +27,13 @@ jobs:
|
||||
name: Generate theme doc
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18.x]
|
||||
node-version: [22.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: npm
|
||||
|
||||
@@ -21,7 +21,7 @@ jobs:
|
||||
if: github.repository == 'anuraghazra/github-readme-stats'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@8558fd74291d67161a8a78ce36a881fa63b766a9 # v5.0.0
|
||||
- uses: actions/labeler@634933edcd8ababfe52f92936142cc22ac488b1b # v6.0.1
|
||||
with:
|
||||
repo-token: "${{ secrets.GITHUB_TOKEN }}"
|
||||
sync-labels: true
|
||||
|
||||
@@ -22,12 +22,12 @@ jobs:
|
||||
|
||||
steps:
|
||||
- name: "Checkout code"
|
||||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
with:
|
||||
persist-credentials: false
|
||||
|
||||
- name: "Run analysis"
|
||||
uses: ossf/scorecard-action@dc50aa9510b46c811795eb24b2f1ba02a914e534 # v2.3.3
|
||||
uses: ossf/scorecard-action@4eaacf0543bb3f2c246792bd56e8cdeffafb205a # v2.4.3
|
||||
with:
|
||||
results_file: results.sarif
|
||||
results_format: sarif
|
||||
@@ -36,7 +36,7 @@ jobs:
|
||||
# Upload the results as artifacts (optional). Commenting out will disable uploads of run results in SARIF
|
||||
# format to the repository Actions tab.
|
||||
- name: "Upload artifact"
|
||||
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
|
||||
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
|
||||
with:
|
||||
name: SARIF file
|
||||
path: results.sarif
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
name: Theme preview
|
||||
on:
|
||||
pull_request_target:
|
||||
types: [opened, edited, reopened, synchronize]
|
||||
branches:
|
||||
- master
|
||||
paths:
|
||||
- "themes/index.js"
|
||||
# Temporary disabled due to paused themes addition.
|
||||
# See: https://github.com/anuraghazra/github-readme-stats/issues/3404
|
||||
# pull_request_target:
|
||||
# types: [opened, edited, reopened, synchronize]
|
||||
# branches:
|
||||
# - master
|
||||
# paths:
|
||||
# - "themes/index.js"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
@@ -27,18 +30,18 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18.x]
|
||||
node-version: [22.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: npm
|
||||
|
||||
- uses: bahmutov/npm-install@e5c7e14408aa6089501de32bd16123b41738047e # v1.10.2
|
||||
- uses: bahmutov/npm-install@3e063b974f0d209807684aa23e534b3dde517fd9 # v1.11.2
|
||||
with:
|
||||
useLockFile: false
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
name: prs cache clean
|
||||
name: Cleanup closed pull requests cache
|
||||
on:
|
||||
pull_request:
|
||||
types:
|
||||
@@ -22,9 +22,6 @@ jobs:
|
||||
cleanup:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
|
||||
- name: Cleanup
|
||||
run: |
|
||||
gh extension install actions/gh-actions-cache
|
||||
|
||||
@@ -1,16 +1,19 @@
|
||||
name: Close stale theme pull requests that have the 'invalid' label.
|
||||
on:
|
||||
schedule:
|
||||
# ┌───────────── minute (0 - 59)
|
||||
# │ ┌───────────── hour (0 - 23)
|
||||
# │ │ ┌───────────── day of the month (1 - 31)
|
||||
# │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
|
||||
# │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
|
||||
# │ │ │ │ │
|
||||
# │ │ │ │ │
|
||||
# │ │ │ │ │
|
||||
# * * * * *
|
||||
- cron: "0 0 */7 * *"
|
||||
# Temporary disabled due to paused themes addition.
|
||||
# See: https://github.com/anuraghazra/github-readme-stats/issues/3404
|
||||
# schedule:
|
||||
# # ┌───────────── minute (0 - 59)
|
||||
# # │ ┌───────────── hour (0 - 23)
|
||||
# # │ │ ┌───────────── day of the month (1 - 31)
|
||||
# # │ │ │ ┌───────────── month (1 - 12 or JAN-DEC)
|
||||
# # │ │ │ │ ┌───────────── day of the week (0 - 6 or SUN-SAT)
|
||||
# # │ │ │ │ │
|
||||
# # │ │ │ │ │
|
||||
# # │ │ │ │ │
|
||||
# # * * * * *
|
||||
# - cron: "0 0 */7 * *"
|
||||
workflow_dispatch:
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
@@ -33,18 +36,18 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18.x]
|
||||
node-version: [22.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: npm
|
||||
|
||||
- uses: bahmutov/npm-install@e5c7e14408aa6089501de32bd16123b41738047e # v1.10.2
|
||||
- uses: bahmutov/npm-install@3e063b974f0d209807684aa23e534b3dde517fd9 # v1.11.2
|
||||
with:
|
||||
useLockFile: false
|
||||
|
||||
|
||||
@@ -15,13 +15,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18.x]
|
||||
node-version: [22.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: npm
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
name: Theme Pull Requests Closer
|
||||
|
||||
on:
|
||||
- pull_request_target
|
||||
|
||||
permissions:
|
||||
actions: read
|
||||
checks: read
|
||||
contents: read
|
||||
deployments: read
|
||||
issues: read
|
||||
discussions: read
|
||||
packages: read
|
||||
pages: read
|
||||
pull-requests: write
|
||||
repository-projects: read
|
||||
security-events: read
|
||||
statuses: read
|
||||
|
||||
jobs:
|
||||
close-prs:
|
||||
if: github.repository == 'anuraghazra/github-readme-stats'
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out the code
|
||||
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: Set up Git
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
|
||||
- name: Close Pull Requests
|
||||
run: |
|
||||
comment_message="We are currently pausing addition of new themes. If this theme is exclusively for your personal use, then instead of adding it to our theme collection, you can use card [customization options](https://github.com/anuraghazra/github-readme-stats?tab=readme-ov-file#customization)."
|
||||
|
||||
for pr_number in $(gh pr list -l "themes" -q is:open --json number -q ".[].number"); do
|
||||
gh pr close $pr_number -c "$comment_message"
|
||||
done
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -33,13 +33,13 @@ jobs:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [18.x]
|
||||
node-version: [22.x]
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
|
||||
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
|
||||
uses: actions/setup-node@395ad3262231945c25e8478fd5baf05154b1d79f # v6.1.0
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
cache: npm
|
||||
@@ -53,7 +53,7 @@ jobs:
|
||||
run: npm run generate-langs-json
|
||||
|
||||
- name: Create Pull Request if upstream language file is changed
|
||||
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
|
||||
uses: peter-evans/create-pull-request@98357b18bf14b5342f975ff684046ec3b2a07725 # v8.0.0
|
||||
with:
|
||||
commit-message: "refactor: update languages JSON"
|
||||
branch: "update_langs/patch"
|
||||
|
||||
+14
-2
@@ -1,3 +1,15 @@
|
||||
.devcontainer
|
||||
.github
|
||||
.husky
|
||||
.vscode
|
||||
benchmarks
|
||||
coverage
|
||||
scripts
|
||||
tests
|
||||
.env
|
||||
package-lock.json
|
||||
coverage
|
||||
**/*.md
|
||||
**/*.svg
|
||||
.eslintrc.json
|
||||
.prettierignore
|
||||
.pretterrc.json
|
||||
codecov.yml
|
||||
|
||||
Vendored
+3
-1
@@ -2,6 +2,8 @@
|
||||
"recommendations": [
|
||||
"yzhang.markdown-all-in-one",
|
||||
"esbenp.prettier-vscode",
|
||||
"dbaeumer.vscode-eslint"
|
||||
"dbaeumer.vscode-eslint",
|
||||
"ms-azuretools.vscode-containers",
|
||||
"github.vscode-github-actions"
|
||||
]
|
||||
}
|
||||
|
||||
Vendored
+3
@@ -2,4 +2,7 @@
|
||||
"markdown.extension.toc.levels": "1..3",
|
||||
"editor.formatOnSave": true,
|
||||
"editor.defaultFormatter": "esbenp.prettier-vscode",
|
||||
"[javascript]": {
|
||||
"editor.tabSize": 2
|
||||
}
|
||||
}
|
||||
|
||||
+4
-3
@@ -35,16 +35,17 @@ _(make sure you already have a [Vercel](https://vercel.com/) account)_
|
||||
3. Run `npm install` in the repository root.
|
||||
4. Run the command `vercel` in the root and follow the steps there.
|
||||
5. Run the command `vercel dev` to start a development server at <http://localhost:3000>.
|
||||
6. The cards will then be available from this local endpoint (i.e. `http://localhost:3000/api?username=anuraghazra`).
|
||||
6. Create a `.env` file in the root and add the following line `NODE_ENV=development`, this will disable caching for local development.
|
||||
7. The cards will then be available from this local endpoint (i.e. `http://localhost:3000/api?username=anuraghazra`).
|
||||
|
||||
> [!NOTE]\
|
||||
> [!NOTE]
|
||||
> You can debug the package code in [Vscode](https://code.visualstudio.com/) by using the [Node.js: Attach to process](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_setting-up-an-attach-configuration) debug option. You can also debug any tests using the [VSCode Jest extension](https://marketplace.visualstudio.com/items?itemName=Orta.vscode-jest). For more information, see https://github.com/jest-community/vscode-jest/issues/912.
|
||||
|
||||
## Themes Contribution
|
||||
|
||||
We're currently paused addition of new themes to decrease maintenance efforts. All pull requests related to new themes will be closed.
|
||||
|
||||
> [!NOTE]\
|
||||
> [!NOTE]
|
||||
> If you are considering contributing your theme just because you are using it personally, then instead of adding it to our theme collection, you can use card [customization options](./readme.md#customization).
|
||||
|
||||
## Translations Contribution
|
||||
|
||||
+78
-55
@@ -1,13 +1,23 @@
|
||||
import {
|
||||
clampValue,
|
||||
CONSTANTS,
|
||||
renderError,
|
||||
parseBoolean,
|
||||
} from "../src/common/utils.js";
|
||||
import { isLocaleAvailable } from "../src/translations.js";
|
||||
import { renderGistCard } from "../src/cards/gist-card.js";
|
||||
import { fetchGist } from "../src/fetchers/gist-fetcher.js";
|
||||
// @ts-check
|
||||
|
||||
import { renderError } from "../src/common/render.js";
|
||||
import { isLocaleAvailable } from "../src/translations.js";
|
||||
import { renderGistCard } from "../src/cards/gist.js";
|
||||
import { fetchGist } from "../src/fetchers/gist.js";
|
||||
import {
|
||||
CACHE_TTL,
|
||||
resolveCacheSeconds,
|
||||
setCacheHeaders,
|
||||
setErrorCacheHeaders,
|
||||
} from "../src/common/cache.js";
|
||||
import { guardAccess } from "../src/common/access.js";
|
||||
import {
|
||||
MissingParamError,
|
||||
retrieveSecondaryMessage,
|
||||
} from "../src/common/error.js";
|
||||
import { parseBoolean } from "../src/common/ops.js";
|
||||
|
||||
// @ts-ignore
|
||||
export default async (req, res) => {
|
||||
const {
|
||||
id,
|
||||
@@ -26,49 +36,48 @@ export default async (req, res) => {
|
||||
|
||||
res.setHeader("Content-Type", "image/svg+xml");
|
||||
|
||||
const access = guardAccess({
|
||||
res,
|
||||
id,
|
||||
type: "gist",
|
||||
colors: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
});
|
||||
if (!access.isPassed) {
|
||||
return access.result;
|
||||
}
|
||||
|
||||
if (locale && !isLocaleAvailable(locale)) {
|
||||
return res.send(
|
||||
renderError("Something went wrong", "Language not found", {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
renderError({
|
||||
message: "Something went wrong",
|
||||
secondaryMessage: "Language not found",
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const gistData = await fetchGist(id);
|
||||
const cacheSeconds = resolveCacheSeconds({
|
||||
requested: parseInt(cache_seconds, 10),
|
||||
def: CACHE_TTL.GIST_CARD.DEFAULT,
|
||||
min: CACHE_TTL.GIST_CARD.MIN,
|
||||
max: CACHE_TTL.GIST_CARD.MAX,
|
||||
});
|
||||
|
||||
let cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.SIX_HOURS, 10),
|
||||
CONSTANTS.SIX_HOURS,
|
||||
CONSTANTS.ONE_DAY,
|
||||
);
|
||||
cacheSeconds = process.env.CACHE_SECONDS
|
||||
? parseInt(process.env.CACHE_SECONDS, 10) || cacheSeconds
|
||||
: cacheSeconds;
|
||||
|
||||
/*
|
||||
if star count & fork count is over 1k then we are kFormating the text
|
||||
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 = gistData.starsCount;
|
||||
const forks = gistData.forksCount;
|
||||
const isBothOver1K = stars > 1000 && forks > 1000;
|
||||
const isBothUnder1 = stars < 1 && forks < 1;
|
||||
if (!cache_seconds && (isBothOver1K || isBothUnder1)) {
|
||||
cacheSeconds = CONSTANTS.SIX_HOURS;
|
||||
}
|
||||
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=${
|
||||
cacheSeconds / 2
|
||||
}, s-maxage=${cacheSeconds}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
);
|
||||
setCacheHeaders(res, cacheSeconds);
|
||||
|
||||
return res.send(
|
||||
renderGistCard(gistData, {
|
||||
@@ -85,19 +94,33 @@ export default async (req, res) => {
|
||||
}),
|
||||
);
|
||||
} catch (err) {
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=${CONSTANTS.ERROR_CACHE_SECONDS / 2}, s-maxage=${
|
||||
CONSTANTS.ERROR_CACHE_SECONDS
|
||||
}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
); // Use lower cache period for errors.
|
||||
setErrorCacheHeaders(res);
|
||||
if (err instanceof Error) {
|
||||
return res.send(
|
||||
renderError({
|
||||
message: err.message,
|
||||
secondaryMessage: retrieveSecondaryMessage(err),
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
show_repo_link: !(err instanceof MissingParamError),
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
return res.send(
|
||||
renderError(err.message, err.secondaryMessage, {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
renderError({
|
||||
message: "An unknown error occurred",
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
+79
-52
@@ -1,15 +1,23 @@
|
||||
import { renderStatsCard } from "../src/cards/stats-card.js";
|
||||
import { blacklist } from "../src/common/blacklist.js";
|
||||
// @ts-check
|
||||
|
||||
import { renderStatsCard } from "../src/cards/stats.js";
|
||||
import { guardAccess } from "../src/common/access.js";
|
||||
import {
|
||||
clampValue,
|
||||
CONSTANTS,
|
||||
parseArray,
|
||||
parseBoolean,
|
||||
renderError,
|
||||
} from "../src/common/utils.js";
|
||||
import { fetchStats } from "../src/fetchers/stats-fetcher.js";
|
||||
CACHE_TTL,
|
||||
resolveCacheSeconds,
|
||||
setCacheHeaders,
|
||||
setErrorCacheHeaders,
|
||||
} from "../src/common/cache.js";
|
||||
import {
|
||||
MissingParamError,
|
||||
retrieveSecondaryMessage,
|
||||
} from "../src/common/error.js";
|
||||
import { parseArray, parseBoolean } from "../src/common/ops.js";
|
||||
import { renderError } from "../src/common/render.js";
|
||||
import { fetchStats } from "../src/fetchers/stats.js";
|
||||
import { isLocaleAvailable } from "../src/translations.js";
|
||||
|
||||
// @ts-ignore
|
||||
export default async (req, res) => {
|
||||
const {
|
||||
username,
|
||||
@@ -20,6 +28,7 @@ export default async (req, res) => {
|
||||
hide_rank,
|
||||
show_icons,
|
||||
include_all_commits,
|
||||
commits_year,
|
||||
line_height,
|
||||
title_color,
|
||||
ring_color,
|
||||
@@ -35,32 +44,41 @@ export default async (req, res) => {
|
||||
disable_animations,
|
||||
border_radius,
|
||||
number_format,
|
||||
number_precision,
|
||||
border_color,
|
||||
rank_icon,
|
||||
show,
|
||||
} = req.query;
|
||||
res.setHeader("Content-Type", "image/svg+xml");
|
||||
|
||||
if (blacklist.includes(username)) {
|
||||
return res.send(
|
||||
renderError("Something went wrong", "This username is blacklisted", {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
}),
|
||||
);
|
||||
const access = guardAccess({
|
||||
res,
|
||||
id: username,
|
||||
type: "username",
|
||||
colors: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
});
|
||||
if (!access.isPassed) {
|
||||
return access.result;
|
||||
}
|
||||
|
||||
if (locale && !isLocaleAvailable(locale)) {
|
||||
return res.send(
|
||||
renderError("Something went wrong", "Language not found", {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
renderError({
|
||||
message: "Something went wrong",
|
||||
secondaryMessage: "Language not found",
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
@@ -75,23 +93,16 @@ export default async (req, res) => {
|
||||
showStats.includes("prs_merged_percentage"),
|
||||
showStats.includes("discussions_started"),
|
||||
showStats.includes("discussions_answered"),
|
||||
parseInt(commits_year, 10),
|
||||
);
|
||||
const cacheSeconds = resolveCacheSeconds({
|
||||
requested: parseInt(cache_seconds, 10),
|
||||
def: CACHE_TTL.STATS_CARD.DEFAULT,
|
||||
min: CACHE_TTL.STATS_CARD.MIN,
|
||||
max: CACHE_TTL.STATS_CARD.MAX,
|
||||
});
|
||||
|
||||
let cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.CARD_CACHE_SECONDS, 10),
|
||||
CONSTANTS.SIX_HOURS,
|
||||
CONSTANTS.ONE_DAY,
|
||||
);
|
||||
cacheSeconds = process.env.CACHE_SECONDS
|
||||
? parseInt(process.env.CACHE_SECONDS, 10) || cacheSeconds
|
||||
: cacheSeconds;
|
||||
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=${
|
||||
cacheSeconds / 2
|
||||
}, s-maxage=${cacheSeconds}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
);
|
||||
setCacheHeaders(res, cacheSeconds);
|
||||
|
||||
return res.send(
|
||||
renderStatsCard(stats, {
|
||||
@@ -102,6 +113,7 @@ export default async (req, res) => {
|
||||
card_width: parseInt(card_width, 10),
|
||||
hide_rank: parseBoolean(hide_rank),
|
||||
include_all_commits: parseBoolean(include_all_commits),
|
||||
commits_year: parseInt(commits_year, 10),
|
||||
line_height,
|
||||
title_color,
|
||||
ring_color,
|
||||
@@ -114,6 +126,7 @@ export default async (req, res) => {
|
||||
border_radius,
|
||||
border_color,
|
||||
number_format,
|
||||
number_precision: parseInt(number_precision, 10),
|
||||
locale: locale ? locale.toLowerCase() : null,
|
||||
disable_animations: parseBoolean(disable_animations),
|
||||
rank_icon,
|
||||
@@ -121,19 +134,33 @@ export default async (req, res) => {
|
||||
}),
|
||||
);
|
||||
} catch (err) {
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=${CONSTANTS.ERROR_CACHE_SECONDS / 2}, s-maxage=${
|
||||
CONSTANTS.ERROR_CACHE_SECONDS
|
||||
}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
); // Use lower cache period for errors.
|
||||
setErrorCacheHeaders(res);
|
||||
if (err instanceof Error) {
|
||||
return res.send(
|
||||
renderError({
|
||||
message: err.message,
|
||||
secondaryMessage: retrieveSecondaryMessage(err),
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
show_repo_link: !(err instanceof MissingParamError),
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
return res.send(
|
||||
renderError(err.message, err.secondaryMessage, {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
renderError({
|
||||
message: "An unknown error occurred",
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
+74
-64
@@ -1,14 +1,23 @@
|
||||
import { renderRepoCard } from "../src/cards/repo-card.js";
|
||||
import { blacklist } from "../src/common/blacklist.js";
|
||||
// @ts-check
|
||||
|
||||
import { renderRepoCard } from "../src/cards/repo.js";
|
||||
import { guardAccess } from "../src/common/access.js";
|
||||
import {
|
||||
clampValue,
|
||||
CONSTANTS,
|
||||
parseBoolean,
|
||||
renderError,
|
||||
} from "../src/common/utils.js";
|
||||
import { fetchRepo } from "../src/fetchers/repo-fetcher.js";
|
||||
CACHE_TTL,
|
||||
resolveCacheSeconds,
|
||||
setCacheHeaders,
|
||||
setErrorCacheHeaders,
|
||||
} from "../src/common/cache.js";
|
||||
import {
|
||||
MissingParamError,
|
||||
retrieveSecondaryMessage,
|
||||
} from "../src/common/error.js";
|
||||
import { parseBoolean } from "../src/common/ops.js";
|
||||
import { renderError } from "../src/common/render.js";
|
||||
import { fetchRepo } from "../src/fetchers/repo.js";
|
||||
import { isLocaleAvailable } from "../src/translations.js";
|
||||
|
||||
// @ts-ignore
|
||||
export default async (req, res) => {
|
||||
const {
|
||||
username,
|
||||
@@ -29,61 +38,48 @@ export default async (req, res) => {
|
||||
|
||||
res.setHeader("Content-Type", "image/svg+xml");
|
||||
|
||||
if (blacklist.includes(username)) {
|
||||
return res.send(
|
||||
renderError("Something went wrong", "This username is blacklisted", {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
}),
|
||||
);
|
||||
const access = guardAccess({
|
||||
res,
|
||||
id: username,
|
||||
type: "username",
|
||||
colors: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
});
|
||||
if (!access.isPassed) {
|
||||
return access.result;
|
||||
}
|
||||
|
||||
if (locale && !isLocaleAvailable(locale)) {
|
||||
return res.send(
|
||||
renderError("Something went wrong", "Language not found", {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
renderError({
|
||||
message: "Something went wrong",
|
||||
secondaryMessage: "Language not found",
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const repoData = await fetchRepo(username, repo);
|
||||
const cacheSeconds = resolveCacheSeconds({
|
||||
requested: parseInt(cache_seconds, 10),
|
||||
def: CACHE_TTL.PIN_CARD.DEFAULT,
|
||||
min: CACHE_TTL.PIN_CARD.MIN,
|
||||
max: CACHE_TTL.PIN_CARD.MAX,
|
||||
});
|
||||
|
||||
let cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.CARD_CACHE_SECONDS, 10),
|
||||
CONSTANTS.SIX_HOURS,
|
||||
CONSTANTS.ONE_DAY,
|
||||
);
|
||||
cacheSeconds = process.env.CACHE_SECONDS
|
||||
? parseInt(process.env.CACHE_SECONDS, 10) || cacheSeconds
|
||||
: cacheSeconds;
|
||||
|
||||
/*
|
||||
if star count & fork count is over 1k then we are kFormating the text
|
||||
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.starCount;
|
||||
const forks = repoData.forkCount;
|
||||
const isBothOver1K = stars > 1000 && forks > 1000;
|
||||
const isBothUnder1 = stars < 1 && forks < 1;
|
||||
if (!cache_seconds && (isBothOver1K || isBothUnder1)) {
|
||||
cacheSeconds = CONSTANTS.SIX_HOURS;
|
||||
}
|
||||
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=${
|
||||
cacheSeconds / 2
|
||||
}, s-maxage=${cacheSeconds}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
);
|
||||
setCacheHeaders(res, cacheSeconds);
|
||||
|
||||
return res.send(
|
||||
renderRepoCard(repoData, {
|
||||
@@ -101,19 +97,33 @@ export default async (req, res) => {
|
||||
}),
|
||||
);
|
||||
} catch (err) {
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=${CONSTANTS.ERROR_CACHE_SECONDS / 2}, s-maxage=${
|
||||
CONSTANTS.ERROR_CACHE_SECONDS
|
||||
}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
); // Use lower cache period for errors.
|
||||
setErrorCacheHeaders(res);
|
||||
if (err instanceof Error) {
|
||||
return res.send(
|
||||
renderError({
|
||||
message: err.message,
|
||||
secondaryMessage: retrieveSecondaryMessage(err),
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
show_repo_link: !(err instanceof MissingParamError),
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
return res.send(
|
||||
renderError(err.message, err.secondaryMessage, {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
renderError({
|
||||
message: "An unknown error occurred",
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
+11
-10
@@ -1,3 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* @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.
|
||||
@@ -5,20 +7,18 @@
|
||||
* @description This function is currently rate limited to 1 request per 5 minutes.
|
||||
*/
|
||||
|
||||
import { logger, request, dateDiff } from "../../src/common/utils.js";
|
||||
export const RATE_LIMIT_SECONDS = 60 * 5; // 1 request per 5 minutes
|
||||
import { request } from "../../src/common/http.js";
|
||||
import { logger } from "../../src/common/log.js";
|
||||
import { dateDiff } from "../../src/common/ops.js";
|
||||
|
||||
/**
|
||||
* @typedef {import('axios').AxiosRequestHeaders} AxiosRequestHeaders Axios request headers.
|
||||
* @typedef {import('axios').AxiosResponse} AxiosResponse Axios response.
|
||||
*/
|
||||
export const RATE_LIMIT_SECONDS = 60 * 5; // 1 request per 5 minutes
|
||||
|
||||
/**
|
||||
* Simple uptime check fetcher for the PATs.
|
||||
*
|
||||
* @param {AxiosRequestHeaders} variables Fetcher variables.
|
||||
* @param {any} variables Fetcher variables.
|
||||
* @param {string} token GitHub token.
|
||||
* @returns {Promise<AxiosResponse>} The response.
|
||||
* @returns {Promise<import('axios').AxiosResponse>} The response.
|
||||
*/
|
||||
const uptimeFetcher = (variables, token) => {
|
||||
return request(
|
||||
@@ -43,7 +43,7 @@ const getAllPATs = () => {
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {(variables: AxiosRequestHeaders, token: string) => Promise<AxiosResponse>} Fetcher The fetcher function.
|
||||
* @typedef {(variables: any, token: string) => Promise<import('axios').AxiosResponse>} Fetcher The fetcher function.
|
||||
* @typedef {{validPATs: string[], expiredPATs: string[], exhaustedPATs: string[], suspendedPATs: string[], errorPATs: string[], details: any}} PATInfo The PAT info.
|
||||
*/
|
||||
|
||||
@@ -51,10 +51,11 @@ const getAllPATs = () => {
|
||||
* Check whether any of the PATs is expired.
|
||||
*
|
||||
* @param {Fetcher} fetcher The fetcher function.
|
||||
* @param {AxiosRequestHeaders} variables Fetcher variables.
|
||||
* @param {any} variables Fetcher variables.
|
||||
* @returns {Promise<PATInfo>} The response.
|
||||
*/
|
||||
const getPATInfo = async (fetcher, variables) => {
|
||||
/** @type {Record<string, any>} */
|
||||
const details = {};
|
||||
const PATs = getAllPATs();
|
||||
|
||||
|
||||
+9
-8
@@ -1,3 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* @file Contains a simple cloud function that can be used to check if the PATs are still
|
||||
* functional.
|
||||
@@ -5,22 +7,18 @@
|
||||
* @description This function is currently rate limited to 1 request per 5 minutes.
|
||||
*/
|
||||
|
||||
import { request } from "../../src/common/http.js";
|
||||
import retryer from "../../src/common/retryer.js";
|
||||
import { logger, request } from "../../src/common/utils.js";
|
||||
import { logger } from "../../src/common/log.js";
|
||||
|
||||
export const RATE_LIMIT_SECONDS = 60 * 5; // 1 request per 5 minutes
|
||||
|
||||
/**
|
||||
* @typedef {import('axios').AxiosRequestHeaders} AxiosRequestHeaders Axios request headers.
|
||||
* @typedef {import('axios').AxiosResponse} AxiosResponse Axios response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Simple uptime check fetcher for the PATs.
|
||||
*
|
||||
* @param {AxiosRequestHeaders} variables Fetcher variables.
|
||||
* @param {any} variables Fetcher variables.
|
||||
* @param {string} token GitHub token.
|
||||
* @returns {Promise<AxiosResponse>} The response.
|
||||
* @returns {Promise<import('axios').AxiosResponse>} The response.
|
||||
*/
|
||||
const uptimeFetcher = (variables, token) => {
|
||||
return request(
|
||||
@@ -91,6 +89,9 @@ export default async (req, res) => {
|
||||
try {
|
||||
await retryer(uptimeFetcher, {});
|
||||
} catch (err) {
|
||||
// Resolve eslint no-unused-vars
|
||||
err;
|
||||
|
||||
PATsValid = false;
|
||||
}
|
||||
|
||||
|
||||
+110
-48
@@ -1,15 +1,23 @@
|
||||
import { renderTopLanguages } from "../src/cards/top-languages-card.js";
|
||||
import { blacklist } from "../src/common/blacklist.js";
|
||||
// @ts-check
|
||||
|
||||
import { renderTopLanguages } from "../src/cards/top-languages.js";
|
||||
import { guardAccess } from "../src/common/access.js";
|
||||
import {
|
||||
clampValue,
|
||||
CONSTANTS,
|
||||
parseArray,
|
||||
parseBoolean,
|
||||
renderError,
|
||||
} from "../src/common/utils.js";
|
||||
import { fetchTopLanguages } from "../src/fetchers/top-languages-fetcher.js";
|
||||
CACHE_TTL,
|
||||
resolveCacheSeconds,
|
||||
setCacheHeaders,
|
||||
setErrorCacheHeaders,
|
||||
} from "../src/common/cache.js";
|
||||
import {
|
||||
MissingParamError,
|
||||
retrieveSecondaryMessage,
|
||||
} from "../src/common/error.js";
|
||||
import { parseArray, parseBoolean } from "../src/common/ops.js";
|
||||
import { renderError } from "../src/common/render.js";
|
||||
import { fetchTopLanguages } from "../src/fetchers/top-languages.js";
|
||||
import { isLocaleAvailable } from "../src/translations.js";
|
||||
|
||||
// @ts-ignore
|
||||
export default async (req, res) => {
|
||||
const {
|
||||
username,
|
||||
@@ -33,23 +41,40 @@ export default async (req, res) => {
|
||||
border_color,
|
||||
disable_animations,
|
||||
hide_progress,
|
||||
stats_format,
|
||||
} = req.query;
|
||||
res.setHeader("Content-Type", "image/svg+xml");
|
||||
|
||||
if (blacklist.includes(username)) {
|
||||
return res.send(
|
||||
renderError("Something went wrong", "This username is blacklisted", {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
}),
|
||||
);
|
||||
const access = guardAccess({
|
||||
res,
|
||||
id: username,
|
||||
type: "username",
|
||||
colors: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
});
|
||||
if (!access.isPassed) {
|
||||
return access.result;
|
||||
}
|
||||
|
||||
if (locale && !isLocaleAvailable(locale)) {
|
||||
return res.send(renderError("Something went wrong", "Locale not found"));
|
||||
return res.send(
|
||||
renderError({
|
||||
message: "Something went wrong",
|
||||
secondaryMessage: "Locale not found",
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
@@ -58,7 +83,37 @@ export default async (req, res) => {
|
||||
!["compact", "normal", "donut", "donut-vertical", "pie"].includes(layout))
|
||||
) {
|
||||
return res.send(
|
||||
renderError("Something went wrong", "Incorrect layout input"),
|
||||
renderError({
|
||||
message: "Something went wrong",
|
||||
secondaryMessage: "Incorrect layout input",
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
stats_format !== undefined &&
|
||||
(typeof stats_format !== "string" ||
|
||||
!["bytes", "percentages"].includes(stats_format))
|
||||
) {
|
||||
return res.send(
|
||||
renderError({
|
||||
message: "Something went wrong",
|
||||
secondaryMessage: "Incorrect stats_format input",
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -69,22 +124,14 @@ export default async (req, res) => {
|
||||
size_weight,
|
||||
count_weight,
|
||||
);
|
||||
const cacheSeconds = resolveCacheSeconds({
|
||||
requested: parseInt(cache_seconds, 10),
|
||||
def: CACHE_TTL.TOP_LANGS_CARD.DEFAULT,
|
||||
min: CACHE_TTL.TOP_LANGS_CARD.MIN,
|
||||
max: CACHE_TTL.TOP_LANGS_CARD.MAX,
|
||||
});
|
||||
|
||||
let cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.CARD_CACHE_SECONDS, 10),
|
||||
CONSTANTS.SIX_HOURS,
|
||||
CONSTANTS.ONE_DAY,
|
||||
);
|
||||
cacheSeconds = process.env.CACHE_SECONDS
|
||||
? parseInt(process.env.CACHE_SECONDS, 10) || cacheSeconds
|
||||
: cacheSeconds;
|
||||
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=${
|
||||
cacheSeconds / 2
|
||||
}, s-maxage=${cacheSeconds}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
);
|
||||
setCacheHeaders(res, cacheSeconds);
|
||||
|
||||
return res.send(
|
||||
renderTopLanguages(topLangs, {
|
||||
@@ -104,22 +151,37 @@ export default async (req, res) => {
|
||||
locale: locale ? locale.toLowerCase() : null,
|
||||
disable_animations: parseBoolean(disable_animations),
|
||||
hide_progress: parseBoolean(hide_progress),
|
||||
stats_format,
|
||||
}),
|
||||
);
|
||||
} catch (err) {
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=${CONSTANTS.ERROR_CACHE_SECONDS / 2}, s-maxage=${
|
||||
CONSTANTS.ERROR_CACHE_SECONDS
|
||||
}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
); // Use lower cache period for errors.
|
||||
setErrorCacheHeaders(res);
|
||||
if (err instanceof Error) {
|
||||
return res.send(
|
||||
renderError({
|
||||
message: err.message,
|
||||
secondaryMessage: retrieveSecondaryMessage(err),
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
show_repo_link: !(err instanceof MissingParamError),
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
return res.send(
|
||||
renderError(err.message, err.secondaryMessage, {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
renderError({
|
||||
message: "An unknown error occurred",
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
+80
-43
@@ -1,20 +1,30 @@
|
||||
import { renderWakatimeCard } from "../src/cards/wakatime-card.js";
|
||||
import {
|
||||
clampValue,
|
||||
CONSTANTS,
|
||||
parseArray,
|
||||
parseBoolean,
|
||||
renderError,
|
||||
} from "../src/common/utils.js";
|
||||
import { fetchWakatimeStats } from "../src/fetchers/wakatime-fetcher.js";
|
||||
import { isLocaleAvailable } from "../src/translations.js";
|
||||
// @ts-check
|
||||
|
||||
import { renderWakatimeCard } from "../src/cards/wakatime.js";
|
||||
import { renderError } from "../src/common/render.js";
|
||||
import { fetchWakatimeStats } from "../src/fetchers/wakatime.js";
|
||||
import { isLocaleAvailable } from "../src/translations.js";
|
||||
import {
|
||||
CACHE_TTL,
|
||||
resolveCacheSeconds,
|
||||
setCacheHeaders,
|
||||
setErrorCacheHeaders,
|
||||
} from "../src/common/cache.js";
|
||||
import { guardAccess } from "../src/common/access.js";
|
||||
import {
|
||||
MissingParamError,
|
||||
retrieveSecondaryMessage,
|
||||
} from "../src/common/error.js";
|
||||
import { parseArray, parseBoolean } from "../src/common/ops.js";
|
||||
|
||||
// @ts-ignore
|
||||
export default async (req, res) => {
|
||||
const {
|
||||
username,
|
||||
title_color,
|
||||
icon_color,
|
||||
hide_border,
|
||||
card_width,
|
||||
line_height,
|
||||
text_color,
|
||||
bg_color,
|
||||
@@ -36,42 +46,55 @@ export default async (req, res) => {
|
||||
|
||||
res.setHeader("Content-Type", "image/svg+xml");
|
||||
|
||||
const access = guardAccess({
|
||||
res,
|
||||
id: username,
|
||||
type: "wakatime",
|
||||
colors: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
});
|
||||
if (!access.isPassed) {
|
||||
return access.result;
|
||||
}
|
||||
|
||||
if (locale && !isLocaleAvailable(locale)) {
|
||||
return res.send(
|
||||
renderError("Something went wrong", "Language not found", {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
renderError({
|
||||
message: "Something went wrong",
|
||||
secondaryMessage: "Language not found",
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
const stats = await fetchWakatimeStats({ username, api_domain });
|
||||
const cacheSeconds = resolveCacheSeconds({
|
||||
requested: parseInt(cache_seconds, 10),
|
||||
def: CACHE_TTL.WAKATIME_CARD.DEFAULT,
|
||||
min: CACHE_TTL.WAKATIME_CARD.MIN,
|
||||
max: CACHE_TTL.WAKATIME_CARD.MAX,
|
||||
});
|
||||
|
||||
let cacheSeconds = clampValue(
|
||||
parseInt(cache_seconds || CONSTANTS.CARD_CACHE_SECONDS, 10),
|
||||
CONSTANTS.SIX_HOURS,
|
||||
CONSTANTS.ONE_DAY,
|
||||
);
|
||||
cacheSeconds = process.env.CACHE_SECONDS
|
||||
? parseInt(process.env.CACHE_SECONDS, 10) || cacheSeconds
|
||||
: cacheSeconds;
|
||||
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=${
|
||||
cacheSeconds / 2
|
||||
}, s-maxage=${cacheSeconds}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
);
|
||||
setCacheHeaders(res, cacheSeconds);
|
||||
|
||||
return res.send(
|
||||
renderWakatimeCard(stats, {
|
||||
custom_title,
|
||||
hide_title: parseBoolean(hide_title),
|
||||
hide_border: parseBoolean(hide_border),
|
||||
card_width: parseInt(card_width, 10),
|
||||
hide: parseArray(hide),
|
||||
line_height,
|
||||
title_color,
|
||||
@@ -90,19 +113,33 @@ export default async (req, res) => {
|
||||
}),
|
||||
);
|
||||
} catch (err) {
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=${CONSTANTS.ERROR_CACHE_SECONDS / 2}, s-maxage=${
|
||||
CONSTANTS.ERROR_CACHE_SECONDS
|
||||
}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
); // Use lower cache period for errors.
|
||||
setErrorCacheHeaders(res);
|
||||
if (err instanceof Error) {
|
||||
return res.send(
|
||||
renderError({
|
||||
message: err.message,
|
||||
secondaryMessage: retrieveSecondaryMessage(err),
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
show_repo_link: !(err instanceof MissingParamError),
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
return res.send(
|
||||
renderError(err.message, err.secondaryMessage, {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
renderError({
|
||||
message: "An unknown error occurred",
|
||||
renderOptions: {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme,
|
||||
},
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[Caddyfile]
|
||||
indent_style = tab
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
readme-stats.example.com {
|
||||
## optional, force all requests to return your github stats
|
||||
#uri query username ${github_username:anuraghazra}
|
||||
reverse_proxy readme_stats:${port:9000}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
FROM node:lts-alpine
|
||||
|
||||
# environment variables
|
||||
ENV port=9000
|
||||
ENV github_username=anuraghazra
|
||||
|
||||
# setup folder within the docker container with this app's files
|
||||
WORKDIR /app
|
||||
COPY ./api /app/api
|
||||
COPY ./scripts /app/scripts
|
||||
COPY ./src /app/src
|
||||
COPY ./themes /app/themes
|
||||
COPY ./express.js /app/express.js
|
||||
COPY ./package.json /app/package.json
|
||||
COPY ./package-lock.json /app/package-lock.json
|
||||
|
||||
# prepare script uses a dev-dependency, so remove it,
|
||||
# move express from dev-dependency to regular dependency
|
||||
# then finally install all non-dev dependencies
|
||||
RUN npm pkg delete scripts.prepare \
|
||||
&& npm pkg set dependencies.express="$(node -p "require('./package.json').devDependencies.express")" \
|
||||
&& npm pkg delete devDependencies.express \
|
||||
&& npm ci --omit=dev
|
||||
|
||||
# healthcheck
|
||||
HEALTHCHECK --interval=60m \
|
||||
--retries=3 \
|
||||
--start-interval=1s \
|
||||
--start-period=10s \
|
||||
--timeout=5s \
|
||||
CMD wget --no-verbose -O - --tries=1 "http://127.0.0.1:$port/api/?username=$github_username" | grep 'GitHub Stats' || exit 1
|
||||
|
||||
# start the app, on the supplied port
|
||||
EXPOSE $port
|
||||
CMD [ "node", "express.js" ]
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
services:
|
||||
readme_stats:
|
||||
container_name: readme_stats
|
||||
env_file:
|
||||
- .env
|
||||
expose:
|
||||
- $port
|
||||
init: true
|
||||
image: digitaladapt/github-readme-stats:latest
|
||||
restart: unless-stopped
|
||||
|
||||
caddy:
|
||||
## optional, make caddy wait until the service is ready
|
||||
#depends_on:
|
||||
# readme_stats:
|
||||
# condition: service_healthy
|
||||
## optional, make variables in .env file available to use in your Caddyfile
|
||||
#env_file:
|
||||
# - .env
|
||||
image: caddy:lates
|
||||
restart: unless-stopped
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
- "443:443/udp"
|
||||
volumes:
|
||||
- ./Caddyfile:/etc/caddy/Caddyfile:ro
|
||||
|
||||
@@ -0,0 +1,32 @@
|
||||
Get dynamically generated GitHub stats on your READMEs, with the ease of docker!
|
||||
|
||||
Fork of [https://github.com/anuraghazra/github-readme-stats](https://github.com/anuraghazra/github-readme-stats), gently wrapped in docker.
|
||||
|
||||
Now as an image on Docker Hub.
|
||||
|
||||
**Steps to setup:**
|
||||
* add the readme_stats service to your existing docker-compose.yml.
|
||||
* configure your .env to have `PAT_1=<YOUR_GITHUB_TOKEN>`.
|
||||
* optionally configure `port`, and `github_username`
|
||||
* update your existing Caddyfile.
|
||||
* and start with `docker compose up -d`.
|
||||
|
||||
docker-compose.yml.example, Caddyfile.example, and env.example have a very simple working example using Caddy reverse proxy.
|
||||
|
||||
Files have example in their name, so that when you update, your local settings won't be overridden.
|
||||
|
||||
```
|
||||
git clone https://code.digitaladapt.com/andrew/github-readme-stats.git
|
||||
cd github-readme-stats
|
||||
cp docker-compose.yml.example docker-compose.yml
|
||||
cp env.example .env
|
||||
vim .env
|
||||
# add your github token
|
||||
|
||||
cp Caddyfile.example Caddyfile
|
||||
vim Caddyfile
|
||||
# configure your domain
|
||||
|
||||
docker compose up -d
|
||||
```
|
||||
|
||||
@@ -1,365 +0,0 @@
|
||||
<p align="center">
|
||||
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
|
||||
<h2 align="center">GitHub Readme Stats</h2>
|
||||
<p align="center">在你的 README 中获取动态生成的 GitHub 统计信息!</p>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#全部-demos">查看 Demo</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">报告 Bug</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">请求增加功能</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="/docs/readme_fr.md">Français</a>
|
||||
·
|
||||
<a href="/docs/readme_cn.md">简体中文</a>
|
||||
·
|
||||
<a href="/docs/readme_es.md">Español</a>
|
||||
·
|
||||
<a href="/docs/readme_de.md">Deutsch</a>
|
||||
·
|
||||
<a href="/docs/readme_ja.md">日本語</a>
|
||||
·
|
||||
<a href="/docs/readme_pt-BR.md">Português Brasileiro</a>
|
||||
·
|
||||
<a href="/docs/readme_it.md">Italiano</a>
|
||||
·
|
||||
<a href="/docs/readme_kr.md">한국어</a>
|
||||
.
|
||||
<a href="/docs/readme_nl.md">Nederlands</a>
|
||||
.
|
||||
<a href="/docs/readme_np.md">नेपाली</a>
|
||||
.
|
||||
<a href="/docs/readme_tr.md">Türkçe</a>
|
||||
</p>
|
||||
</p>
|
||||
<p align="center">喜欢这个项目?请考虑<a href="https://www.paypal.me/anuraghazra">捐赠</a>来帮助它完善!
|
||||
|
||||
# 特性 <!-- omit in toc -->
|
||||
|
||||
- [GitHub 统计卡片](#github-统计卡片)
|
||||
- [隐藏指定统计](#隐藏指定统计)
|
||||
- [将私人项目贡献添加到总提交计数中](#将私人项目贡献添加到总提交计数中)
|
||||
- [显示图标](#显示图标)
|
||||
- [主题](#主题)
|
||||
- [自定义](#自定义)
|
||||
- [GitHub 更多置顶](#github-更多置顶)
|
||||
- [使用细则](#使用细则)
|
||||
- [Demo](#demo)
|
||||
- [热门语言卡片](#热门语言卡片)
|
||||
- [使用细则](#使用细则-1)
|
||||
- [隐藏指定语言](#隐藏指定语言)
|
||||
- [紧凑的语言卡片布局](#紧凑的语言卡片布局)
|
||||
- [Demo](#demo-1)
|
||||
- [全部 Demos](#全部-demos)
|
||||
- [快速提示 (对齐 Repo 卡片)](#快速提示-对齐-repo-卡片)
|
||||
- [自己部署](#自己部署)
|
||||
- [:sparkling\_heart: 支持这个项目](#sparkling_heart-支持这个项目)
|
||||
|
||||
# GitHub 统计卡片
|
||||
|
||||
将这行代码复制到你的 markdown 文件中,就是如此简单!
|
||||
|
||||
更改 `?username=` 的值为你的 GitHub 用户名。
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
_注: 等级基于用户的统计信息计算得出,详见 [src/calculateRank.js](../src/calculateRank.js)_
|
||||
|
||||
### 隐藏指定统计
|
||||
|
||||
想要隐藏指定统计信息,你可以调用参数 `?hide=`,其值用 `,` 分隔。
|
||||
|
||||
> 选项:`&hide=stars,commits,prs,issues,contribs`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### 将私人项目贡献添加到总提交计数中
|
||||
|
||||
你可以使用参数 `?count_private=true` 把私人贡献计数添加到总提交计数中。
|
||||
|
||||
_注:如果你是自己部署本项目,私人贡献将会默认被计数,如果不是自己部署,你需要分享你的私人贡献计数。_
|
||||
|
||||
> 选项: `&count_private=true`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### 显示图标
|
||||
|
||||
如果想要显示图标,你可以调用 `show_icons=true` 参数,像这样:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### 主题
|
||||
|
||||
你可以通过现有的主题进行卡片个性化,省去[手动自定义](#自定义)的麻烦。
|
||||
|
||||
通过调用 `?theme=THEME_NAME` 参数,像这样:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
#### 所有现有主题
|
||||
|
||||
dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula
|
||||
|
||||
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Stat Themes" width="600px"/>
|
||||
|
||||
你可以预览[所有可用主题](../themes/README.md)或者签出[主题配置文件](../themes/index.js), 而且如果你喜欢, **你也可以贡献新的主题** :D
|
||||
|
||||
### 自定义
|
||||
|
||||
你可以通过使用 URL 参数的方式,为你的 `Stats Card` 或 `Repo Card` 自定义样式。
|
||||
|
||||
常用选项:
|
||||
|
||||
- `title_color` - 卡片标题颜色 _(十六进制色码)_
|
||||
- `text_color` - 内容文本颜色 _(十六进制色码)_
|
||||
- `icon_color` - 图标颜色(如果可用)_(十六进制色码)_
|
||||
- `bg_color` - 卡片背景颜色 _(十六进制色码)_ **或者** 以 _angle,start,end_ 的形式渐变
|
||||
- `hide_border` - 隐藏卡的边框 _(布尔值)_
|
||||
- `theme` - 主题名称,从[所有可用主题](../themes/README.md)中选择
|
||||
- `cache_seconds` - 手动设置缓存头 _(最小值: 14400,最大值: 86400)_
|
||||
- `locale` - 在卡片中设置语言 _(例如 cn, de, es, 等等)_
|
||||
|
||||
##### bg_color 渐变
|
||||
|
||||
你可以在 bg_color 选项中提供多个逗号分隔的值来呈现渐变,渐变的格式是 :-
|
||||
|
||||
```
|
||||
&bg_color=DEG,COLOR1,COLOR2,COLOR3...COLOR10
|
||||
```
|
||||
|
||||
> 缓存的注意事项: 如果 fork 数和 star 数 少于 1k , Repo 卡片默认缓存是 4 小时 (14400 秒) ,否则是 2 小时(7200)。另请注意缓存被限制为最短 2 小时,最长 24 小时。
|
||||
|
||||
#### 统计卡片专属选项:
|
||||
|
||||
- `hide` - 隐藏特定统计信息 _(以逗号分隔)_
|
||||
- `hide_title` - _(boolean)_
|
||||
- `hide_rank` - _(boolean)_
|
||||
- `show_icons` - _(boolean)_
|
||||
- `include_all_commits` - 统计总提交次数而不是仅统计今年的提交次数 _(boolean)_
|
||||
- `count_private` - 统计私人提交 _(boolean)_
|
||||
- `line_height` - 设置文本之间的行高 _(number)_
|
||||
|
||||
#### Repo 卡片专属选项:
|
||||
|
||||
- `show_owner` - 显示 Repo 的所有者名字 _(boolean)_
|
||||
|
||||
#### 语言卡片专属选项:
|
||||
|
||||
- `hide` - 从卡片中隐藏指定语言 _(Comma seperated values)_
|
||||
- `hide_title` - _(boolean)_
|
||||
- `layout` - 提供五种布局 `normal` & `compact` & `donut` & `donut-vertical` & `pie` 间切换
|
||||
- `card_width` - 手动设置卡片的宽度 _(number)_
|
||||
|
||||
> :warning: **重要:**
|
||||
> 如 [Percent Encoding](https://en.wikipedia.org/wiki/Percent-encoding) 所指定,语言名称应使用 uri 转义。
|
||||
> (例: `c++` 应该是 `c%2B%2B`, `jupyter notebook` 应该是 `jupyter%20notebook`, 等.)
|
||||
|
||||
---
|
||||
|
||||
# GitHub 更多置顶
|
||||
|
||||
GitHub 更多置顶 允许你在使用 GitHub readme profile 时,在个人资料中置顶多于 6 个 repo 。
|
||||
|
||||
是的!你不再受限于置顶最多 6 个存储库了。
|
||||
|
||||
### 使用细则
|
||||
|
||||
复制粘贴这段代码到你的 README 文件中,并更改链接。
|
||||
|
||||
端点: `api/pin?username=anuraghazra&repo=github-readme-stats`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
使用 [show_owner](#自定义) 变量将 Repo 所有者的用户名包含在内。
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# 热门语言卡片
|
||||
|
||||
热门语言卡片显示了 GitHub 用户常用的编程语言。
|
||||
|
||||
_注意:热门语言并不表示我的技能水平或类似的水平,它是用来衡量用户在 github 上拥有最多代码的语言的一项指标,它是 github-readme-stats 的新特性_
|
||||
|
||||
### 使用细则
|
||||
|
||||
将此代码复制粘贴到您的 `README.md` 文件中,并修改链接。
|
||||
|
||||
端点: `api/top-langs?username=anuraghazra`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### 隐藏指定语言
|
||||
|
||||
可以使用 `?hide=language1,language2` 参数来隐藏指定的语言。
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### 紧凑的语言卡片布局
|
||||
|
||||
你可以使用 `&layout=compact` 参数来改变卡片的样式。
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- 紧凑布局
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### 全部 Demos
|
||||
|
||||
- 默认
|
||||
|
||||

|
||||
|
||||
- 隐藏指定统计
|
||||
|
||||

|
||||
|
||||
- 显示图标
|
||||
|
||||

|
||||
|
||||
- 包含全部提交
|
||||
|
||||

|
||||
|
||||
- 主题
|
||||
|
||||
从[默认主题](#主题)中进行选择
|
||||
|
||||

|
||||
|
||||
- 渐变
|
||||
|
||||

|
||||
|
||||
- 自定义统计卡片
|
||||
|
||||

|
||||
|
||||
- 自定义 repo 卡片
|
||||
|
||||

|
||||
|
||||
- 热门语言
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### 快速提示 (对齐 Repo 卡片)
|
||||
|
||||
你通常无法将图片靠边显示。为此,您可以使用以下方法:
|
||||
|
||||
```html
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=convoychat" />
|
||||
</a>
|
||||
```
|
||||
|
||||
## 自己部署
|
||||
|
||||
#### [查看分步视频教程 作者:@codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
因为 GitHub 的 API 每个小时只允许 5 千次请求,我的 `https://github-readme-stats.vercel.app/api` 很有可能会触发限制。如果你将其托管在自己的 Vercel 服务器上,那么你就不必为此担心。点击 deploy 按钮来开始你的部署!
|
||||
|
||||
注意: 从 [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) 开始,我们应该能够处理超过 5 千次的请求,并且不会出现宕机问题 :D
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
<details>
|
||||
<summary>设置 Vercel 的指导</summary>
|
||||
|
||||
1. 前往 [vercel.com](https://vercel.com/)
|
||||
1. 点击 `Log in`
|
||||

|
||||
1. 点击 `Continue with GitHub` 通过 GitHub 进行登录
|
||||

|
||||
1. 登录 GitHub 并允许访问所有存储库(如果系统这样提示)
|
||||
1. Fork 这个仓库
|
||||
1. 返回到你的 [Vercel dashboard](https://vercel.com/dashboard)
|
||||
1. 选择 `Import Project`
|
||||

|
||||
1. 选择 `Import Git Repository`
|
||||

|
||||
1. 选择 root 并将所有内容保持不变,并且只需添加名为 PAT_1 的环境变量(如图所示),其中将包含一个个人访问令牌(PAT),你可以在[这里](https://github.com/settings/tokens/new)轻松创建(保留默认,并且只需要命名下,名字随便)
|
||||

|
||||
1. 点击 deploy,这就完成了,查看你的域名就可使用 API 了!
|
||||
|
||||
</details>
|
||||
|
||||
## :sparkling_heart: 支持这个项目
|
||||
|
||||
我尽己所能地进行开源,并且我尽量回复每个在使用项目时需要帮助的人。很明显,这需要时间,但你可以免费享受这些。
|
||||
|
||||
然而, 如果你正在使用这个项目并感觉良好,或只是想要支持我继续开发,你可以通过如下方式:
|
||||
|
||||
- 在你的 readme 中使用 github-readme-stats 时,链接指向这里 :D
|
||||
- Star 并 分享这个项目 :rocket:
|
||||
- [](https://www.paypal.me/anuraghazra) - 你可以通过 PayPal 一次性捐款. 我多半会买一杯 ~~咖啡~~ 茶. :tea:
|
||||
|
||||
谢谢! :heart:
|
||||
|
||||
---
|
||||
|
||||
[](https://vercel.com?utm_source=github_readme_stats_team&utm_campaign=oss)
|
||||
|
||||
欢迎贡献! <3
|
||||
|
||||
用 :heart: 发电,用 JavaScript 制作。
|
||||
@@ -1,388 +0,0 @@
|
||||
<p align="center">
|
||||
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
|
||||
<h2 align="center">GitHub Readme Statistiken</h2>
|
||||
<p align="center">Zeige dynamisch generierte GitHub-Statistiken in deinen Readmes!</p>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#alle-beispiele">Beispiele ansehen</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">Fehler melden</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">Funktion wünschen</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="/docs/readme_fr.md">Français</a>
|
||||
·
|
||||
<a href="/docs/readme_cn.md">简体中文</a>
|
||||
·
|
||||
<a href="/docs/readme_es.md">Español</a>
|
||||
·
|
||||
<a href="/docs/readme_de.md">Deutsch</a>
|
||||
·
|
||||
<a href="/docs/readme_ja.md">日本語</a>
|
||||
·
|
||||
<a href="/docs/readme_pt-BR.md">Português Brasileiro</a>
|
||||
·
|
||||
<a href="/docs/readme_it.md">Italiano</a>
|
||||
·
|
||||
<a href="/docs/readme_kr.md">한국어</a>
|
||||
.
|
||||
<a href="/docs/readme_nl.md">Nederlands</a>
|
||||
.
|
||||
<a href="/docs/readme_np.md">नेपाली</a>
|
||||
.
|
||||
<a href="/docs/readme_tr.md">Türkçe</a>
|
||||
</p>
|
||||
</p>
|
||||
<p align="center">Du magst das Projekt? Wie wäre es mit einer kleinen <a href="https://www.paypal.me/anuraghazra">Spende</a> um es weiterhin am Leben zu erhalten?
|
||||
|
||||
# Funktionen <!-- omit in toc -->
|
||||
|
||||
- [GitHub Statistiken-Karte](#github-statistiken-karte)
|
||||
- [Verbergen individueller Statistiken](#verbergen-individueller-statistiken)
|
||||
- [Symbole anzeigen](#symbole-anzeigen)
|
||||
- [Erscheinungsbild/Themes](#erscheinungsbildthemes)
|
||||
- [Anpassungen/Personalisierung](#anpassungenpersonalisierung)
|
||||
- [GitHub Extra-Pins](#github-extra-pins)
|
||||
- [Benutzung](#benutzung)
|
||||
- [Beispiele](#beispiele)
|
||||
- [Top Programmiersprachen-Karte](#top-programmiersprachen-karte)
|
||||
- [Benutzung](#benutzung-1)
|
||||
- [Verbirg einzelne Sprachen](#verbirg-einzelne-sprachen)
|
||||
- [Kompaktes Sprachen-Karte Layout](#kompaktes-sprachen-karte-layout)
|
||||
- [Beispiel](#beispiel)
|
||||
- [WakaTime Wochen-Statistik](#wakatime-wochen-statistik)
|
||||
- [Beispiel](#beispiel-1)
|
||||
- [Alle Beispiele](#alle-beispiele)
|
||||
- [Kleiner Tipp (Ausrichten der Repo-Karte)](#kleiner-tipp-ausrichten-der-repo-karte)
|
||||
- [Betreibe es auf deiner eigenen Vercel-Instanz](#betreibe-es-auf-deiner-eigenen-vercel-instanz)
|
||||
- [:sparkling\_heart: Unterstütze das Projekt](#sparkling_heart-unterstütze-das-projekt)
|
||||
|
||||
# GitHub Statistiken-Karte
|
||||
|
||||
Kopiere folgendes in deine Readme um die Statistiken zu benutzen.
|
||||
Passe den Wert des URL-Parameters `?username=` so an, dass dort dein GitHub-Nutzername steht.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
_Hinweis: Die Berechnung des Ranges basiert auf den jeweiligen Benutzerstatistiken, siehe [src/calculateRank.js](../src/calculateRank.js)_
|
||||
|
||||
### Verbergen individueller Statistiken
|
||||
|
||||
Um eine spezifische Statistik auszublenden, kann dem Query-Parameter `?hide=` ein Array an Optionen, die nicht angezeigt werden sollen, übergeben werden.
|
||||
|
||||
> Optionen: `&hide=stars,commits,prs,issues,contribs`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Symbole anzeigen
|
||||
|
||||
Um Symbole anzuzeigen kann der URL-Parameter `show_icons=true` wie folgt verwendet werden:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Erscheinungsbild/Themes
|
||||
|
||||
Mithilfe der eingebauten Themes kann das Aussehen der Karten verändern werden, ohne manuelle Anpassungen vornehmen zu müssen.
|
||||
|
||||
Benutze den `?theme=THEME_NAME`-Parameter wie folgt :-
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
#### Alle eingebauten Themes :-
|
||||
|
||||
dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula
|
||||
|
||||
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Stat Themes" width="600px"/>
|
||||
|
||||
Du kannst dir eine Vorschau [aller verfügbaren Themes](../themes/README.md) ansehen oder die [theme config Datei](../themes/index.js) ansehen.
|
||||
Außerdem **kannst du neue Themes erstellen**, Beiträge an diesem Projekt sind gerne gesehen! :D
|
||||
|
||||
### Anpassungen/Personalisierung
|
||||
|
||||
Du kannst das Erscheinungsbild deiner `Stats Card` oder `Repo Card`, mithilfe von URL-Parametern, nach deinen Vorlieben anpassen.
|
||||
|
||||
#### Verbreitete Optionen:
|
||||
|
||||
- `title_color` - Titelfarbe _(hex color)_
|
||||
- `text_color` - Textkörperfarbe _(hex color)_
|
||||
- `icon_color` - Symbolfarbe (falls verfügbar) _(hex color)_
|
||||
- `bg_color` - Hintergrundfarbe _(hex color)_ **oder** ein Farbverlauf in der Form von _winkel,start,ende_
|
||||
- `hide_border` - Blendet den Rand der Karte aus _(Boolean)_
|
||||
- `theme` - Name des Erscheinungsbildes/Themes [alle verfügbaren Themes](../themes/README.md)
|
||||
- `cache_seconds` - manuelles festlegen der Cachezeiten _(min: 14400, max: 86400)_
|
||||
- `locale` - Stellen Sie die Sprache auf der Karte ein _(z.B. cn, de, es, etc.)_
|
||||
|
||||
##### Farbverlauf in bg_color
|
||||
|
||||
Du kannst mehrere, mit Kommas separierte, Werte in der bg_color Option angeben, um einen Farbverlauf anzuzeigen. Das Format ist:-
|
||||
|
||||
```
|
||||
&bg_color=WINKEL,FARBE1,FARBE2,FARBE3...FARBE10
|
||||
```
|
||||
|
||||
> Hinweis bzgl. des Caches: Wenn die Anzahl der Forks und Stars geringer als 1 Tsd. ist, haben die Repo-Cards eine Standard-Cachezeit von 30 Minuten (1800 Sekunden), ansonsten beträgt diese 2 Stunden (7200 Sekunden). Außerdem ist der Cache auf ein Minimum von 30 Minuten und ein Maximum von 24 Stunden begrenzt.
|
||||
|
||||
#### Exklusive Optionen der Statistiken-Karte:
|
||||
|
||||
- `hide` - Verbirgt die [angegeben Elemente](#verbergen-individueller-statistiken) _(mit Komma abgegrenzte Werte)_
|
||||
- `hide_title` - _(Boolean)_
|
||||
- `hide_rank` - _(Boolean)_
|
||||
- `show_icons` - _(Boolean)_
|
||||
- `include_all_commits` - Zähle alle Beiträge anstatt nur das aktuelle Jahr _(Boolean)_
|
||||
- `count_private` - Zähle private Beiträge _(Boolean)_
|
||||
- `line_height` - Legt die Zeilenhöhe zwischen Text fest _(Zahl)_
|
||||
|
||||
#### Exklusive Optionen der Repo-Karte:
|
||||
|
||||
- `show_owner` - Zeigt den Besitzer des Repos _(Boolean)_
|
||||
|
||||
#### Exklusive Optionen der Sprachen-Karte:
|
||||
|
||||
- `hide` - Verbirgt die angegebenen Sprachen von der Karte _(Komma separierte Werte)_
|
||||
- `hide_title` - _(Boolean)_
|
||||
- `layout` - Wechseln Sie zwischen den fünf verfügbaren Layouts `normal` & `compact` & `donut` & `donut-vertical` & `pie`
|
||||
- `card_width` - Lege die Breite der Karte manuell fest _(Zahl)_
|
||||
|
||||
> :warning: **Wichtig:**
|
||||
> Sprachennamen sollten uri-escaped sein, wie hier angegeben: [Percent Encoding](https://en.wikipedia.org/wiki/Percent-encoding)
|
||||
> (z.B.: `c++` sollte zu `c%2B%2B` werden, `jupyter notebook` sollte zu `jupyter%20notebook` werden, usw.)
|
||||
|
||||
#### Exklusive Optionen der WakaTime-Karte:
|
||||
|
||||
- `hide_title` - _(Boolean)_
|
||||
- `line_height` - Legt die Zeilenhöhe des Texts fest _(Zahl)_
|
||||
- `hide_progress` - Verbirgt die Fortschrittsanzeige und Prozentzahl _(Boolean)_
|
||||
- `custom_title` - Legt einen benutzerdefinierten Titel fest
|
||||
- `layout` - Wechselt zwischen zwei verschiedenen Layouts: `default` & `compact`
|
||||
- `langs_count` - Begrenzt die Anzahl der angezeigten Sprachen auf der Karte
|
||||
- `api_domain` - Legt eine benutzerdefinierte API Domain fest, z.B. für [Hakatime](https://github.com/mujx/hakatime) oder [Wakapi](https://github.com/muety/wakapi)
|
||||
- `range` – Fragt eine andere Zeitspanne an, als jene, welche standardmäßig in WakaTime hinterlegt ist. Zum Beispiel `last_7_days`. Siehe [WakaTime API Dokumentation](https://wakatime.com/developers#stats).
|
||||
|
||||
---
|
||||
|
||||
# GitHub Extra-Pins
|
||||
|
||||
GitHub Extra-Pins ermöglicht es mit Hilfe einer Readme auf deinem Profil mehr als 6 Repositories anzuzeigen.
|
||||
|
||||
Und Bääm! Du bist nicht mehr auf 6 angeheftete Repositories limitiert.
|
||||
|
||||
### Benutzung
|
||||
|
||||
Füge diesen Code in deine Readme-Datei ein und passe die Links an.
|
||||
Passe den Wert des URL-Parameters `?username=` so an, dass dort dein GitHub-Nutzername steht.
|
||||
Den Wert des URL-Parameters `?repo=` musst du so anpassen, dass dort der Namen deines Repositorys steht.
|
||||
|
||||
Endpunkt: `api/pin?username=anuraghazra&repo=github-readme-stats`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Beispiele
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
Benutze die [show_owner](#anpassungenpersonalisierung) Variable, um den Nutzernamen des Repository-Eigentümers anzuzeigen.
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# Top Programmiersprachen-Karte
|
||||
|
||||
Die Top Programmiersprachen-Karte visualisiert die am meisten benutzten Programmiersprachen eines GitHub-Nutzers.
|
||||
|
||||
_HINWEIS: Die Top Programmiersprachen treffen keine Aussage über persönliche Fähigkeiten oder dergleichen, es ist lediglich eine auf den GitHub-Statistiken des Nutzers basierende Kennzahl, welche Programmiersprache wie häufig verwendet wurde._
|
||||
|
||||
### Benutzung
|
||||
|
||||
Füge diesen Code in deine Readme-Datei ein und passe die Links an.
|
||||
Passe den Wert des URL-Parameters `?username=` so an, dass dort dein GitHub-Nutzername steht.
|
||||
|
||||
Endpunkt: `api/top-langs?username=anuraghazra`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Verbirg einzelne Sprachen
|
||||
|
||||
Du kannst den `?hide=language1,language2` URL-Parameter benutzen, um einzelne Sprachen auszublenden.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Kompaktes Sprachen-Karte Layout
|
||||
|
||||
Du kannst die `&layout=compact` Option nutzen, um das Kartendesign zu ändern.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Beispiel
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Kompaktes Layout
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# WakaTime Wochen-Statistik
|
||||
|
||||
Ändere `?username=` in den eigenen [WakaTime](https://wakatime.com)-Benutzernamen.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Beispiel
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Kompaktes Layout
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Alle Beispiele
|
||||
|
||||
- Default
|
||||
|
||||

|
||||
|
||||
- Ausblenden bestimmter Statistiken
|
||||
|
||||

|
||||
|
||||
- Symbole anzeigen
|
||||
|
||||

|
||||
|
||||
- Alle Beiträge anzeigen
|
||||
|
||||

|
||||
|
||||
- Erscheinungsbild/Themes
|
||||
|
||||
Wähle Eines von den [Standard-Themes](#themes)
|
||||
|
||||

|
||||
|
||||
- Farbverlauf
|
||||
|
||||

|
||||
|
||||
- Statistiken-Karte anpassen
|
||||
|
||||

|
||||
|
||||
- Repo-Karte(Extra-Pin) anpassen
|
||||
|
||||

|
||||
|
||||
- Top Programmiersprachen
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Kleiner Tipp (Ausrichten der Repo-Karte)
|
||||
|
||||
Üblicherweise ist es in `.md`-Dateien nicht möglich Bilder nebeneinander anzuzeigen. Um dies zu ermöglichen, kannst du folgendes tun:
|
||||
|
||||
```html
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=convoychat" />
|
||||
</a>
|
||||
```
|
||||
|
||||
## Betreibe es auf deiner eigenen Vercel-Instanz
|
||||
|
||||
#### [Schritt für Schritt YouTube Tutorial by @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
Da die GitHub API nur 5 Tsd. Aufrufe pro Stunde zulässt, kann es passieren, dass meine `https://github-readme-stats.vercel.app/api` dieses Limit erreicht.
|
||||
Wenn du es auf deinem eigenen Vercel-Server hostest, brauchst du dich darum nicht zu kümmern. Klicke auf den Deploy-Knopf um loszulegen!
|
||||
|
||||
Hinweis: Seit [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) sollte es möglich sein, mehr als 5 Tsd Aufrufe pro Stunde ohne Downtimes zu verkraften :D
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
<details>
|
||||
<summary><b>Anleitung zum Einrichten von Vercel 🔨 </b></summary>
|
||||
|
||||
1. Gehe zu [vercel.com](https://vercel.com/)
|
||||
1. Klicke auf `Log in`
|
||||

|
||||
1. Melde dich mit deinem GitHub-account an, indem du `Continue with GitHub` klickst
|
||||

|
||||
1. Verbinde dich mit GitHub und erlaube den Zugriff auf alle Repositories (falls gefordert)
|
||||
1. Forke dieses Repository
|
||||
1. Gehe zurück zu deinem [Vercel Dashboard](https://vercel.com/dashboard)
|
||||
1. Klick `Import Project`
|
||||

|
||||
1. Klick `Import Git Repository`
|
||||

|
||||
1. Wähle root und füge eine Umgebungsvariable namens PAT_1 (siehe Abbildung) die als Wert deinen persönlichen Access Token (PAT) hat hinzu, den du einfach [hier](https://github.com/settings/tokens/new) erzeugen kannst (lasse alles wie es ist, vergebe einen beliebigen Namen)
|
||||

|
||||
1. Klicke auf `Deploy`, und das wars. Besuche deine Domains um die API zu benutzen!
|
||||
</details>
|
||||
|
||||
## :sparkling_heart: Unterstütze das Projekt
|
||||
|
||||
Ich versuche alles was ich kann als Open-Source zur Verfügung zu stellen, als auch jedem der Hilfe bei der Benutzung dieses Projektes braucht zu antworten. Natürlich beansprucht sowas Zeit und du kannst diesen Dienst kostenlos benutzen.
|
||||
|
||||
Wenn du dieses Projekt nutzt und zufrieden bist, kannst du dennoch Dinge tun um mich weiterhin zu motivieren am Projekt zu arbeiten:
|
||||
|
||||
- Erwähne und verlinke das Projekt in deiner Readme wenn du es benutzt :D
|
||||
- Geb dem Projekt einen Stern hier auf GitHub und teile es :rocket:
|
||||
- [](https://www.paypal.me/anuraghazra) - Du kannst einmalige Spenden via PayPal tätigen. Ich kaufe mir wahrscheinlich einen ~~Kaffee~~ Tee davon. :tea:
|
||||
|
||||
Vielen Dank! :heart:
|
||||
|
||||
---
|
||||
|
||||
[](https://vercel.com?utm_source=github_readme_stats_team&utm_campaign=oss)
|
||||
|
||||
|
||||
Mitarbeit an dem Projekt ist immer Willkommen! <3
|
||||
|
||||
Gemacht mit viel :heart: und JavaScript.
|
||||
@@ -1,427 +0,0 @@
|
||||
<p align="center">
|
||||
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
|
||||
<h2 align="center">GitHub Readme Stats</h2>
|
||||
<p align="center">¡Obtén tus estadísticas de GitHub generadas dinámicamente en tu README!</p>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#todos-los-ejemplos">Ver un ejemplo</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">Reportar un bug</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">Solicitar una mejora</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="/docs/readme_fr.md">Français</a>
|
||||
·
|
||||
<a href="/docs/readme_cn.md">简体中文</a>
|
||||
·
|
||||
<a href="/docs/readme_es.md">Español</a>
|
||||
·
|
||||
<a href="/docs/readme_de.md">Deutsch</a>
|
||||
·
|
||||
<a href="/docs/readme_ja.md">日本語</a>
|
||||
·
|
||||
<a href="/docs/readme_pt-BR.md">Português Brasileiro</a>
|
||||
·
|
||||
<a href="/docs/readme_it.md">Italiano</a>
|
||||
·
|
||||
<a href="/docs/readme_kr.md">한국어</a>
|
||||
.
|
||||
<a href="/docs/readme_nl.md">Nederlands</a>
|
||||
.
|
||||
<a href="/docs/readme_tr.md">Türkçe</a>
|
||||
.
|
||||
<a href="/docs/readme_np.md">नेपाली</a>
|
||||
</p>
|
||||
</p>
|
||||
<p align="center">¿Te gusta este proyecto? ¡Por favor, considera <a href="https://www.paypal.me/anuraghazra">donar</a> para ayudar a mejorarlo!
|
||||
|
||||
# Características <!-- omit in toc -->
|
||||
|
||||
- [Tarjeta de estadísticas de GitHub](#tarjeta-de-estadísticas-de-github)
|
||||
- [Ocultar estadísticas individualmente](#ocultar-estadísticas-individualmente)
|
||||
- [Agregar contribuciones privadas al total de commits contados](#agregar-contribuciones-privadas-al-total-de-commits-contados)
|
||||
- [Mostrar íconos](#mostrar-íconos)
|
||||
- [Temas](#temas)
|
||||
- [Personalización](#personalización)
|
||||
- [Pines adicionales de GitHub](#pines-adicionales-de-github)
|
||||
- [Utilización](#utilización)
|
||||
- [Ejemplo](#ejemplo)
|
||||
- [Tarjeta de Lenguajes Principales](#tarjeta-de-lenguajes-principales)
|
||||
- [Utilización](#utilización-1)
|
||||
- [Excluir repositorios individualmente](#excluir-repositorios-individualmente)
|
||||
- [Ocultar lenguajes individualmente](#ocultar-lenguajes-individualmente)
|
||||
- [Mostrar más lenguajes](#mostrar-más-lenguajes)
|
||||
- [Diseño Compacto de Tarjeta de Lenguaje](#diseño-compacto-de-tarjeta-de-lenguaje)
|
||||
- [Ejemplo](#ejemplo-1)
|
||||
- [Estadísticas de la semana de WakaTime](#estadísticas-de-la-semana-de-wakatime)
|
||||
- [Ejemplo](#ejemplo-2)
|
||||
- [Todos los ejemplos](#todos-los-ejemplos)
|
||||
- [Consejo rápido (para alinear las tarjetas de repositorio)](#consejo-rápido-para-alinear-las-tarjetas-de-repositorio)
|
||||
- [Despliega tu propia instancia de Vercel](#despliega-tu-propia-instancia-de-vercel)
|
||||
- [:sparkling\_heart: Apoya al proyecto](#sparkling_heart-apoya-al-proyecto)
|
||||
|
||||
# Tarjeta de estadísticas de GitHub
|
||||
|
||||
Copia y pega esto en el contenido de tu README.md y listo. ¡Simple!
|
||||
|
||||
Cambia el valor de `?username=` al nombre de tu usuario de GitHub.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
_Nota: Los rangos disponibles son S+ (top 1%), S (top 25%), A++ (top 45%), A+ (top 60%) y B+ (todos). Los valores se calculan utilizando la [función de distribución acumulada](https://es.wikipedia.org/wiki/Funci%C3%B3n_de_distribuci%C3%B3n) utilizando commits, contribuciones, issues, estrellas, pull request, seguidores y repositorios propios. Puedes investigar más sobre la implementación en [src/calculateRank.js](../src/calculateRank.js)._
|
||||
|
||||
### Ocultar estadísticas individualmente
|
||||
|
||||
Para ocultar alguna estadística específica, puedes utilizar el parámetro `?hide=` con los elementos que quieras ocultar separados por comas.
|
||||
|
||||
> Opciones: `&hide=stars,commits,prs,issues,contribs`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Agregar contribuciones privadas al total de commits contados
|
||||
|
||||
Puedes agregar el recuento de todas sus contribuciones privadas al recuento total de commits utilizando el parámetro `?count_private=true`.
|
||||
|
||||
_Nota: Si estás desplegando este proyecto tú mismo, las contribuciones privadas se contarán de manera predeterminada; de lo contrario, deberás elegir compartir el recuento de sus contribuciones privadas._
|
||||
|
||||
> Opciones: `&count_private=true`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Mostrar íconos
|
||||
|
||||
Para habilitar los íconos, puedes utilizar `show_icons=true` como parámetro, de esta manera:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Temas
|
||||
|
||||
Puedes personalizar el aspecto de la tarjeta sin realizar ninguna [personalización manual](#personalización) con los temas incorporados.
|
||||
|
||||
Utiliza el parámetro `?theme=THEME_NAME`, de esta manera:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
#### Todos los temas incorporados
|
||||
|
||||
dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula
|
||||
|
||||
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Stat Themes" width="600px"/>
|
||||
|
||||
Puedes ver una vista previa de [todos los temas disponibles](../themes/README.md) o ver el [archivo de configuración](../themes/index.js) del tema y también **puedes contribuir con nuevos temas** si lo deseas :D
|
||||
|
||||
### Personalización
|
||||
|
||||
Puedes personalizar el aspecto de tu `Tarjeta de Estadísticas` o `Tarjeta de Repo` de la manera que desees con los parámetros URL.
|
||||
|
||||
#### Opciones Comunes:
|
||||
|
||||
- `title_color` - Color del título _(hex color)_
|
||||
- `text_color` - Color del contenido _(hex color)_
|
||||
- `icon_color` - Color de icono si esta disponible _(hex color)_
|
||||
- `bg_color` - Color de fondo _(hex color)_
|
||||
- `hide_border` - Oculta el borde de la tarjeta _(booleano)_
|
||||
- `theme` - Nombre del tema, elige uno de [todos los temas disponible ](../themes/README.md)
|
||||
- `cache_seconds` - Cache _(min: 14400, max: 86400)_
|
||||
- `locale` - configurar el idioma en la tarjeta _(p.ej. cn, de, es, etc.)_
|
||||
|
||||
##### Gradiente en `bg_color`
|
||||
|
||||
Puedes pasar mútliples valores separados por coma en la opción `bg_color` para dibujar un gradiente, el formato del gradiente es:
|
||||
|
||||
```
|
||||
&bg_color=DEG,COLOR1,COLOR2,COLOR3...COLOR10
|
||||
```
|
||||
|
||||
> Nota sobre la caché: las tarjetas de Repo tienen un caché predeterminado de 4 horas (14400 segundos) si el recuento forks y el recuento de estrellas es inferior a 1k; de lo contrario, son 2 horas (7200 segundos). También ten en cuenta que la caché está sujeta a un mínimo de 2 horas y un máximo de 24 horas
|
||||
|
||||
#### Opciones exclusivas de la Tarjeta de Estadísticas:
|
||||
|
||||
- `hide` - Oculta de las estadísticas [los elementos especificados](#ocultar-estadísticas-individualmente) _(valores separados por comas)_
|
||||
- `hide_title` - _(booleano)_
|
||||
- `hide_rank` - _(booleano)_
|
||||
- `show_icons` - _(booleano)_
|
||||
- `include_all_commits` - Cuenta el total de commits en lugar de solo los commits del año actual _(boolean)_
|
||||
- `count_private` - Cuenta los commits privadas _(boolean)_
|
||||
- `line_height` - Establece el alto de línea entre texto _(número)_
|
||||
- `custom_title` - Establece un título personalizado
|
||||
- [`disable_animations`] - Desactiva todas las animaciones _(booleano)_
|
||||
|
||||
#### Opciones exclusivas de la Tarjeta de Repo:
|
||||
|
||||
- `show_owner` - Mostrar el nombre del propietario del repositorio _(booleano)_
|
||||
|
||||
#### Opciones exclusivas de la Tarjeta de Lenguajes:
|
||||
|
||||
- `hide` - Oculta de la tarjeta los lenguajes especificados _(valores separados por comas)_
|
||||
- `hide_title` - _(booleano)_
|
||||
- `layout` - Cambiar entre los cinco diseños disponibles `normal` & `compact` & `donut` & `donut-vertical` & `pie`
|
||||
- `card_width` - Establece el ancho de la tarjeta manualmente _(número)_
|
||||
- `langs_count` - Muestra más lenguajes en la tarjeta, entre 1-10, por defecto 5 _(número)_
|
||||
- `exclude_repo` - Excluye los repositorios especificados _(valores separados por comas)_
|
||||
- `custom_title` - Establece un título personalizado
|
||||
|
||||
> :warning: **Importante:**
|
||||
> Los nombres de los lenguajes deben estar codificados para URLs, como se especifica en [Código porciento](https://es.wikipedia.org/wiki/C%C3%B3digo_porciento)
|
||||
> (es decir: `c++` debería convertirse en `c%2B%2B`,`jupyter notebook` debería convertirse en `jupyter%20notebook`, etc.)
|
||||
|
||||
#### Opciones exclusivas de la Tarjeta de WakaTime:
|
||||
|
||||
- `hide_title` - _(booleano)_
|
||||
- `line_height` - Establece el alto de línea entre texto _(número)_
|
||||
- `hide_progress` - Oculta la barra de progreso y el porcentaje _(booleano)_
|
||||
- `custom_title` - Establece un título personalizado
|
||||
- `layout` - Cambia entre los dos diseños disponibles `default` & `compact`
|
||||
- `langs_count` - Limita el número de idiomas que aparecen en el mapa
|
||||
- `api_domain` - Establece un dominio de API personalizado para la tarjeta
|
||||
|
||||
---
|
||||
|
||||
# Pines adicionales de GitHub
|
||||
|
||||
Los pines adicionales de GitHub le permiten fijar más de 6 repositorios en su perfil utilizando un perfil readme de GitHub.
|
||||
|
||||
¡Yey! Ya no está limitado a 6 repositorios pinneados.
|
||||
|
||||
### Utilización
|
||||
|
||||
Copia y pegua este código en tu Readme y cambia los enlaces.
|
||||
|
||||
Endpoint: `api/pin?username=anuraghazra&repo=github-readme-stats`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Ejemplo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
Utiliza la variable [show_owner](#customización) para incluir el nombre de usuario del propietario del repositorio.
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# Tarjeta de Lenguajes Principales
|
||||
|
||||
La tarjeta de lenguajes principales muestra los lenguajes principales del usuario de GitHub que se han utilizado principalmente.
|
||||
|
||||
_NOTA: los lenguajes principales no indican mi nivel de habilidad o algo así, es una métrica de GitHub de los lenguajes que tengo más código en GitHub. Es una nueva característica de github-readme-stats_
|
||||
|
||||
### Utilización
|
||||
|
||||
Copia y pegua este código en tu Readme y cambia los enlaces.
|
||||
|
||||
Endpoint: `api/top-langs?username=anuraghazra`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Excluir repositorios individualmente
|
||||
|
||||
Puedes usar el parámetro `?exclude_repo=repo1,repo2` para ocultar repositorios individualmente.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Ocultar lenguajes individualmente
|
||||
|
||||
Puedes usar el parámetro `?hide=language1,language2` para ocultar lenguajes individualmente.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Mostrar más lenguajes
|
||||
|
||||
Puedes usar el paramétro `&langs_count=` para incrementar o decrementar el número de lenguajes mostrados en la tarjeta. Los valores admitidos son los números enteros entre 1 y 10 (inclusive), y el valor por defecto es 5.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Diseño Compacto de Tarjeta de Lenguaje
|
||||
|
||||
Puedes usar la opción `& layout = compact` para cambiar el diseño de la tarjeta.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Ejemplo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Diseño compacto
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# Estadísticas de la semana de WakaTime
|
||||
|
||||
cambia el valor del parámetro `?username=` a tu username en [WakaTime](https://wakatime.com).
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Ejemplo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Diseño compacto
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Todos los ejemplos
|
||||
|
||||
- Por defecto
|
||||
|
||||

|
||||
|
||||
- Ocultando ciertas estadísticas
|
||||
|
||||

|
||||
|
||||
- Mostrando íconos
|
||||
|
||||

|
||||
|
||||
- Incluyendo todos los commits
|
||||
|
||||

|
||||
|
||||
- Temas
|
||||
|
||||
Escoja cualquiera de los [temas por defecto](#themes)
|
||||
|
||||

|
||||
|
||||
- Gradiente
|
||||
|
||||

|
||||
|
||||
- Personalizando Tarjeta de Estadísticas
|
||||
|
||||

|
||||
|
||||
- Estableciendo Idioma de la tarjeta
|
||||
|
||||

|
||||
|
||||
- Personalizando Tarjeta de Repo
|
||||
|
||||

|
||||
|
||||
- Lenguajes Top
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Tarjeta de WakaTime
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Consejo rápido (para alinear las tarjetas de repositorio)
|
||||
|
||||
Por lo general, no podrás acomodar las imágenes una al lado de la otra. Para hacerlo, puede usar este enfoque:
|
||||
|
||||
```html
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=convoychat" />
|
||||
</a>
|
||||
```
|
||||
|
||||
## Despliega tu propia instancia de Vercel
|
||||
|
||||
#### [Échale un vistazo a este tutorial paso a paso de @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
Desde que la API de GitHub permite solo 5k peticiones por hora, es posible que mi `https://github-readme-stats.vercel.app/api` pueda llegar al límite. Si lo alojas en tu propio servidor de Vercel, no tendrás que preocuparte de nada. ¡Clickea en el botón "Deploy" para comenzar!
|
||||
|
||||
NOTA: Debido a [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) podríamos manejar más de 5k peticiones sin tener ningún problema con el downtime :D
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
<details>
|
||||
<summary>Guía para comenzar en Vercel</summary>
|
||||
|
||||
1. Ve a [vercel.com](https://vercel.com/)
|
||||
2. Clickea en `Log in`
|
||||

|
||||
3. Inicia sesión con GitHub presionando `Continue with GitHub`
|
||||

|
||||
4. Permite el acceso a todos los repositorios (si se te pregunta)
|
||||
5. Haz un Fork de este repositorio
|
||||
6. Dirígete de nuevo a tu [Vercel dashboard](https://vercel.com/dashboard)
|
||||
7. Selecciona `Import Project`
|
||||

|
||||
8. Selecciona `Import Git Repository`
|
||||

|
||||
9. Selecciona "root" y matén todo como está, simplemente añade tu variable de entorno llamada PAT_1 (como se muestra), la cual contendrá un token de acceso personal (PAT), el cual puedes crear fácilmente [aquí](https://github.com/settings/tokens/new) (mantén todo como está, simplemente asígnale un nombre, puede ser cualquiera que desees)
|
||||

|
||||
10. Clickea "Deploy" y ya está listo. ¡Ve tus dominios para usar la API!
|
||||
|
||||
</details>
|
||||
|
||||
## :sparkling_heart: Apoya al proyecto
|
||||
|
||||
Casi todos mis proyectos son de código abierto e intento responder a todos los usuarios que necesiten ayuda con alguno de estos proyectos. Obviamente, esto toma tiempo. Puedes usar este servicio gratis.
|
||||
|
||||
No obstante, si estás utilizando este proyecto y estás feliz con él o simplemente quieres animarme a que siga creando cosas, aquí tienes algunas maneras de hacerlo:
|
||||
|
||||
- Darme créditos cuando estés utilizando github-readme-stats en tu README, añadiendo un link a este repositorio :D
|
||||
- Dándole una estrella y compartiendo el proyecto :rocket:
|
||||
- [](https://www.paypal.me/anuraghazra) - Puedes hacerme una única donación a través de PayPal. Probablemente me compraré un ~~café~~ té. :tea:
|
||||
|
||||
¡Gracias! :heart:
|
||||
|
||||
---
|
||||
|
||||
[](https://vercel.com?utm_source=github_readme_stats_team&utm_campaign=oss)
|
||||
|
||||
¡Las contribuciones son bienvenidas! <3
|
||||
|
||||
Hecho con :heart: y JavaScript.
|
||||
@@ -1,353 +0,0 @@
|
||||
<p align="center">
|
||||
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
|
||||
<h2 align="center">GitHub Readme Stats</h2>
|
||||
<p align="center">Obtenez des statistiques GitHub générées dynamiquement sur vos Readme !</p>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#toutes-les-démos">Voir la démo</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">Soumettre un bug</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">Demander une nouveauté</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="/docs/readme_fr.md">Français</a>
|
||||
·
|
||||
<a href="/docs/readme_cn.md">简体中文</a>
|
||||
·
|
||||
<a href="/docs/readme_es.md">Español</a>
|
||||
·
|
||||
<a href="/docs/readme_de.md">Deutsch</a>
|
||||
·
|
||||
<a href="/docs/readme_ja.md">日本語</a>
|
||||
·
|
||||
<a href="/docs/readme_pt-BR.md">Português Brasileiro</a>
|
||||
·
|
||||
<a href="/docs/readme_it.md">Italiano</a>
|
||||
·
|
||||
<a href="/docs/readme_kr.md">한국어</a>
|
||||
.
|
||||
<a href="/docs/readme_nl.md">Nederlands</a>
|
||||
.
|
||||
<a href="/docs/readme_np.md">नेपाली</a>
|
||||
.
|
||||
<a href="/docs/readme_tr.md">Türkçe</a>
|
||||
</p>
|
||||
</p>
|
||||
<p align="center">Vous aimez ce projet? Pensez <a href="https://www.paypal.me/anuraghazra">à faire un don</a> pour l'améliorer!
|
||||
|
||||
# Features <!-- omit in toc -->
|
||||
|
||||
- [Carte des Stats GitHub](#carte-des-stats-github)
|
||||
- [Cacher les statistiques individuelles](#cacher-les-statistiques-individuelles)
|
||||
- [Afficher les icônes](#afficher-les-icônes)
|
||||
- [Thèmes](#thèmes)
|
||||
- [Personnalisation](#personnalisation)
|
||||
- [GitHub Extra Pins](#github-extra-pins)
|
||||
- [Usage](#usage)
|
||||
- [Démo](#démo)
|
||||
- [Carte des langages les + utilisés](#carte-des-langages-les--utilisés)
|
||||
- [Usage](#usage-1)
|
||||
- [Cacher certaines langages](#cacher-certaines-langages)
|
||||
- [Carte compacte des langages](#carte-compacte-des-langages)
|
||||
- [Démo](#démo-1)
|
||||
- [Toutes les démos](#toutes-les-démos)
|
||||
- [Conseil rapide (aligner les cartes des dépôts)](#conseil-rapide-aligner-les-cartes-des-dépôts)
|
||||
- [Déployer sur votre propre instance Vercel](#déployer-sur-votre-propre-instance-vercel)
|
||||
- [:sparkling\_heart: Supporter le project](#sparkling_heart-supporter-le-project)
|
||||
|
||||
# Carte des Stats GitHub
|
||||
|
||||
Copiez-collez ceci dans votre Markdown, et c'est tout. C'est simple !
|
||||
|
||||
Remplacez la valeur `?username=` par le nom d'utilisateur de votre GitHub.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
_Note: Les rangs sont calculés sur la base des statistiques de l'utilisateur, voir [src/calculateRank.js](../src/calculateRank.js)_
|
||||
|
||||
### Cacher les statistiques individuelles
|
||||
|
||||
Pour masquer des statistiques spécifiques, vous pouvez passer un paramètre de requête `?hide=` avec des valeurs séparées par des virgules.
|
||||
|
||||
> Options: `&hide=stars,commits,prs,issues,contribs`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Afficher les icônes
|
||||
|
||||
Pour activer les icônes, vous pouvez passer `show_icons=true` dans le paramètre de requête, comme ceci :
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Thèmes
|
||||
|
||||
Avec les thèmes intégrés, vous pouvez personnaliser l'apparence de la carte sans faire de [personnalisation manuelle](#customization).
|
||||
|
||||
Use `?theme=THEME_NAME` parameter like so :-
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
#### Tous les thèmes intégrés :-
|
||||
|
||||
dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula
|
||||
|
||||
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Stat Themes" width="600px"/>
|
||||
|
||||
Vous pouvez consulter un aperçu de [tous les thèmes disponibles](../themes/README.md) ou consulter le [fichier de configuration des thèmes](../themes/index.js) & **vous pouvez également ajouter de nouveaux thèmes** si vous le souhaitez :D
|
||||
|
||||
### Personnalisation
|
||||
|
||||
Vous pouvez personnaliser l'apparence de votre `Carte des stats` ou `Carte de dépôt` comme vous le souhaitez avec les paramètres d'URL.
|
||||
|
||||
#### Options principales:
|
||||
|
||||
- `title_color` - Couleur du titre de la carte _(hex color)_
|
||||
- `text_color` - Couleur du texte _(hex color)_
|
||||
- `icon_color` - Couleur des icônes si disponibles _(hex color)_
|
||||
- `bg_color` - Couleur du fond de la carte _(hex color)_ **ou** un gradiant de la forme _angle,start,end_
|
||||
- `hide_border` - Cache la bordure de la carte _(booléen)_
|
||||
- `theme` - Nom du thème, parmis [tous les thèmes disponibles](../themes/README.md)
|
||||
- `cache_seconds` - Paramétrer le cache manuellement _(min: 14400, max: 86400)_
|
||||
- `locale` - définir la langue de la carte _(par exemple. cn, de, es, etc.)_
|
||||
|
||||
##### Gradient in bg_color
|
||||
|
||||
Vous pouvez fournir plusieurs valeurs (suivie d'une virgule) dans l'option bg_color pour rendre un degradé, le format du degradé est :-
|
||||
|
||||
```
|
||||
&bg_color=DEG,COLOR1,COLOR2,COLOR3...COLOR10
|
||||
```
|
||||
|
||||
> Note relative: Les cartes dépôt ont un cache par défaut de 30 minutes (1800 secondes) si le nombre de bifurcations et d'étoiles est inférieur à 1K, alors il est de 2 heures (7200). Notez également que la mémoire cache est limitée à 30 minutes au minimum et à 24 heures au maximum.
|
||||
|
||||
#### Stats Card Exclusive Options:
|
||||
|
||||
- `hide` - Masquer [les éléments spécifiés](#cacher-les-statistiques-individuelles) dans les statistiques _(Comma seperated values)_
|
||||
- `hide_title` - Masquer le titre _(boolean)_
|
||||
- `hide_rank` - Masquer le rang _(boolean)_
|
||||
- `show_icons` - Afficher les icônes _(boolean)_
|
||||
- `include_all_commits` - Compter le total de commits au lieu de ne compter que les commits de l'année en cours _(boolean)_
|
||||
- `count_private` - Compter les contributions privées _(boolean)_
|
||||
- `line_height` - Fixer la hauteur de la ligne entre les textes _(number)_
|
||||
|
||||
#### Repo Card Exclusive Options:
|
||||
|
||||
- `show_owner` - Affiche le nom du propriétaire du dépôt _(boolean)_
|
||||
|
||||
#### Language Card Exclusive Options:
|
||||
|
||||
- `hide` - Masquer les langages spécifiés sur la carte _(Comma seperated values)_
|
||||
- `hide_title` - Masquer le titre _(boolean)_
|
||||
- `layout` - Alterner entre 5 mise en page `normal` & `compact` & `donut` & `donut-vertical` & `pie`
|
||||
- `card_width` - Fixer la largeur de la carte manuellement _(number)_
|
||||
|
||||
> :warning: **Important:**
|
||||
> Les noms des langages doivent être en format uri, comme spécifié dans [Percent Encoding](https://fr.wikipedia.org/wiki/Percent-encoding)
|
||||
> (c'est-à-dire que: `c++` devrait devenir `c%2B%2B`, `jupyter notebook` devrait devenir `jupyter%20notebook`, etc.)
|
||||
|
||||
---
|
||||
|
||||
# GitHub Extra Pins
|
||||
|
||||
Les épingles supplémentaires GitHub vous permettent d'épingler plus de 6 dépôts dans votre profil en utilisant un profil GitHub readme.
|
||||
|
||||
Et OUI ! Vous n'êtes plus limité à 6 dépôts épinglés.
|
||||
|
||||
### Usage
|
||||
|
||||
Copiez-collez ce code dans votre readme et modifiez les liens.
|
||||
|
||||
Extrémité: `api/pin?username=anuraghazra&repo=github-readme-stats`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Démo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
Utiliser la variable [show_owner](#customization) pour inclure le nom d'utilisateur du propriétaire du dépôt.
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# Carte des langages les + utilisés
|
||||
|
||||
La carte des langages principaux montre les langages les plus utilisés par les utilisateurs de GitHub.
|
||||
|
||||
_NOTE: Les langages affichés n'indiquent pas mon niveau de compétence ou quelque chose comme ça, c'est une métrique GitHub de quelles langages j'ai le plus de code sur GitHub, c'est une nouvelle fonctionnalité de github-readme-stats_
|
||||
|
||||
### Usage
|
||||
|
||||
Copiez-collez ce code dans votre readme et modifiez les liens.
|
||||
|
||||
Extrémité: `api/top-langs?username=anuraghazra`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Cacher certaines langages
|
||||
|
||||
Vous pouvez utiliser le paramètre `?hide=language1,language2` pour masquer les langages individuels.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Carte compacte des langages
|
||||
|
||||
Vous pouvez utiliser l'option `&layout=compact` pour changer le style de la carte.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Démo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Carte compacte
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Toutes les démos
|
||||
|
||||
- Défaut
|
||||
|
||||

|
||||
|
||||
- Ne pas afficher des stats spécifiques
|
||||
|
||||

|
||||
|
||||
- Afficher les icônes
|
||||
|
||||

|
||||
|
||||
- Inclure tous les commits
|
||||
|
||||

|
||||
|
||||
- Thèmes
|
||||
|
||||
Choisissez parmi l'un des [thèmes par défaut](#themes)
|
||||
|
||||

|
||||
|
||||
- Dégradé
|
||||
|
||||

|
||||
|
||||
- Personnaliser la carte des stats
|
||||
|
||||

|
||||
|
||||
- Personnaliser la carte dépôt
|
||||
|
||||

|
||||
|
||||
- Top Langages
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Conseil rapide (aligner les cartes des dépôts)
|
||||
|
||||
En général, vous ne pourrez pas mettre les images côte à côte. Pour ce faire, vous pouvez utiliser cette approche :
|
||||
|
||||
```html
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=convoychat" />
|
||||
</a>
|
||||
```
|
||||
|
||||
## Déployer sur votre propre instance Vercel
|
||||
|
||||
#### [Check Out Step By Step Video Tutorial By @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
Comme l'API GitHub ne permet que 5k requêtes par heure, il est possible que mon `https://github-readme-stats.vercel.app/api` puisse atteindre le limiteur de débit. Si vous l'hébergez sur votre propre serveur Vercel, alors vous n'avez pas à vous soucier de quoi que ce soit. Cliquez sur le bouton de déploiement pour commencer !
|
||||
|
||||
NOTE: Depuis [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) nous devrions être en mesure de traiter plus de 5 000 demandes et ne pas avoir de problèmes de temps d'arrêt :D
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
<details>
|
||||
<summary><b> Guide pour la mise en place de Vercel 🔨 </b></summary>
|
||||
|
||||
1. Allez sur [vercel.com](https://vercel.com/)
|
||||
1. Cliquez sur `Log in`
|
||||

|
||||
1. Connectez-vous avec GitHub en cliquant `Continue with GitHub`
|
||||

|
||||
1. Connectez-vous à GitHub et autorisez l'accès à tous les dépôts, si vous y êtes invité
|
||||
1. Forkez ce dépôt
|
||||
1. Retournez au [dashboard Vercel](https://vercel.com/dashboard)
|
||||
1. Sélectionnez `Import Project`
|
||||

|
||||
1. Sélectionnez `Import Git Repository`
|
||||

|
||||
1. Choisissez root et gardez tout tel quel, ajoutez simplement votre variable d'environnement nommée PAT_1 (comme indiqué), qui contiendra un jeton d'accès personnel (PAT), que vous pouvez facilement créer [ici](https://github.com/settings/tokens/new) (laissez tout tel quel, nommez le simplement quelque chose, cela peut être tout ce que vous voulez)
|
||||

|
||||
1. Cliquez sur "Deploy" et vous êtes prêt à partir. Regardez vos domaines pour utiliser l'API !
|
||||
|
||||
</details>
|
||||
|
||||
## :sparkling_heart: Supporter le project
|
||||
|
||||
Je mets open-source presque tout ce que je peux, et j'essaie de répondre à tous ceux qui ont besoin d'aide en utilisant ces projets. Évidemment, cela prend du temps. Vous pouvez utiliser ce service gratuitement.
|
||||
|
||||
Cependant, si vous utilisez ce projet et que vous en êtes satisfait ou si vous voulez simplement m'encourager à continuer à créer, il y a quelques façons de le faire :-
|
||||
|
||||
- Donner un crédit approprié lorsque vous utilisez github-readme-stats sur votre readme, avec un lien vers celui-ci :D
|
||||
- Mettre une étoile et partager le projet :rocket:
|
||||
- [](https://www.paypal.me/anuraghazra) - Vous pouvez faire des dons uniques via PayPal. Je vais probablement acheter un ~~café~~ thé. :tea:
|
||||
|
||||
Merci ! :heart:
|
||||
|
||||
---
|
||||
|
||||
[](https://vercel.com?utm_source=github_readme_stats_team&utm_campaign=oss)
|
||||
|
||||
|
||||
Les contributions sont les bienvenues ! <3
|
||||
|
||||
Fait avec :heart: et JavaScript.
|
||||
@@ -1,365 +0,0 @@
|
||||
<p align="center">
|
||||
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
|
||||
<h2 align="center">GitHub Readme Stats</h2>
|
||||
<p align="center">Mostra nei tuoi README file le statistiche GitHub generate dinamicamente!</p>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#demo">Anteprima</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">Segnala un errore</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">Richiedi una nuova funzionalità</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="/docs/readme_fr.md">Français </a>
|
||||
·
|
||||
<a href="/docs/readme_cn.md">简体中文</a>
|
||||
·
|
||||
<a href="/docs/readme_es.md">Español</a>
|
||||
·
|
||||
<a href="/docs/readme_de.md">Deutsch</a>
|
||||
·
|
||||
<a href="/docs/readme_ja.md">日本語</a>
|
||||
·
|
||||
<a href="/docs/readme_pt-BR.md">Português Brasileiro</a>
|
||||
·
|
||||
<a href="/docs/readme_it.md">Italiano</a>
|
||||
·
|
||||
<a href="/docs/readme_kr.md">한국어</a>
|
||||
.
|
||||
<a href="/docs/readme_nl.md">Nederlands</a>
|
||||
.
|
||||
<a href="/docs/readme_np.md">नेपाली</a>
|
||||
.
|
||||
<a href="/docs/readme_tr.md">Türkçe</a>
|
||||
</p>
|
||||
</p>
|
||||
<p align="center">Se ti piace questo progetto, considera la possibilità di <a href="https://www.paypal.me/anuraghazra">donare</a> per aiutare a renderlo migliore!
|
||||
|
||||
# Caratteristiche <!-- omit in toc -->
|
||||
|
||||
- [GitHub Stats Card](#github-stats-card)
|
||||
- [Nascondere statistiche individuali](#nascondere-statistiche-individuali)
|
||||
- [Includere i contributi privati nel computo totale](#includere-i-contributi-privati-nel-computo-totale)
|
||||
- [Mostrare le icone](#mostrare-le-icone)
|
||||
- [Temi](#temi)
|
||||
- [Personalizzazione](#personalizzazione)
|
||||
- [GitHub Extra Pins](#github-extra-pins)
|
||||
- [Utilizzo](#utilizzo)
|
||||
- [Demo](#demo)
|
||||
- [Top Languages Card](#top-languages-card)
|
||||
- [Utilizzo](#utilizzo-1)
|
||||
- [Nascondi linguaggi specifici](#nascondi-linguaggi-specifici)
|
||||
- [Layout compatto](#layout-compatto)
|
||||
- [Demo](#demo-1)
|
||||
- [Galleria di esempi](#galleria-di-esempi)
|
||||
- [Consiglio veloce (Allineare le Card)](#consiglio-veloce-allineare-le-card)
|
||||
- [Deploy su Vercel](#deploy-su-vercel)
|
||||
- [:sparkling\_heart: Supporta il progetto](#sparkling_heart-supporta-il-progetto)
|
||||
|
||||
|
||||
# GitHub Stats Card
|
||||
|
||||
Per creare una Card con le statistiche GitHub, copia e incolla nel tuo file markdown, tutto qua: è semplice!
|
||||
|
||||
Ricorda di cambiare il valore `?username=` con il tuo nome utente GitHub.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
_Nota: I punteggi sono calcolati sulla base delle tue statistiche, dai un'occhiata a [src/calculateRank.js](../src/calculateRank.js) per ulteriori informazioni_
|
||||
|
||||
### Nascondere statistiche individuali
|
||||
|
||||
Per nascondere qualche dato, puoi aggiungere i parametri `?hide=`, separando i valori con una virgola.
|
||||
|
||||
> Opzioni: `&hide=stars,commits,prs,issues,contribs`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Includere i contributi privati nel computo totale
|
||||
|
||||
Puoi aggiungere i tuoi contributi privati al totale dei commit, utilizzando il parametro `?count_private=true`.
|
||||
|
||||
_Nota: se hai deciso di fare il deploy del progetto, i contributi privati verranno inclusi in automatico._
|
||||
|
||||
> Opzioni: `&count_private=true`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Mostrare le icone
|
||||
|
||||
Per abilitare le icone, puoi specificare `show_icons=true`, ad esempio:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Temi
|
||||
|
||||
Esistono alcuni temi predefiniti coi quali è possibile personalizzare l'aspetto delle card. In alternativa, è possibile effettuare una [personalizzazione manuale](#personalizzazione).
|
||||
|
||||
Usa il parametro `?theme=NOME_TEMA` in questo modo:-
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
#### Galleria dei temi:-
|
||||
|
||||
dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula
|
||||
|
||||
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Stat Themes" width="600px"/>
|
||||
|
||||
Puoi avere un'anteprima di [tutti i temi supportati](../themes/README.md) o controllare il [file di configurazione dei temi](../themes/index.js) e **puoi anche contribuire creando un nuovo tema** se vuoi :D
|
||||
|
||||
### Personalizzazione
|
||||
|
||||
Puoi personalizzare l'aspetto delle tue `Stats Card` o delle `Repo Card` in qualsiasi modo, semplicemente modificando i parametri dell'URL.
|
||||
|
||||
#### Opzioni comuni:
|
||||
|
||||
- `title_color` - Colore del titolo _(in esadecimale)_
|
||||
- `text_color` - Colore del testo _(in esadecimale)_
|
||||
- `icon_color` - Colore delle icone, se disponibili _(in esadecimale)_
|
||||
- `bg_color` - Colore dello sfondo _(in esadecimale)_ **oppure** un gradiente nella forma _angolo,inizio,fine_
|
||||
- `hide_border` - Nasconde il bordo della carta _(booleano)_
|
||||
- `theme` - Nome del tema, dai un'occhiata a [tutti i temi disponibili](../themes/README.md)
|
||||
- `cache_seconds` - Specifica manualmente il valore di cache, in secondi _(min: 14400, max: 86400)_
|
||||
- `locale` - Impostare la lingua nella scheda _(per esempio. cn, de, es, eccetera.)_
|
||||
|
||||
##### Gradiente nello sfondo
|
||||
|
||||
Puoi fornire valori separati da virgola nel parametro bg_color per creare un gradiente, il cui formato è:-
|
||||
|
||||
```
|
||||
&bg_color=DEG,COLOR1,COLOR2,COLOR3...COLOR10
|
||||
```
|
||||
|
||||
> Nota sulla cache: le card hanno un valore di cache di 4 ore (14400 seconds) di default se il numero di fork & il numero di stelle è inferiore a 1000; altrimenti è pari a 2 ore (7200).
|
||||
|
||||
#### Opzioni valide solo per le card delle statistiche:
|
||||
|
||||
- `hide` - Nasconde gli oggetti selezionati _(valori separati da virgola)_
|
||||
- `hide_title` - Nasconde il titolo _(booleano)_
|
||||
- `hide_rank` - Nasconde il punteggio _(booleano)_
|
||||
- `show_icons` - Mostra le icone _(booleano)_
|
||||
- `include_all_commits` - Mostra tutti i commit e non solo quelli dell'anno corrente _(booleano)_
|
||||
- `count_private` - Include i contributi privati _(booleano)_
|
||||
- `line_height` - Specifica il valore dell'altezza di riga _(numero)_
|
||||
|
||||
#### Opzioni valide solo per le Repo Card:
|
||||
|
||||
- `show_owner` - Mostra il nome utente del proprietario _(booleano)_
|
||||
|
||||
#### Opzioni valide solo per le card dei linguaggi:
|
||||
|
||||
- `hide` - Nasconde un linguaggio specifico _(valori separati da virgola)_
|
||||
- `hide_title` - Nasconde il titolo _(booleano)_
|
||||
- `layout` - Specificare il tipo di layout, `normal` (esteso), `compact` (compatto), `donut` (ciambella), `donut-vertical` (ciambella verticale) e `pie` (torta)
|
||||
- `card_width` - Specifica il valore della larghezza _(numero)_
|
||||
|
||||
> :warning: **Importante:**
|
||||
> Per i nomi dei linguaggi, assicurati di effettuare l'encoding giusto nell'uri, come specificato in [Percent Encoding](https://en.wikipedia.org/wiki/Percent-encoding)
|
||||
> (ad esempio: `c++` diventa `c%2B%2B`, `jupyter notebook` diventa `jupyter%20notebook`, ecc.)
|
||||
|
||||
---
|
||||
|
||||
# GitHub Extra Pins
|
||||
|
||||
GitHub Extra Pins ti permette di fissare in alto più di 6 repository nel tuo profilo, sfruttando il README del profilo.
|
||||
|
||||
### Utilizzo
|
||||
|
||||
Copia e incolla il seguente codice, premurandoti di cambiare il link.
|
||||
|
||||
Endpoint: `api/pin?username=anuraghazra&repo=github-readme-stats`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
Usa la variabile [show_owner](#personalizzazione) per includere il nome utente del proprietario
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# Top Languages Card
|
||||
|
||||
La Top Languages Card mostra i linguaggi che utilizzi di più su GitHub.
|
||||
|
||||
_NOTA: questa card non indica il livello di abilità, ma piuttosto quanto codice hai scritto in un determinato linguaggio_
|
||||
|
||||
### Utilizzo
|
||||
|
||||
Copia e incolla nel tuo file README, cambiando i link.
|
||||
|
||||
Endpoint: `api/top-langs?username=anuraghazra`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Nascondi linguaggi specifici
|
||||
|
||||
Puoi utilizzare il parametro `?hide=linguaggio1,linguaggio2` per nascondere alcuni linguaggi.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Layout compatto
|
||||
|
||||
Puoi utilizzare l'opzione `&layout=compact` per cambiare l'aspetto della card.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Layout Compatto
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Galleria di esempi
|
||||
|
||||
- Default
|
||||
|
||||

|
||||
|
||||
- Nascondere dati specifici
|
||||
|
||||

|
||||
|
||||
- Mostrare le icone
|
||||
|
||||

|
||||
|
||||
- Includere tutti i commit
|
||||
|
||||

|
||||
|
||||
- Temi
|
||||
|
||||
Scegli uno dei [temi di default](#themes)
|
||||
|
||||

|
||||
|
||||
- Gradiente
|
||||
|
||||

|
||||
|
||||
- Personalizzare le Stats Card
|
||||
|
||||

|
||||
|
||||
- Personalizzare le Repo Card
|
||||
|
||||

|
||||
|
||||
- Linguaggi più usati
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Consiglio veloce (Allineare le Card)
|
||||
|
||||
Per allineare le card una accanto all'altra, puoi adottare questo approccio:
|
||||
|
||||
```html
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=convoychat" />
|
||||
</a>
|
||||
```
|
||||
|
||||
## Deploy su Vercel
|
||||
|
||||
#### [Guarda questo Video Tutorial, realizzato da @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
Since the GitHub API only allows 5k requests per hour, it is possible that my `https://github-readme-stats.vercel.app/api` could hit the rate limiter. If you host it on your own Vercel server, then you don't have to worry about anything. Click on the deploy button to get started!
|
||||
|
||||
NOTE: Since [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) we should be able to handle more than 5k requests and have no issues with downtime :D
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
<details>
|
||||
<summary><b> Guide on setting up Vercel 🔨 </b></summary>
|
||||
|
||||
1. Go to [vercel.com](https://vercel.com/)
|
||||
1. Click on `Log in`
|
||||

|
||||
1. Sign in with GitHub by pressing `Continue with GitHub`
|
||||

|
||||
1. Sign into GitHub and allow access to all repositories, if prompted
|
||||
1. Fork this repo
|
||||
1. Go back to your [Vercel dashboard](https://vercel.com/dashboard)
|
||||
1. Select `Import Project`
|
||||

|
||||
1. Select `Import Git Repository`
|
||||

|
||||
1. Select root and keep everything as is, just add your environment variable named PAT_1 (as shown), which will contain a personal access token (PAT), which you can easily create [here](https://github.com/settings/tokens/new) (leave everything as is, just name it something, it can be anything you want)
|
||||

|
||||
1. Click deploy, and you're good to go. See your domains to use the API!
|
||||
|
||||
</details>
|
||||
|
||||
## :sparkling_heart: Supporta il progetto
|
||||
|
||||
Rendo open-source quasi tutto ciò che posso e provo a rispondere a chiunque sia in difficoltà nell'utilizzare questi progetti. Ovviamente, mi richiede del tempo.
|
||||
Puoi utilizzare questo servizio gratuitamente.
|
||||
|
||||
Tuttavia, se usi il progetto e ti piace e vuoi sostenermi, puoi:-
|
||||
|
||||
- Dare il giusto riconoscimento quando usi github-readme-stats nei tuoi readme, includendo un link :D
|
||||
- Mettere una stella e condividere il progetto :rocket:
|
||||
- [](https://www.paypal.me/anuraghazra) - Fare una donazione via PayPal. Probabilmente compreròun ~~caffè~~ tè. :tea:
|
||||
|
||||
Grazie! :heart:
|
||||
|
||||
---
|
||||
|
||||
[](https://vercel.com?utm_source=github_readme_stats_team&utm_campaign=oss)
|
||||
|
||||
I contributi sono benvenuti! <3
|
||||
|
||||
Realizzato col :heart: e in JavaScript.
|
||||
@@ -1,372 +0,0 @@
|
||||
<p align="center">
|
||||
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
|
||||
<h2 align="center">GitHub Readme Stats</h2>
|
||||
<p align="center">あなたの README に自動生成された GitHub の統計情報を載せましょう!</p>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#demo">View Demo</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">Report Bug</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">Request Feature</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="/docs/readme_fr.md">Français</a>
|
||||
·
|
||||
<a href="/docs/readme_cn.md">简体中文</a>
|
||||
·
|
||||
<a href="/docs/readme_es.md">Español</a>
|
||||
·
|
||||
<a href="/docs/readme_de.md">Deutsch</a>
|
||||
·
|
||||
<a href="/docs/readme_ja.md">日本語</a>
|
||||
·
|
||||
<a href="/docs/readme_pt-BR.md">Português Brasileiro</a>
|
||||
·
|
||||
<a href="/docs/readme_it.md">Italiano</a>
|
||||
·
|
||||
<a href="/docs/readme_kr.md">한국어</a>
|
||||
.
|
||||
<a href="/docs/readme_nl.md">Nederlands</a>
|
||||
.
|
||||
<a href="/docs/readme_np.md">नेपाली</a>
|
||||
.
|
||||
<a href="/docs/readme_tr.md">Türkçe</a>
|
||||
</p>
|
||||
</p>
|
||||
<p align="center">このプロジェクトを気に入っていただけましたか?<br>もしよろしければ、プロジェクトのさらなる改善のために<a href="https://www.paypal.me/anuraghazra">寄付</a>を検討して頂けると嬉しいです!</p>
|
||||
|
||||
# 主な機能 <!-- omit in toc -->
|
||||
|
||||
- [GitHub Stats Card](#github-stats-card)
|
||||
- [特定の統計情報を隠す](#特定の統計情報を隠す)
|
||||
- [プライベートリポジトリへのコミットをカウントする](#プライベートリポジトリへのコミットをカウントする)
|
||||
- [アイコンを表示する](#アイコンを表示する)
|
||||
- [テーマの変更](#テーマの変更)
|
||||
- [テーマを自分でカスタマイズする](#テーマを自分でカスタマイズする)
|
||||
- [GitHub Extra Pins](#github-extra-pins)
|
||||
- [使い方](#使い方)
|
||||
- [デモ](#デモ)
|
||||
- [Top Languages Card](#top-languages-card)
|
||||
- [使い方](#使い方-1)
|
||||
- [特定の言語を隠す](#特定の言語を隠す)
|
||||
- [レイアウトをコンパクトにする](#レイアウトをコンパクトにする)
|
||||
- [デモ](#デモ-1)
|
||||
- [全てのデモ](#全てのデモ)
|
||||
- [クイックヒント (カードを並べる)](#クイックヒント-カードを並べる)
|
||||
- [自分の Vercel インスタンスにデプロイする](#自分の-vercel-インスタンスにデプロイする)
|
||||
- [:sparkling\_heart: このプロジェクトを支援する](#sparkling_heart-このプロジェクトを支援する)
|
||||
|
||||
# GitHub Stats Card
|
||||
|
||||
以下のコードをコピーして、あなたの Markdown ファイルに貼り付けるだけです。
|
||||
簡単ですね!
|
||||
|
||||
`?username=` の値は、あなたの GitHub アカウントのユーザー名に変更してください。
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
_Note: カードに表示されるランクはユーザの統計情報に基づいて計算されています。詳しくは、[src/calculateRank.js](../src/calculateRank.js)をご覧ください。_
|
||||
|
||||
### 特定の統計情報を隠す
|
||||
|
||||
クエリパラメータ `?hide=` に値をカンマ区切りで渡すことで、特定の統計情報を隠すことができます。
|
||||
|
||||
> Options: `&hide=stars,commits,prs,issues,contribs`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### プライベートリポジトリへのコミットをカウントする
|
||||
|
||||
クエリパラメータ `?count_private=true` を使用することで、プライベートリポジトリへのコミット数を総数に追加することができます。
|
||||
|
||||
_Note: このプロジェクトを自分でデプロイしている場合、デフォルトではプライベートリポジトリへのコミットがカウントされます。_
|
||||
|
||||
> Options: `&count_private=true`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### アイコンを表示する
|
||||
|
||||
クエリパラメータ `?show_icons=true` を使用することで、アイコンの表示が有効になります。
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### テーマの変更
|
||||
|
||||
内蔵されているテーマを使用すれば、[手動のカスタマイズ](#customization)を行うことなくカードの外観を変更することができます。
|
||||
|
||||
`?theme=THEME_NAME` は以下のように使います。
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
#### 内蔵テーマの一覧
|
||||
|
||||
dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula
|
||||
|
||||
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Stat Themes" width="600px"/>
|
||||
|
||||
その他の使用可能なテーマの[プレビュー](../themes/README.md)や[設定ファイル](../themes/index.js)もご覧ください。もしよろしければ、**新しいテーマを投稿してみてください** :smile:
|
||||
|
||||
### テーマを自分でカスタマイズする
|
||||
|
||||
`Stats Card` や `Repo Card` の外観を URL パラメータを使って好きなようにカスタマイズすることができます。
|
||||
|
||||
#### 共通のオプション
|
||||
|
||||
- `title_color` - タイトルの色 _(16 進数カラーコード)_
|
||||
- `text_color` - 中身のテキストの色 _(16 進数カラーコード)_
|
||||
- `icon_color` - アイコンの色(変更可能な場合のみ) _(16 進数カラーコード)_
|
||||
- `bg_color` - 背景の色 _(16 進数カラーコード)_ **または** _angle,start,end_ の形式でグラデーションを指定することも可
|
||||
- `hide_border` - カードの境界線を非表示にします _(ブール値)_
|
||||
- `theme` - [使用可能なテーマ一覧](../themes/README.md) から選んだテーマ名
|
||||
- `cache_seconds` - キャッシュ時間の秒数 _(最小値: 14400, 最大値: 86400)_
|
||||
- `locale` - カードに言語を設定する _(例えば cn, de, es, 等)_
|
||||
|
||||
##### bg_color の グラデーション指定
|
||||
|
||||
bg_color オプションで複数のカンマ区切りの値を指定してグラデーションをレンダリングすることができます。フォーマットは以下の通りになります。
|
||||
|
||||
```
|
||||
&bg_color=DEG,COLOR1,COLOR2,COLOR3...COLOR10
|
||||
```
|
||||
|
||||
> キャッシュに関する注意点: Repo cards のデフォルトのキャッシュは、フォーク数とスター数が 1k 未満の場合は 30 分(1800 秒) で、それ以外の場合は 2 時間(7200) です。また、キャッシュは最低でも 30 分、最大でも 24 時間に制限されていることに注意してください。
|
||||
|
||||
#### Stats Card だけに存在するオプション
|
||||
|
||||
- `hide` - 特定の統計情報を隠す _(カンマ区切りで指定)_
|
||||
- `hide_title` - _(boolean)_
|
||||
- `hide_rank` - _(boolean)_
|
||||
- `show_icons` - _(boolean)_
|
||||
- `include_all_commits` - 今年度のコミット数だけでなく、コミット数の総数をカウントする _(boolean)_
|
||||
- `count_private` - プライベートリポジトリへのコミットをカウントする _(boolean)_
|
||||
- `line_height` - テキストの行の高さ _(number)_
|
||||
- `custom_title` - タイトル文字列を変更する
|
||||
- `disable_animations` - カードのアニメーションを無効にする _(boolean)_
|
||||
|
||||
#### Repo Card だけに存在するオプション
|
||||
|
||||
- `show_owner` - リポジトリのオーナーを表示する _(boolean)_
|
||||
|
||||
#### Language Card だけに存在するオプション
|
||||
|
||||
- `hide` - 特定の言語を隠す _(カンマ区切りで指定)_
|
||||
- `hide_title` - _(boolean)_
|
||||
- `layout` - `normal` & `compact` & `donut` & `donut-vertical` & `pie` のいずれかのレイアウトに切り替える
|
||||
- `card_width` - カードの横幅 _(number)_
|
||||
- `langs_count` - 表示される言語の数 _(1 ~ 10, 初期値 5)_
|
||||
- `exclude_repo` - 指定されたリポジトリを除外する _(カンマ区切りで指定)_
|
||||
- `custom_title` - タイトル文字列を変更する
|
||||
|
||||
> :warning: **重要:**
|
||||
> [Percent Encoding](https://en.wikipedia.org/wiki/Percent-encoding) で指定されているように、プログラミング言語の名前は URL エンコードされている必要があります。
|
||||
> (例: `c++` は `c%2B%2B`, `jupyter notebook` は `jupyter%20notebook`, など)
|
||||
|
||||
---
|
||||
|
||||
# GitHub Extra Pins
|
||||
|
||||
GitHub extra pins を使うと、GitHub の readme プロフィールを使って、自分のプロフィールに 6 つ以上のリポジトリをピン留めすることができます。
|
||||
|
||||
やったー! もはや、リポジトリをピン留めできる数が 6 つに制限されることはありません。
|
||||
|
||||
### 使い方
|
||||
|
||||
以下のコードをあなたの readme にコピー & ペーストし、リンクを変更してください。
|
||||
|
||||
エンドポイント: `api/pin?username=anuraghazra&repo=github-readme-stats`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### デモ
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
リポジトリのオーナーのユーザー名を含める場合は、show_owner 変数を使用します。
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# Top Languages Card
|
||||
|
||||
Top languages card には、その GitHub ユーザーが最も利用している Top languages が表示されます。
|
||||
|
||||
_NOTE: Top languages は、ユーザのスキルレベルを示すものではなく、GitHub 上でどの言語で最も多くのコードを書いているかを示す GitHub の指標です。_
|
||||
|
||||
### 使い方
|
||||
|
||||
以下のコードをあなたの readme にコピー & ペーストし、リンクを変更してください。
|
||||
|
||||
エンドポイント: `api/top-langs?username=anuraghazra`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### 特定の言語を隠す
|
||||
|
||||
クエリパラメータ `?hide=language1,language2` 使用することで、特定の言語を非表示にすることができます。
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### レイアウトをコンパクトにする
|
||||
|
||||
クエリパラメータ `&layout=compact` を使用することで、カードのデザインを変更することができます。
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### デモ
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Compact layout の場合
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### 全てのデモ
|
||||
|
||||
- デフォルト
|
||||
|
||||

|
||||
|
||||
- 特定の統計情報を隠す
|
||||
|
||||

|
||||
|
||||
- アイコンを表示する
|
||||
|
||||

|
||||
|
||||
- コミット数の総数をカウントする
|
||||
|
||||

|
||||
|
||||
- テーマの変更
|
||||
|
||||
任意の[テーマ](#themes)を選択できます。
|
||||
|
||||

|
||||
|
||||
- グラデーション
|
||||
|
||||

|
||||
|
||||
- stats card のカスタマイズ
|
||||
|
||||

|
||||
|
||||
- repo card のカスタマイズ
|
||||
|
||||

|
||||
|
||||
- Top languages
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### クイックヒント (カードを並べる)
|
||||
|
||||
通常、画像を並べてレイアウトすることはできません。画像を並べるには、以下のような方法があります。
|
||||
|
||||
```html
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=convoychat" />
|
||||
</a>
|
||||
```
|
||||
|
||||
## 自分の Vercel インスタンスにデプロイする
|
||||
|
||||
#### [@codeSTACKr によるチュートリアルはこちら](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
GitHub API は 1 時間あたり 5k リクエストしか受け付けていないので、私の `https://github-readme-stats.vercel.app/api` がレートリミッターを超えてしまう可能性があります。自分の Vercel サーバーでホストしているのであれば、何も心配する必要はありません。デプロイボタンをクリックして始めましょう!
|
||||
|
||||
NOTE: [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) 以降は 5k 以上のリクエストに対応できるようになり、ダウンタイムの問題もなくなりました :smile:
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
<details>
|
||||
<summary>Vercelの設定ガイド</summary>
|
||||
|
||||
1. [vercel.com](https://vercel.com/)に行きます。
|
||||
1. `Log in`をクリックします。
|
||||

|
||||
1. `Continue with GitHub` を押して GitHub にサインインします。
|
||||

|
||||
1. GitHub にサインインし、すべてのリポジトリへのアクセスを許可します。
|
||||
1. このリポジトリをフォークします。
|
||||
1. [Vercel dashboard](https://vercel.com/dashboard)に戻ります。
|
||||
1. `Import Project` を選択します。
|
||||

|
||||
1. `Import Git Repository` を選択します。
|
||||

|
||||
1. root を選択して、すべてをそのままにしておき、PAT_1 という名前の環境変数を(下図のように)追加します。これには個人アクセストークン (PAT) が含まれており、[ここ](https://github.com/settings/tokens/new)で簡単に作成することができます (すべてをそのままにしておいて、何かに名前を付けてください。)
|
||||

|
||||
1. デプロイをクリックすれば完了です。API を使用するためにあなたのドメインを参照してください!
|
||||
|
||||
</details>
|
||||
|
||||
## :sparkling_heart: このプロジェクトを支援する
|
||||
|
||||
私はできる限りのことをオープンソースで行い、また、このプロジェクトを利用する上で困っている皆さん全員に返信するようにしています。もちろん返信には時間が掛かる場合がありますが。
|
||||
このプロジェクトは無料でご利用いただけます。
|
||||
|
||||
しかしながら、もしあなたがこのプロジェクトに満足しているのであれば、あるいはただ、私がソフトウェアを作り続けるよう励ましたいのであれば、いくつかの方法があります。
|
||||
|
||||
- あなたの readme で github-readme-stats を使用して適切なクレジットを付与し、それにリンクします :smile:
|
||||
- このプロジェクトにスターを贈り、他の人達にもシェアしてください :rocket:
|
||||
- [](https://www.paypal.me/anuraghazra) - PayPal を介して 1 回限りの寄付を行うことができます。私はおそらく ~~コーヒー~~ お茶を買うでしょう。 :tea:
|
||||
|
||||
Thanks! :heart:
|
||||
|
||||
---
|
||||
|
||||
[](https://vercel.com?utm_source=github_readme_stats_team&utm_campaign=oss)
|
||||
|
||||
コントリビュートは大歓迎です! :heart_eyes:
|
||||
|
||||
このプロジェクトは :heart: と JavaScript で作られています。
|
||||
@@ -1,456 +0,0 @@
|
||||
<p align="center">
|
||||
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
|
||||
<h2 align="center">GitHub Readme Stats</h2>
|
||||
<p align="center">동적으로 생성되는 GitHub 사용량 통계를 여러분의 README 에 추가해보세요!</p>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#미리보기">미리보기 확인</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">버그 제보하기</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">기능 추가 요청하기</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="/docs/readme_fr.md">Français </a>
|
||||
·
|
||||
<a href="/docs/readme_cn.md">简体中文</a>
|
||||
·
|
||||
<a href="/docs/readme_es.md">Español</a>
|
||||
·
|
||||
<a href="/docs/readme_de.md">Deutsch</a>
|
||||
·
|
||||
<a href="/docs/readme_ja.md">日本語</a>
|
||||
·
|
||||
<a href="/docs/readme_pt-BR.md">Português Brasileiro</a>
|
||||
·
|
||||
<a href="/docs/readme_it.md">Italiano</a>
|
||||
·
|
||||
<a href="/docs/readme_kr.md">한국어</a>
|
||||
.
|
||||
<a href="/docs/readme_nl.md">Nederlands</a>
|
||||
.
|
||||
<a href="/docs/readme_np.md">नेपाली</a>
|
||||
.
|
||||
<a href="/docs/readme_tr.md">Türkçe</a>
|
||||
</p>
|
||||
</p>
|
||||
<p align="center">기능들이 마음에 드시나요? 괜찮으시다면, 서비스 개선을 위해 <a href="https://www.paypal.me/anuraghazra">기부</a>를 고려해주세요!
|
||||
|
||||
# 기능들 <!-- omit in toc -->
|
||||
|
||||
- [GitHub 통계](#github-통계)
|
||||
- [개별 통계 숨기기](#개별-통계-숨기기)
|
||||
- [총 커밋 수에 비공개 기여도 (private contribs) 수 추가하기](#총-커밋-수에-비공개-기여도-private-contribs-수-추가하기)
|
||||
- [아이콘 표시하기](#아이콘-표시하기)
|
||||
- [테마 설정하기](#테마-설정하기)
|
||||
- [커스터마이징](#커스터마이징)
|
||||
- [GitHub 저장소 핀](#github-저장소-핀)
|
||||
- [사용법](#사용법)
|
||||
- [미리보기](#미리보기)
|
||||
- [언어 사용량 통계](#언어-사용량-통계)
|
||||
- [사용법](#사용법-1)
|
||||
- [통계에서 제외할 저장소 지정하기](#통계에서-제외할-저장소-지정하기)
|
||||
- [통계에서 특정 언어 제외하기](#통계에서-특정-언어-제외하기)
|
||||
- [표시할 언어 수 지정하기](#표시할-언어-수-지정하기)
|
||||
- [컴택트한 카드 레이아웃 설정하기](#컴택트한-카드-레이아웃-설정하기)
|
||||
- [미리보기](#미리보기-1)
|
||||
- [WakaTime 주간 통계](#wakatime-주간-통계)
|
||||
- [미리보기](#미리보기-2)
|
||||
- [전체 미리보기](#전체-미리보기)
|
||||
- [꿀팁 (저장소 핀 정렬하기)](#꿀팁-저장소-핀-정렬하기)
|
||||
- [나만의 Vercel 인스턴스에 직접 배포하기](#나만의-vercel-인스턴스에-직접-배포하기)
|
||||
- [:sparkling\_heart: 프로젝트 지원하기!](#sparkling_heart-프로젝트-지원하기)
|
||||
|
||||
|
||||
# GitHub 통계
|
||||
|
||||
아래 코드를 복사해서 마크다운 파일에 붙여넣으면 끝이에요, 아주 간단해요!
|
||||
|
||||
`?username=` 속성의 값을 GitHub 계정의 사용자 명(닉네임)으로 바꿔주세요.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
_참고:_
|
||||
|
||||
_랭크는 S+ (상위 1%), S (상위 25%), A++ (상위 45%), A+ (상위 60%), 그리고 B+ (전체) 로 구성되어 있습니다._
|
||||
|
||||
_커밋의 수(commits), 기여도(contribution), 이슈의 수(issues), 즐겨찾기(star), 작업내용 반영 요청(Pull Request),
|
||||
팔로워 수, 그리고 보유 중인 저장소 등의 항목들에 대해 [누적 분포 함수](https://ko.wikipedia.org/wiki/%EB%88%84%EC%A0%81_%EB%B6%84%ED%8F%AC_%ED%95%A8%EC%88%98) 를 이용해 계산됩니다._
|
||||
|
||||
_[src/calculateRank.js](../src/calculateRank.js) 에서 수행되는 계산 작업의 내용을 확인할 수 있습니다._
|
||||
|
||||
### 개별 통계 숨기기
|
||||
|
||||
특정 통계를 숨기려면 `콤마(,)`로 구분된 값들을 `?hide=` 속성의 값으로 넣어주세요.
|
||||
|
||||
> 사용 가능한 항목들: `&hide=stars,commits,prs,issues,contribs`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### 총 커밋 수에 비공개 기여도 (private contribs) 수 추가하기
|
||||
|
||||
`?count_private=true` 속성을 추가하시면, 여러분의 모든 비공개 기여도까지 반영됩니다.
|
||||
|
||||
_참고: 프로젝트를 직접 배포하신 경우, 비공개 기여도는 기본적으로 반영됩니다. 원하지 않는 경우엔 직접 설정해야 합니다._
|
||||
|
||||
> 예시: `&count_private=true`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### 아이콘 표시하기
|
||||
|
||||
아이콘 항목을 활성화 하기 위해선, 다음과 같이 `show_icons=true` 속성을 추가해주세요.
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### 테마 설정하기
|
||||
|
||||
내장 테마를 사용하시면, 별도의 [커스터마이징](#커스터마이징) 없이 GitHub 통계 카드를 꾸미실 수 있어요.
|
||||
|
||||
다음과 같이 `?theme=THEME_NAME` 속성을 이용해주세요.
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
#### 지원하는 내장 테마 목록
|
||||
|
||||
dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula
|
||||
|
||||
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Stat Themes" width="600px"/>
|
||||
|
||||
[사용 가능한 모든 테마](../themes/README.md) 에서 미리보기를 확인하실 수 있어요.
|
||||
|
||||
원하신다면 [테마 설정하기](../themes/index.js) 항목에서 **새로운 테마를 직접 만드실수 있어요.** :D
|
||||
|
||||
### 커스터마이징
|
||||
|
||||
여러가지 추가 속성을 통해, 원하는대로 `Stats Card` 또는 `Repo Card` 모양을 커스터마이징할 수 있어요.
|
||||
|
||||
#### 기본 옵션:
|
||||
|
||||
- `title_color` - 카드 타이틀 색상 _(hex color)_
|
||||
- `text_color` - 카드 본문 글씨 색상 _(hex color)_
|
||||
- `icon_color` - 아이콘 색상 (활성화된 경우) _(hex color)_
|
||||
- `bg_color` - 카드의 배경 색상 _(hex color)_ **혹은** 다음 양식으로 그라데이션 주기 _angle,start,end_
|
||||
- `hide_border` - 카드의 테두리 표시 여부 _(boolean)_
|
||||
- `theme` - 테마의 이름, [사용 가능한 모든 테마](../themes/README.md) 에서 선택
|
||||
- `cache_seconds` - 수동으로 캐시 헤더 설정 _(min: 14400, max: 86400)_
|
||||
- `locale` - 카드에 표시할 언어 _(e.g. kr, cn, de, es, etc.)_
|
||||
|
||||
##### 배경에 그라데이션 주기
|
||||
|
||||
그라데이션이 적용된 카드를 표시하고 싶으시다면, 여러가지 쉼표(,) 로 구분된 값을 추가할 수 있어요.
|
||||
|
||||
양식은 다음과 같습니다.
|
||||
|
||||
```
|
||||
&bg_color=DEG,COLOR1,COLOR2,COLOR3...COLOR10
|
||||
```
|
||||
|
||||
> 캐시에 대한 참고사항:
|
||||
> 포크와 스타 수가 1,000 개 미만인 저장소의 카드는 기본적으로 4시간 (14,400초) 으로 설정되어 있습니다.
|
||||
> 그 외에는, it's 2시간 (7,200초) 입니다. 또한, 캐시설정 시간의 범위는 최소 2시간, 최대 24시간입니다.
|
||||
|
||||
|
||||
#### 통계 카드의 표시 제한 옵션:
|
||||
|
||||
- `hide` - 통계에서 특정한 값 제외 _(Comma-separated values)_
|
||||
- `hide_title` - 타이틀 표시 여부 _(boolean)_
|
||||
- `hide_rank` - 랭크 표시 여부 _(boolean)_
|
||||
- `show_icons` - 아이콘 표시 여부 _(boolean)_
|
||||
- `include_all_commits` - 올해가 아닌 전체 연도에 대한 커밋 포함 여부 _(boolean)_
|
||||
- `count_private` - 비공개 기여도 포함 여부 _(boolean)_
|
||||
- `line_height` - 텍스트 간 줄 높이 설정(자간) _(number)_
|
||||
- `custom_title` - 카드의 타이틀 값 설정
|
||||
- `disable_animations` - 카드의 모든 에니메이션 활성 여부 _(boolean)_
|
||||
|
||||
#### 저장소 카드의 표시 제한 옵션:
|
||||
|
||||
- `show_owner` - 저장소 소유자 닉네임 표기 여부 _(boolean)_
|
||||
|
||||
#### 언어 사용량 통계 카드의 표시 제한 옵션:
|
||||
|
||||
- `hide` - 카드에서 특정 언어 제외 _(Comma-separated values)_
|
||||
- `hide_title` - 타이틀 제외 _(boolean)_
|
||||
- `layout` - 5가지 값 사용 가능, `normal` & `compact` & `donut` & `donut-vertical` & `pie` 중 표시 형태 선택
|
||||
- `card_width` - 카드 너비 직접 설정 _(number)_
|
||||
- `langs_count` - 카드에 표시할 언어의 수 (1-10 사이, 기본 값 : 5) _(number)_
|
||||
- `exclude_repo` - 통계에 제외할 저장소 지정 _(Comma-separated values)_
|
||||
- `custom_title` - 카드의 타이틀 값 설정
|
||||
|
||||
##### 경고! **매우 중요**
|
||||
>
|
||||
> 언어의 이름은 [퍼센트 인코딩](https://ko.wikipedia.org/wiki/%ED%8D%BC%EC%84%BC%ED%8A%B8_%EC%9D%B8%EC%BD%94%EB%94%A9) 에 지정된 URI 방식으로 표기되어야 합니다.
|
||||
> ( 예를 들면, `c++` 는 `c%2B%2B`, `jupyter notebook` 는 `jupyter%20notebook`, 등등. )
|
||||
> [urlencoder.org](https://www.urlencoder.org/) < 서비스를 이용하면 자동으로 생성할 수 있습니다.
|
||||
|
||||
#### WakaTime 카드의 표시 제한 옵션:
|
||||
|
||||
- `hide_title` - 타이틀 제외 _(boolean)_
|
||||
- `line_height` - 텍스트 간 줄 높이 설정(자간) _(number)_
|
||||
- `hide_progress` - 퍼센트와 표기바 표시 여부 _(boolean)_
|
||||
- `custom_title` - 카드의 타이틀 값 설정
|
||||
- `layout` - 사용 가능한 두 가지 값, `default` & `compact` 중 표시 형태 선택
|
||||
|
||||
---
|
||||
|
||||
# GitHub 저장소 핀
|
||||
|
||||
GitHub 저장소 여분 핀을 이용하면, 6개 이상의 저장소 핀을 여러분의 프로필에 추가할 수 있어요.
|
||||
|
||||
맞아요! 이제 6개 이상의 핀을 사용할 수 있어요! (핀이 부족할 일이 없답니다!)
|
||||
|
||||
### 사용법
|
||||
|
||||
이 코드를 복사해서 여러분의 README 에 넣고 링크를 변경해주세요.
|
||||
|
||||
엔드 포인트: `api/pin?username=anuraghazra&repo=github-readme-stats`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### 미리보기
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
[show_owner](#커스터마이징) 속성을 통해 저장소 소유자의 닉네임 표시 여부를 설정할 수 있어요.
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# 언어 사용량 통계
|
||||
|
||||
언어 사용량 통계 카드는 GitHub 사용자가 가장 많이 사용한 언어가 표시됩니다.
|
||||
|
||||
_참고:
|
||||
언어 사용량 통계는 GitHub 에서 가장 많이 사용된 언어의 표기일 뿐입니다.
|
||||
숙련도, 혹은 그와 비슷한 지표를 나타내진 않습니다. (새로 추가된 기능입니다!)_
|
||||
|
||||
### 사용법
|
||||
|
||||
이 코드를 복사해서 여러분의 README 에 넣고 링크를 변경해주세요.
|
||||
|
||||
엔드 포인트: `api/top-langs?username=anuraghazra`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### 통계에서 제외할 저장소 지정하기
|
||||
|
||||
`?exclude_repo=repo1,repo2` 속성을 통해 특정 저장소를 제외할 수 있어요.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### 통계에서 특정 언어 제외하기
|
||||
|
||||
`?hide=language1,language2` 속성을 통해 특정 언어를 제외할 수 있어요.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### 표시할 언어 수 지정하기
|
||||
|
||||
`&langs_count=` 속성을 통해 카드에 표시할 언어의 수를 지정할 수 있어요. (1-10 사이, 기본 값 : 5)
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### 컴택트한 카드 레이아웃 설정하기
|
||||
|
||||
`&layout=compact` 속성을 통해 카드의 디자인을 변경할 수 있어요.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### 미리보기
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- 컴팩트한 레이아웃
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# WakaTime 주간 통계
|
||||
|
||||
`?username=` 속성의 값을 [WakaTime](https://wakatime.com) 계정의 사용자 명(닉네임)으로 바꿔주세요.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### 미리보기
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- 컴팩트한 레이아웃
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### 전체 미리보기
|
||||
|
||||
- 기본
|
||||
|
||||

|
||||
|
||||
- 특정 통계 내용 숨김
|
||||
|
||||

|
||||
|
||||
- 아이콘 표시
|
||||
|
||||

|
||||
|
||||
- 전체 커밋 포함 시
|
||||
|
||||

|
||||
|
||||
- 테마들
|
||||
|
||||
[내장 테마](#themes) 에서 직접 선택해보세요
|
||||
|
||||

|
||||
|
||||
- 그라데이션 주기
|
||||
|
||||

|
||||
|
||||
- 통계 카드 커스터마이징하기
|
||||
|
||||

|
||||
|
||||
- 언어 사용 지역 설정하기
|
||||
|
||||

|
||||
|
||||
- 저장소 핀 커스터마이징하기
|
||||
|
||||

|
||||
|
||||
- 언어 사용량 통계
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- WakaTime 카드
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### 꿀팁 (저장소 핀 정렬하기)
|
||||
|
||||
아마, 이미지들을 나란히 정렬할 수 없을거에요.
|
||||
|
||||
그럴땐, 이렇게 해보세요!
|
||||
|
||||
```html
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=convoychat" />
|
||||
</a>
|
||||
```
|
||||
|
||||
## 나만의 Vercel 인스턴스에 직접 배포하기
|
||||
|
||||
#### [@codeSTACKr 님의 튜토리얼 영상 보기](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
GitHub API 가 시간 당 요청 개수를 5,000회로 제한한 뒤로,
|
||||
저의 `https://github-readme-stats.vercel.app/api` 가 사용량 제한에 걸릴 위험이 생겼어요.
|
||||
|
||||
만약, 여러분이 Vercel server 에서 직접 호스트 하신다면, 걱정하실 일은 없을거에요.
|
||||
|
||||
아래의 버튼을 이용해 직접 배포해보세요!
|
||||
|
||||
참고: [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) 풀 리퀘스트 이후로, 저희는 5,000 개 이상의 요청을 처리할 수 있게 됐어요. 더이상 서버 다운에 대한 걱정은 노놉! :D
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
<details>
|
||||
<summary><b> 🔨 Vercel 세팅 가이드! </b></summary>
|
||||
|
||||
1. [vercel.com](https://vercel.com/) 으로 이동하기
|
||||
1. `Log in` 버튼 클릭!
|
||||

|
||||
1. `Continue with GitHub` 버튼을 이용해 GitHub 계정으로 가입하기
|
||||

|
||||
1. GitHub 에 로그인한 뒤, (권한을 요청한다면) 모든 저장소에 대한 권한을 허용해주세요!
|
||||
1. 이 저장소를 Fork!
|
||||
1. [Vercel 대시보드](https://vercel.com/dashboard) 로 돌아가세요!
|
||||
1. `Import Project` 항목 선택!
|
||||

|
||||
1. `Import Git Repository` 항목 선택!
|
||||

|
||||
1. 'root' 를 선택하고 넘어간 후, 아래와 같이 개인용 엑세스 토큰 (PAT) 을 저장할 환경변수를 PAT_1 의 값으로 추가해주세요. [이 곳](https://github.com/settings/tokens/new)에서 쉽게 생성할 수 있어요. (모든 항목을 그대로 두고, 이 부분만 원하는 이름으로 변경해주세요.)
|
||||

|
||||
1. 마지막으로 'Deploy' 버튼을 클릭하면, 끝! => API 를 사용하기 위한 도메인 주소를 확인하세요!
|
||||
|
||||
</details>
|
||||
|
||||
## :sparkling_heart: 프로젝트 지원하기!
|
||||
|
||||
저는 가능한 모든 요소들을 오픈소스로 공개하고,
|
||||
이 서비스를 이용하는데 도움이 필요한 모두에게 도움을 드리려 노력하고 있어요.
|
||||
|
||||
솔직히 말하자면, 시간이 좀 걸린답니다...
|
||||
물론, 여러분이 이 서비스를 사용하는건 무료에요 ㅎ
|
||||
|
||||
하지만, 만약 여러분이 이 서비스를 잘 이용하시고,
|
||||
만족하시거나, 제가 이런 요소들을 만드는 데에 도움을 주고 싶으시다면,
|
||||
여러분께서 도와주실 수 있는 것들이 있어요!
|
||||
|
||||
- github-readme-stats 를 README 에 표시하실 때 확실한 도움을 주세요! 이 저장소로 링크를 걸어주시면 돼요! :D
|
||||
- 이 프로젝트를 많이 공유해주시고, 즐겨찾기 해주세요! :rocket:
|
||||
- [](https://www.paypal.me/anuraghazra) - PayPal 을 이용해 1회성 도네이션을 해주실 수 있어요. 아마도 전 ~~커피, 아... 아니~~ 차를 사서 마시겠죠? ㅎ; :tea:
|
||||
|
||||
감사합니다! :heart:
|
||||
|
||||
---
|
||||
|
||||
[](https://vercel.com?utm_source=github_readme_stats_team&utm_campaign=oss)
|
||||
|
||||
프로젝트에 대한 기여는 언제나 환영이에요! <3
|
||||
|
||||
Made with :heart: and JavaScript.
|
||||
@@ -1,424 +0,0 @@
|
||||
<p align="center">
|
||||
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
|
||||
<h2 align="center">GitHub Readme Stats</h2>
|
||||
<p align="center">Krijg dynamisch gegenereerde GitHub statistieken op je readme's!</p>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#demo">Bekijk Demo</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">Rapporteer een Bug</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">Vraag een nieuwe toepassing aan</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="/docs/readme_fr.md">Français </a>
|
||||
·
|
||||
<a href="/docs/readme_cn.md">简体中文</a>
|
||||
·
|
||||
<a href="/docs/readme_es.md">Español</a>
|
||||
·
|
||||
<a href="/docs/readme_de.md">Deutsch</a>
|
||||
·
|
||||
<a href="/docs/readme_ja.md">日本語</a>
|
||||
·
|
||||
<a href="/docs/readme_pt-BR.md">Português Brasileiro</a>
|
||||
·
|
||||
<a href="/docs/readme_it.md">Italiano</a>
|
||||
·
|
||||
<a href="/docs/readme_kr.md">한국어</a>
|
||||
.
|
||||
<a href="/docs/readme_nl.md">Nederlands</a>
|
||||
.
|
||||
<a href="/docs/readme_np.md">नेपाली</a>
|
||||
.
|
||||
<a href="/docs/readme_tr.md">Türkçe</a>
|
||||
</p>
|
||||
</p>
|
||||
<p align="center">Bevalt het project? <a href="https://www.paypal.me/anuraghazra">Doneer</a> om het te verbeteren!
|
||||
|
||||
# Functionaliteiten <!-- omit in toc -->
|
||||
|
||||
- [GitHub Statistieken Kaart](#github-statistieken-kaart)
|
||||
- [Verberg individueele statistieken](#verberg-individueele-statistieken)
|
||||
- [Voeg privé contributies toe aan totale commits.](#voeg-privé-contributies-toe-aan-totale-commits)
|
||||
- [Laat icoontjes zien](#laat-icoontjes-zien)
|
||||
- [Thema's](#themas)
|
||||
- [Opmaak](#opmaak)
|
||||
- [GitHub Extra Pins](#github-extra-pins)
|
||||
- [Gebruik](#gebruik)
|
||||
- [Demo](#demo)
|
||||
- [Top Programmeertalen Kaart](#top-programmeertalen-kaart)
|
||||
- [Gebruik](#gebruik-1)
|
||||
- [Verberg individueele repositories](#verberg-individueele-repositories)
|
||||
- [Verberg individueele talen](#verberg-individueele-talen)
|
||||
- [Laat meer programmeertalen zien](#laat-meer-programmeertalen-zien)
|
||||
- [Compacte Talen Kaart opmaak](#compacte-talen-kaart-opmaak)
|
||||
- [Demo](#demo-1)
|
||||
- [Wekelijkse WakaTime Statistieken](#wekelijkse-wakatime-statistieken)
|
||||
- [Demo](#demo-2)
|
||||
- [Alle demos](#alle-demos)
|
||||
- [Kleine tip (Verstel de repo kaart z'n positie)](#kleine-tip-verstel-de-repo-kaart-zn-positie)
|
||||
- [Deploy je eigen Vercel instatie](#deploy-je-eigen-vercel-instatie)
|
||||
- [:sparkling\_heart: Ondersteun het project](#sparkling_heart-ondersteun-het-project)
|
||||
|
||||
# GitHub Statistieken Kaart
|
||||
|
||||
Kopieer en plak dit in je markdown content, zo simpel is het!
|
||||
|
||||
Verander de waarde `?username=` naar jou gebruikersnaam.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
_Notitie: Beschikbare rangen zijn S+ (top 1%), S (top 25%), A++ (top 45%), A+ (top 60%), and B+ (iedereen).
|
||||
De waarden worden berekend met behulp van de zogeheten [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) met de waardes van de commits, bijdragens, issues, sterren, PR's, volgers en eigen repositories.
|
||||
De implementatie hiervan kan bekijken op [src/calculateRank.js](../src/calculateRank.js)_
|
||||
|
||||
### Verberg individueele statistieken
|
||||
|
||||
Om specifieke statistieken te verbergen, kan je een `?hide=` query parameter toevogen, verdeeld met komma\'s.
|
||||
|
||||
|
||||
> Opties: `&hide=stars,commits,prs,issues,contribs`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Voeg privé contributies toe aan totale commits.
|
||||
|
||||
Je kan de hoeveelheid privé commits toevoegen aan je totale hoeveelheid commits door de query parameter `?count_private=true` te gebruiken.
|
||||
|
||||
_Notitie: Als je dit project zelf deployt, zullen de privé contributies standaard toegevoegt worden aan je totaal, omdat anders je hoeveelheid privé contributies moet delen._
|
||||
|
||||
> Opties: `&count_private=true`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Laat icoontjes zien
|
||||
|
||||
Om icoontjes te gebruiken kan je `show_icons=true` gebruiken in de query parameter, zoals hier:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Thema\'s
|
||||
|
||||
Met ingebouwde thema\'s kan je het uiterlijk van de kaart aanpassen zonder enige [handmatige opmaak](#customization).
|
||||
|
||||
Gebruik `?theme=THEME_NAME` parameters zo :-
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
#### Alle ingeboude thema\'s :-
|
||||
|
||||
dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula
|
||||
|
||||
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Statestieken Thema's" width="600px"/>
|
||||
|
||||
Je kan een preview van alle [beschikbare thema\'s](../themes/README.md) bekijken, of zie het [thema configuratie bestand](../themes/index.js) en **je kan aan nieuwe thema\'s bijdragen** als je dat leuk lijkt :D
|
||||
|
||||
### Opmaak
|
||||
|
||||
Je kan het uiterlijk van je `Statistieken kaart` of `Repo kaart` aanpassen hoe je ook maar wilt met URL parameters.
|
||||
|
||||
#### Veel gebruikte opties:
|
||||
|
||||
- `title_color` - De kleur van de titel van de kaart _(hex kleur)_
|
||||
- `text_color` - Tekst kleur _(hex kleur)_
|
||||
- `icon_color` - Icoon kleuren, wanneer beschikbaar _(hex kleur)_
|
||||
- `bg_color` - Achtergrond kleur van de kaart _(hex kleur)_ **of** een verloop van kleuren in het formaat van _graden,start,einde_
|
||||
- `hide_border` - Verbergt de rand van de kaart _(boolean)_
|
||||
- `theme` - Naam van het thema, kies uit [alle beschikbare thema\'s](../themes/README.md)
|
||||
- `cache_seconds` - Stel de cache header handmatig in _(min: 14400, max: 86400)_
|
||||
- `locale` - Stel taal van de kaart in _(e.g. cn, de, es, etc.)_
|
||||
|
||||
##### Kleurenverloop in bg_color (achtergrond kleur):
|
||||
|
||||
Je kan meerdere komma verdeelde waarden in de bg_color optie geven om een kleurenverloop te creeëren, het formaat van het kleurenverloop is:-
|
||||
|
||||
```
|
||||
&bg_color=GRADEN,KLEUR1,KLEUR2,KLEUR3...KLEUR10
|
||||
```
|
||||
|
||||
> Notities i.v.b.m. cache: Repo kaarten hebben een standaard cache van 4 uur (14400 seconden) als de fork hoeveelheid en de star hoeveelheid minder is dan 1k, anders is het 2 uur (7200 seconden). Daarnaast ligt de cache vast aan een minimum van 2 uur en een maximum van 24 uur.
|
||||
|
||||
#### Exclusieve opties voor Statistieken Kaart:
|
||||
|
||||
- `hide` - Verbergt gespecificeerde items van de statistieken. _(komma gescheiden waardes)_
|
||||
- `hide_title` - _(boolean)_
|
||||
- `hide_rank` - _(boolean)_
|
||||
- `show_icons` - _(boolean)_
|
||||
- `include_all_commits` - Tel alle commits inplaats van alleen de commits van het huidige jaar _(boolean)_
|
||||
- `count_private` - Tel privé commits mee _(boolean)_
|
||||
- `line_height` - Stel de lijn-hoogte tussen text in _(nummer)_
|
||||
- `custom_title` - Stel een aangepaste titel voor je kaart in
|
||||
|
||||
#### Exclusieve opties voor Repo Kaart:
|
||||
|
||||
- `show_owner` - Laat de eigenaar van de repo zien _(boolean)_
|
||||
|
||||
#### Exclusieve opties voor Programmeertaal Kaart:
|
||||
|
||||
- `hide` - Verbergt specifieke talen van de kaart _(komma gescheiden waardes)_
|
||||
- `hide_title` - _(boolean)_
|
||||
- `layout` - Kies uit de vijf beschikbare lay-outs `normal` & `compact` & `donut` & `donut-vertical` & `pie`
|
||||
- `card_width` - Stelt de breedte van de kaart handmatig in. _(nummer)_
|
||||
- `langs_count` - Laat meer talen op de kaart zien, waarde tussen 1-10, staat standaard op to 5 _(nummer)_
|
||||
- `exclude_repo` - Verbergt specifieke repositories _(komma gescheiden waardes)_
|
||||
- `custom_title` - Stelt een eigen titel voor de kaart in
|
||||
|
||||
> :Waarschuwing: **Belangrijk:**
|
||||
> Namen van programmeertalen moeten worden geuri-escaped, zoals gespecificeerd in [Percent Encoding](https://en.wikipedia.org/wiki/Percent-encoding)
|
||||
> (Oftewel: `c++` moet `c%2B%2B` worden, `jupyter notebook` moet `jupyter%20notebook` worden, enzovoort...)
|
||||
> Zie [urlencoder.org](https://www.urlencoder.org/) om dit automatisch te doen.
|
||||
|
||||
#### Exclusieve opties voor WakaTime Kaart:
|
||||
|
||||
- `hide_title` - _(boolean)_
|
||||
- `line_height` - Verandert de lijn hoogte tussen tekst _(nummer)_
|
||||
- `hide_progress` - Verbergt de progressiebalk en het percentage _(boolean)_
|
||||
- `custom_title` - Stelt een eigen titel voor de kaart in
|
||||
- `layout` - Schakel tussen de twee beschikbare lay-outs `default` en `compact`
|
||||
|
||||
---
|
||||
|
||||
# GitHub Extra Pins
|
||||
|
||||
GitHub extra pins geven je de mogelijkheid om meer dan 6 repositories op je profiel te pinnen, doormiddel van een GitHub readme profile.
|
||||
|
||||
Joepie! Je bent niet langer aan 6 pins gelimiteerd!
|
||||
|
||||
### Gebruik
|
||||
|
||||
Kopieer en plak deze code in je readme en verander de links.
|
||||
|
||||
Eindpunt: `api/pin?username=anuraghazra&repo=github-readme-stats`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
Gebruikt [show_owner](#customization) variabele om de repo\'s eigenaar toe te voegen
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# Top Programmeertalen Kaart
|
||||
|
||||
De top programmeertalen kaart laat zien welke talen een GitHub gebruiker het meest gebruikt.
|
||||
|
||||
_Notitie: Top programmeertalen wijzen niet op een vaardigheids niveau, het is puur een GitHub metriek over welke talen de meeste code op GitHub hebben. Het is een nieuwe funktie van github-readme-stats._
|
||||
|
||||
### Gebruik
|
||||
|
||||
Kopieer en plak deze code in je readme en verander de links.
|
||||
|
||||
|
||||
Eindpunt: `api/top-langs?username=anuraghazra`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Verberg individueele repositories
|
||||
|
||||
Je kan de parameter `?exclude_repo=repo1,repo2` gebruiken om individueele repositories te verbergen.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Verberg individueele talen
|
||||
|
||||
Je kan de `?hide=taal1,taal2` parameter gebruiken om individuele programmeer talen te verbergen.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Laat meer programmeertalen zien
|
||||
|
||||
Je kan de `&langs_count=` optie gebruiken om de hoeveelheid talen op je kaart groter en kleiner te maken. Geldige waardes zijn tussen de 1 en 10 (inclusief), en de standaard waarde is 5.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Compacte Talen Kaart opmaak
|
||||
|
||||
Je kan de `&layout=compact` optie gebruiken om het kaart ontwerp aan te passen.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Compacte opmaak
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# Wekelijkse WakaTime Statistieken
|
||||
|
||||
Verander de `?username=` waarde naar je [WakaTime](https://wakatime.com) gebruikersnaam.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Alle demos
|
||||
|
||||
- Standaard
|
||||
|
||||

|
||||
|
||||
- Verberg specifieke statestieken
|
||||
|
||||

|
||||
|
||||
- Weergeef icoontjes
|
||||
|
||||

|
||||
|
||||
- Voeg alle commits toe
|
||||
|
||||

|
||||
|
||||
- Thema\'s
|
||||
|
||||
Kies uit de [standaard thema\'s](#themes)
|
||||
|
||||

|
||||
|
||||
- Kleurenverloop
|
||||
|
||||

|
||||
|
||||
- Pas statistieken kaart aan
|
||||
|
||||

|
||||
|
||||
- Stel je kaart locale (taal) in
|
||||
|
||||

|
||||
|
||||
- Pas repo kaart aan.
|
||||
|
||||

|
||||
|
||||
- Top programmeertalen
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- WakaTime kaart
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Kleine tip (Verstel de repo kaart z\'n positie)
|
||||
|
||||
Meestal kan je de afbeeldingen niet naast elkaar zetten, op deze manier wel:
|
||||
|
||||
```html
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=convoychat" />
|
||||
</a>
|
||||
```
|
||||
|
||||
## Deploy je eigen Vercel instatie
|
||||
|
||||
#### [Check de stapsgewijze video tutorial door @codeSTACKr (In het Engels)](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
Sinds de GitHub API alleen maar 5k verzoeken per uur toestaat, zou mijn `https://github-readme-stats.vercel.app/api` mogelijk de rate limiet behalen. Als je het op je eigen Vercel server host, dan hoef je je nergens zorgen om te maken. Klik op de deploy knop om te beginnen!
|
||||
|
||||
NOTITIE: Sinds [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) zouden we geen problemen meer moeten hebben de 5k verzoeken per uur, en verdere downtime :D
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
<details>
|
||||
<summary><b>Versel deploy gids: 🔨 </b></summary>
|
||||
|
||||
1. Ga naar [vercel.com](https://vercel.com/)
|
||||
2. Klik op `Log in`
|
||||

|
||||
3. Meld je aan met GitHub door op `Continue with GitHub` te klikken.
|
||||

|
||||
4. Log in op GitHub en sta toegang tot alle repositories toe, wanneer dat gevraagt wordt.
|
||||
5. Fork deze repo
|
||||
6. Ga terug naar je [Vercel dashboard](https://vercel.com/dashboard)
|
||||
7. Selecteer `Import Project`
|
||||

|
||||
8. Selecteer `Import Git Repository`
|
||||

|
||||
9. Selecteer root en hou alles zoals het is, voeg alleen je environment variable genaamd PAT_1 toe (Zoals hier late zien word), die beheert over een persoonlijke toegangs token (PAT), die je gemakklijk [hier](https://github.com/settings/tokens/new) gemakkelijk kan creeëren. (Laat alles zoals het is, noem het maar iets, mag alles zijn.)
|
||||

|
||||
10. Klik deploy, en alles zou moeten werken. Zie je domein om de api te gebruiken!
|
||||
|
||||
</details>
|
||||
|
||||
## :sparkling_heart: Ondersteun het project
|
||||
|
||||
Ik maak bijna alles open-source wat ik kan, en ik probeer iedereen te helpen die deze projecten gebruiken. Natuurlijk kost dit tijd, je mag deze services gratis gebruiken.
|
||||
|
||||
Hoe dan ook, als je dit project gebruikt en er blij mee bent, of mij wilt aanmoedigen om dingen te blijven maken, zijn er een paar manieren om dit te doen; -
|
||||
|
||||
- Credits geven aan github-readme-stats op je readme, die terug naar het project linkt :D
|
||||
- Sterren en delen van het project :rocket:
|
||||
- [](https://www.paypal.me/anuraghazra) - Je kan eenmalig giften via PayPal, ik koop er waarschijnlijk ~~koffie~~ thee van. :tea:
|
||||
|
||||
Bedankt! :heart:
|
||||
|
||||
---
|
||||
|
||||
[](https://vercel.com?utm_source=github_readme_stats_team&utm_campaign=oss)
|
||||
|
||||
Contributies zijn welkom! <3
|
||||
|
||||
Gemaakt met :heart: en JavaScript.
|
||||
@@ -1,422 +0,0 @@
|
||||
<p align="center">
|
||||
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
|
||||
<h2 align="center">GitHub Readme Stats</h2>
|
||||
<p align="center">पहुनु होस् द्य्नामिचल्ली गेनेरटे गितहब रेअडमी सतत </p>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#demo">डेमो हेर्नुहोस्</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">रिपोर्ट बग</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">अनुरोध सुविधा</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="/docs/readme_fr.md">Français </a>
|
||||
·
|
||||
<a href="/docs/readme_cn.md">简体中文</a>
|
||||
·
|
||||
<a href="/docs/readme_es.md">Español</a>
|
||||
·
|
||||
<a href="/docs/readme_de.md">Deutsch</a>
|
||||
·
|
||||
<a href="/docs/readme_ja.md">日本語</a>
|
||||
·
|
||||
<a href="/docs/readme_pt-BR.md">Português Brasileiro</a>
|
||||
·
|
||||
<a href="/docs/readme_it.md">Italiano</a>
|
||||
·
|
||||
<a href="/docs/readme_kr.md">한국어</a>
|
||||
.
|
||||
<a href="/docs/readme_nl.md">Nederlands</a>
|
||||
·
|
||||
<a href="/docs/readme_np.md">नेपाली</a>
|
||||
.
|
||||
<a href="/docs/readme_tr.md">Türkçe</a>
|
||||
</p>
|
||||
</p>
|
||||
<p align="center">परियोजना मनपर्यो? तपाईं मद्दत गर्न सक्नुहुन्छ <a href="https://www.paypal.me/anuraghazra">यो परियोजना</a> बढ्न
|
||||
|
||||
# विशेषताहरु <!-- omit in toc -->
|
||||
|
||||
- [गितहब स्टेट कार्ड](#गितहब-स्टेट-कार्ड)
|
||||
- [लुकाउनु होस् व्यक्तिगत स्टेट](#लुकाउनु-होस्-व्यक्तिगत-स्टेट)
|
||||
- [जोड्नु होस् निजी टोटल योगदान](#जोड्नु-होस्-निजी-टोटल--योगदान)
|
||||
- [देखाउनु होस् इकोन](#देखाउनु-होस्-इकोन)
|
||||
- [विषयवस्तुहरू](#विषयवस्तुहरू)
|
||||
- [अनुकूलन](#अनुकूलन)
|
||||
- [गितहब अतिरिक्त पिन्स](#गितहब-अतिरिक्त-पिन्स)
|
||||
- [प्रयोग](#प्रयोग)
|
||||
- [डेमो](#डेमो)
|
||||
- [टोप भाषा कार्ड](#टोप-भाषा-कार्ड)
|
||||
- [प्रयोग](#प्रयोग-1)
|
||||
- [Exclude individual repositories](#exclude-individual-repositories)
|
||||
- [कुनै भाषा चुपौनॆ तरिका](#कुनै-भाषा-चुपौनॆ-तरिका)
|
||||
- [धेरॆ भाषाहरु हेर्नको लागि](#धेरॆ-भाषाहरु-हेर्नको-लागि)
|
||||
- [कम्प्याक्ट भाषा कार्ड ळयोउत](#कम्प्याक्ट-भाषा-कार्ड-ळयोउत)
|
||||
- [डेमो](#डेमो-1)
|
||||
- [वाका समय वीक स्तट्स](#वाका-समय-वीक-स्तट्स)
|
||||
- [डेमो](#डेमो-2)
|
||||
- [सबै डेमोहरु](#सबै-डेमोहरु)
|
||||
- [टिप् (रेपो कार्डलाए अलिग्न गर्ने )](#टिप्--रेपो-कार्डलाए-अलिग्न-गर्ने-)
|
||||
- [देप्लोय आफ्नै वेर्चेल इन्स्तंस](#देप्लोय--आफ्नै--वेर्चेल--इन्स्तंस)
|
||||
- [:sparkling\_heart: सहपोर्ट द प्रोजेक्ट](#sparkling_heart-सहपोर्ट-द-प्रोजेक्ट)
|
||||
|
||||
# गितहब स्टेट कार्ड
|
||||
|
||||
Copy-paste this into your markdown content, and that's it. Simple!
|
||||
|
||||
Change the `?username=` value to your GitHub's username.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
_Note: Ranks are calculated based on user's stats, see [src/calculateRank.js](./src/calculateRank.js)_
|
||||
|
||||
### लुकाउनु होस् व्यक्तिगत स्टेट
|
||||
|
||||
To hide any specific stats, you can pass a query parameter `?hide=` with comma-separated values.
|
||||
|
||||
> Options: `&hide=stars,commits,prs,issues,contribs`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### जोड्नु होस् निजी टोटल योगदान
|
||||
|
||||
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._
|
||||
|
||||
> Options: `&count_private=true`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### देखाउनु होस् इकोन
|
||||
|
||||
To enable icons, you can pass `show_icons=true` in the query param, like so:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### विषयवस्तुहरू
|
||||
|
||||
With inbuilt themes, you can customize the look of the card without doing any [manual customization](#customization).
|
||||
|
||||
Use `?theme=THEME_NAME` parameter like so :-
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
#### सबै इनबिल्ट विषयवस्तु :-
|
||||
|
||||
dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula
|
||||
|
||||
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Stat Themes" width="600px"/>
|
||||
|
||||
|
||||
तपैले सबै थेम्सहरु प्रेविउ गर्न सक्नु हुनेछ । [all available themes](./themes/README.md) नत्र थेम्सहरुको config [theme config file](./themes/index.js) पनि हेर्न सक्नु हुनेछ र **थेम्सहरुमा योगदान पनि गर्नु सक्नु हुनेछ** :D ।
|
||||
|
||||
### अनुकूलन
|
||||
|
||||
तपैले `Stats Card` or `Repo Card` को अपपेअरंस कस्टमेज गर्न सक्नु हुनेछ जसमा तपैले URL params पनि प्रयोग गर्नु सक्नु हुनेछ ।
|
||||
|
||||
#### साधारण विकल्पहरू:
|
||||
|
||||
- `title_color` - Card's title color _(hex color)_
|
||||
- `text_color` - Body text color _(hex color)_
|
||||
- `icon_color` - Icons color if available _(hex color)_
|
||||
- `bg_color` - Card's background color _(hex color)_ **or** a gradient in the form of _angle,start,end_
|
||||
- `hide_border` - Hides the card's border _(boolean)_
|
||||
- `theme` - name of the theme, choose from [all available themes](./themes/README.md)
|
||||
- `cache_seconds` - set the cache header manually _(min: 14400, max: 86400)_
|
||||
- `locale` - set the language in the card _(e.g. cn, de, es, etc.)_
|
||||
|
||||
##### Gradient in bg_color
|
||||
|
||||
You can provide multiple comma-separated values in bg_color option to render a gradient, the format of the gradient is :-
|
||||
|
||||
```
|
||||
&bg_color=DEG,COLOR1,COLOR2,COLOR3...COLOR10
|
||||
```
|
||||
|
||||
> Note on cache: Repo cards have a default cache of 4 hours (14400 seconds) if the fork count & star count is less than 1k, otherwise, it's 2 hours (7200 seconds). Also, note that the cache is clamped to a minimum of 2 hours and a maximum of 24 hours
|
||||
|
||||
#### Stats कार्ड विशेष विकल्पहरू:
|
||||
|
||||
- `hide` - Hides the specified items from stats _(Comma-separated values)_
|
||||
- `hide_title` - _(boolean)_
|
||||
- `hide_rank` - _(boolean)_
|
||||
- `show_icons` - _(boolean)_
|
||||
- `include_all_commits` - Count total commits instead of just the current year commits _(boolean)_
|
||||
- `count_private` - Count private commits _(boolean)_
|
||||
- `line_height` - Sets the line-height between text _(number)_
|
||||
- `custom_title` - Sets a custom title for the card
|
||||
|
||||
#### Repo कार्ड विशेष विकल्पहरू:
|
||||
|
||||
- `show_owner` - Show the owner name of the repo _(boolean)_
|
||||
|
||||
#### भाषा कार्ड अनन्य विकल्पहरू :
|
||||
|
||||
- `hide` - Hide the languages specified from the card _(Comma-separated values)_
|
||||
- `hide_title` - _(boolean)_
|
||||
- `layout` - Switch between five available layouts `normal` & `compact` & `donut` & `donut-vertical` & `pie`. Default: `normal`.
|
||||
- `card_width` - Set the card's width manually _(number)_
|
||||
- `langs_count` - Show more languages on the card, between 1-10, defaults to 5 _(number)_
|
||||
- `exclude_repo` - Exclude specified repositories _(Comma-separated values)_
|
||||
- `custom_title` - Sets a custom title for the card
|
||||
|
||||
> :warning: **Important:**
|
||||
> Language names should be uri-escaped, as specified in [Percent Encoding](https://en.wikipedia.org/wiki/Percent-encoding)
|
||||
> (i.e: `c++` should become `c%2B%2B`, `jupyter notebook` should become `jupyter%20notebook`, etc.)
|
||||
|
||||
#### वकासमय कार्ड विशेष विकल्प:
|
||||
|
||||
- `hide_title` - _(boolean)_
|
||||
- `line_height` - Sets the line-height between text _(number)_
|
||||
- `hide_progress` - Hides the progress bar and percentage _(boolean)_
|
||||
- `custom_title` - Sets a custom title for the card
|
||||
|
||||
---
|
||||
|
||||
# गितहब अतिरिक्त पिन्स
|
||||
|
||||
GitHub extra pins allow you to pin more than 6 repositories in your profile using a GitHub readme profile.
|
||||
|
||||
GitHub फाल्तु पिनले तपाइँलाए GitHub रीडमी प्रोफाइल प्रयोग गरी तपाइँको प्रोफाइलमा छ ओटा भन्दा बढि प्रोजेक्टहरु पिन गर्न अनुमति दिन्छ ।
|
||||
|
||||
हो! तपाईं अब pin पिन गरीएको छ ओटा प्रोजेक्ट सीमित हुनुहुन्छ ।
|
||||
|
||||
### प्रयोग
|
||||
|
||||
कोदलाए कपी- पेसेत readme मा गर्नु होला र लिंक परिवतन गर्नु होला |
|
||||
|
||||
Endpoint: `api/pin?username=anuraghazra&repo=github-readme-stats`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### डेमो
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
Use [show_owner](#customization) variable to include the repo's owner username
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# टोप भाषा कार्ड
|
||||
|
||||
टोप भाषाकार्डले github परयोग गर्नेहरुको प्रोग्रम्मिंग भाषाहरु देखाऊने गर्दछ |.
|
||||
|
||||
_NOTE: टोप भाषाहरुले आफ्नो सिपलाए संकेत गरेको होईन | योचै GitHub Metricबाट धेरै कुन भाषा परयोग भाकोलाए संकेत गरेको हो |
|
||||
### प्रयोग
|
||||
|
||||
कोदलाए कपी- पेसेत readme मा गर्नु होला र लिंक परिवतन गर्नु होला |
|
||||
|
||||
Endpoint: `api/top-langs?username=anuraghazra`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Exclude individual repositories
|
||||
|
||||
You can use `?exclude_repo=repo1,repo2` parameter to exclude individual repositories.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### कुनै भाषा चुपौनॆ तरिका
|
||||
|
||||
You can use `?hide=language1,language2` parameter to hide individual languages.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### धेरॆ भाषाहरु हेर्नको लागि
|
||||
|
||||
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
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### कम्प्याक्ट भाषा कार्ड ळयोउत
|
||||
|
||||
तपाइले `&layout=compact` ओप्तिओनपनि कार्ड देसिग्न को लागि परहयोग गर्न सक्नु हुन्क्ष
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### डेमो
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Compact layout
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# वाका समय वीक स्तट्स
|
||||
|
||||
Change the `?username=` value to your [WakaTime](https://wakatime.com) username.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### डेमो
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### सबै डेमोहरु
|
||||
|
||||
- देफौल्ट
|
||||
|
||||

|
||||
|
||||
- हिदिंग स्पेचific स्तट्स
|
||||
|
||||

|
||||
|
||||
- इकोनहरु शो गर्ने
|
||||
|
||||

|
||||
|
||||
- सबै कमितहरु
|
||||
|
||||

|
||||
|
||||
- थेम्स
|
||||
|
||||
कुनै एउटा चोज गर्नुस [default themes](#themes)
|
||||
|
||||

|
||||
|
||||
- घ्रदिएन्त
|
||||
|
||||

|
||||
|
||||
- स्तत्स कार्ड लाए कस्तोमेज गर्ने
|
||||
|
||||

|
||||
|
||||
- सेत्तिंग कार्ड लोचले
|
||||
|
||||

|
||||
|
||||
- रेपो कार्डलाई एडित गर्नु
|
||||
|
||||

|
||||
|
||||
- टोप भाषा
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- वक समय कार्ड
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### टिप् (रेपो कार्डलाए अलिग्न गर्ने )
|
||||
|
||||
तपाइले इमेजलाई सइद बय सइद अलीग्न गर्न सक्नु हुदैन तेसैले येसरी गर्नु होस् :
|
||||
|
||||
```html
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=convoychat" />
|
||||
</a>
|
||||
```
|
||||
|
||||
## देप्लोय आफ्नै वेर्चेल इन्स्तंस
|
||||
|
||||
#### [Check Out Step By Step Video Tutorial By @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
गितहब को अपिएले पाच हजार रेक़ुएस्त प्रति घण्टा मात्र मिल्क्ष । मेरो
|
||||
`https://github-readme-stats.vercel.app/api` प्रोजेक्ट मा रेत् लिमिट हुन सक्क्ष । तर तपाइले आफ्नै वेर्चेल सेर्वेर मा होस्ट गर्नु बाको छ बने यो प्रोब्लेम हुदैन।
|
||||
होस्ट गर्ने तरिका यस पकारका षन ।
|
||||
|
||||
NOTE: Since [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) we should be able to handle more than 5k requests and have no issues with downtime :D
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
<details>
|
||||
<summary><b> Guide on setting up Vercel 🔨 </b></summary>
|
||||
|
||||
1. Go to [vercel.com](https://vercel.com/)
|
||||
1. Click on `Log in`
|
||||

|
||||
1. Sign in with GitHub by pressing `Continue with GitHub`
|
||||

|
||||
1. Sign into GitHub and allow access to all repositories, if prompted
|
||||
1. Fork this repo
|
||||
1. Go back to your [Vercel dashboard](https://vercel.com/dashboard)
|
||||
1. Select `Import Project`
|
||||

|
||||
1. Select `Import Git Repository`
|
||||

|
||||
1. Select root and keep everything as is, just add your environment variable named PAT_1 (as shown), which will contain a personal access token (PAT), which you can easily create [here](https://github.com/settings/tokens/new) (leave everything as is, just name it something, it can be anything you want)
|
||||

|
||||
1. Click deploy, and you're good to go. See your domains to use the API!
|
||||
|
||||
</details>
|
||||
|
||||
## :sparkling_heart: सहपोर्ट द प्रोजेक्ट
|
||||
|
||||
म सके सम्म आफ्नो प्रोजेक्ट हरु ओपेन्सोउर्चे गर्छु र अरु ले पनि सहयोग गर्क्षु । मेले सहयोग गर्दा आफ्नो समय पनि देरै ने दिन्क्षु । तपाइहरु ले यो सेर्विचेस फ्री मा चलाउनु सक्नु हुनेक्ष ।
|
||||
|
||||
येदि तपाइले यो प्रोजेक्ट चलाउनु बाकोक्ष बने र मलाई अझै प्रसंसा गर्ने हो बने तपाइले थुप्रै तरिका ले गर्नु सक्नु हुने छ :-
|
||||
|
||||
- यो प्रोजेक्टमा तपाइले प्रहयोग गर्दा मलाई क्रेडिट दिन सक्नु हुनेक्ष ।
|
||||
- तपाइले GitHub ReadMe Stats स्तार्रेड गर्न सक्नु हुनेक्ष :rocket:
|
||||
- [](https://www.paypal.me/anuraghazra) - तपाइले पेपाल बाट पनि सहयोग (डक्क्षिन) गर्न सक्नु हुनेक्ष | म ~~कोफी ~~ चिया . :tea: किन्न सक्क्षु ।
|
||||
|
||||
धन्याबाद! :heart:
|
||||
|
||||
---
|
||||
|
||||

|
||||
|
||||
योगधन को लागी स्वगत छ! <3
|
||||
|
||||
जाभास्क्रिप्ट बाटा बनको :heart:
|
||||
@@ -1,372 +0,0 @@
|
||||
<p align="center">
|
||||
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
|
||||
<h2 align="center">GitHub Readme Stats</h2>
|
||||
<p align="center">Adicione suas estatísticas no GitHub geradas dinamicamente em seus readmes!</p>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Testes aprovados" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#demonstração">Ver demonstração</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">Reportar erros</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">Solicitar recursos</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="/docs/readme_fr.md">Français</a>
|
||||
·
|
||||
<a href="/docs/readme_cn.md">简体中文</a>
|
||||
·
|
||||
<a href="/docs/readme_es.md">Español</a>
|
||||
·
|
||||
<a href="/docs/readme_de.md">Deutsch</a>
|
||||
·
|
||||
<a href="/docs/readme_ja.md">日本語</a>
|
||||
·
|
||||
<a href="/docs/readme_pt-BR.md">Português Brasileiro</a>
|
||||
·
|
||||
<a href="/docs/readme_it.md">Italiano</a>
|
||||
·
|
||||
<a href="/docs/readme_kr.md">한국어</a>
|
||||
.
|
||||
<a href="/docs/readme_nl.md">Nederlands</a>
|
||||
.
|
||||
<a href="/docs/readme_np.md">नेपाली</a>
|
||||
.
|
||||
<a href="/docs/readme_tr.md">Türkçe</a>
|
||||
</p>
|
||||
</p>
|
||||
<p align="center">Gostou do projeto? Por favor considere <a href="https://www.paypal.me/anuraghazra">fazer uma doação</a> para ajudar a melhorá-lo!
|
||||
|
||||
# Características <!-- omit in toc -->
|
||||
|
||||
- [Cartão de estatísticas do GitHub](#cartão-de-estatísticas-do-github)
|
||||
- [Ocultando estatísticas específicas](#ocultando-estatísticas-específicas)
|
||||
- [Adicionando contagem de contribuições privadas à contagem total de commits](#adicionando-contagem-de-contribuições-privadas-à-contagem-total-de-commits)
|
||||
- [Exibindo ícones](#exibindo-ícones)
|
||||
- [Temas](#temas)
|
||||
- [Personalização](#personalização)
|
||||
- [Pins extras do GitHub](#pins-extras-do-github)
|
||||
- [Utilização](#utilização)
|
||||
- [Demonstração](#demonstração)
|
||||
- [Cartão de principais linguagens de programação](#cartão-de-principais-linguagens-de-programação)
|
||||
- [Utilização](#utilização-1)
|
||||
- [Ocultar linguagens individualmente](#ocultar-linguagens-individualmente)
|
||||
- [Layout de cartão de linguagens compacto](#layout-de-cartão-de-linguagens-compacto)
|
||||
- [Demonstração](#demonstração-1)
|
||||
- [Estatística semanal WakaTime](#estatística-semanal-wakatime)
|
||||
- [Demonstração](#demonstração-2)
|
||||
- [Todas as demonstrações](#todas-as-demonstrações)
|
||||
- [Dica (Alinhandos os cartões de repositório)](#dica-alinhandos-os-cartões-de-repositório)
|
||||
- [Implante em sua própria instância do Vercel](#implante-em-sua-própria-instância-do-vercel)
|
||||
- [:sparkling\_heart: Apoie o projeto](#sparkling_heart-apoie-o-projeto)
|
||||
|
||||
# Cartão de estatísticas do GitHub
|
||||
|
||||
Copie e cole isso no seu conteúdo de remarcação e é isso. Simples!
|
||||
|
||||
Mude o valor de `?username=` para o seu nome de usuário no GitHub.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
_Nota: As classificações são baseadas nas estatísticas do usuário, veja [src/calculateRank.js](../src/calculateRank.js)_
|
||||
|
||||
### Ocultando estatísticas específicas
|
||||
|
||||
Para ocultar estatísticas individualmente, você pode passar um parâmetro de consulta `?hide=` com valores separados por vírgula.
|
||||
|
||||
> Opções: `&hide=stars,commits,prs,issues,contribs`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Adicionando contagem de contribuições privadas à contagem total de commits
|
||||
|
||||
Adicione a contagem de todas as suas contribuições privadas à contagem total de confirmações usando o parâmetro de consulta `?count_private=true`.
|
||||
|
||||
_Nota: Se você estiver implantando este projeto, as contribuições privadas serão contadas por padrão; caso contrário, você precisará compartilhar suas contagens de contribuições privadas._
|
||||
|
||||
> Opções: `&count_private=true`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Exibindo ícones
|
||||
|
||||
Para habilitar ícones, basta utilizar o parâmetro `show_icons=true` na sua requisição, da seguinte forma:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Temas
|
||||
|
||||
Com temas predefinidos, pode personalizar a aparência dos cartões sem precisar fazer nenhuma [configuração manual](#personalização).
|
||||
|
||||
Utilize o parâmetro `?theme=THEME_NAME`, da seguinte forma:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
#### Todos os temas predefinidos :
|
||||
|
||||
dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula
|
||||
|
||||
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Stat Themes" width="600px"/>
|
||||
|
||||
Visualize [todos o temas disponíveis](../themes/README.md) ou o [arquivo de configuração de tema](../themes/index.js), além de **também poder contribuir com novos temas**, se desejar :D
|
||||
|
||||
### Personalização
|
||||
|
||||
Personalize a aparência do seu `Stats Card` ou `Repo Card` da maneira que desejar com os parâmetros de URL.
|
||||
|
||||
#### Opções comuns
|
||||
|
||||
- `title_color` - Cor do título do cartão _(hex color)_
|
||||
- `text_color` - Cor de texto do conteúdo _(hex color)_
|
||||
- `icon_color` - Cor dos ícones (se disponível) _(hex color)_
|
||||
- `bg_color` - Cor de fundo do cartão _(hex color)_
|
||||
- `hide_border` - Esconde a borda do cartão _(boleano)_
|
||||
- `theme` - Nome do tema, escolha em [todos os temas disponíveis](../themes/README.md)
|
||||
- `cache_seconds` - Defina o cabeçalho do cache manualmente _(min: 14400, max: 86400)_
|
||||
- `locale` - defina o idioma no cartão _(por exemplo. cn, de, es, etc.)_
|
||||
|
||||
> Nota sobre o cache: Cartões de repositório tem um cache padrão de 30 minutos (1800 segundos), se o número a contagem de forks e contagem de estrelas é menor que 1 mil o padrão é 2 horas (7200 segundos). Note também que o cache é limitado a um mínimo de 30 minutos e um máximo de 24 horas.
|
||||
|
||||
#### Opções exclusivas do cartão de estatísticas:
|
||||
|
||||
- `hide` - Oculta itens específicos das estatísticas _(Valores separados por vírgulas)_
|
||||
- `hide_title` - Ocultar o título _(boolean)_
|
||||
- `hide_rank` - Ocultar a classificação _(boolean)_
|
||||
- `show_icons` - Mostrar ícones _(boolean)_
|
||||
- `include_all_commits` - Contabiliza todos os commits ao invés de apenas os atual ano _(boolean)_
|
||||
- `count_private` - Contabiliza commits privados _(boolean)_
|
||||
- `line_height` - Define a altura do espaçamento entre o texto _(number)_
|
||||
|
||||
#### Opções exclusivas do cartão de repositórios:
|
||||
|
||||
- `show_owner` - Exibir o nome da pessoa a quem o repositório pertence _(boolean)_
|
||||
|
||||
#### Opções exclusivas do cartão de linguagens:
|
||||
|
||||
- `hide` - Oculta linguagens específicas _(Valores separados por vírgulas)_
|
||||
- `hide_title` - Oculta o título _(boolean)_
|
||||
- `layout` - Alternar entre os cinco layouts disponíveis `normal` & `compact` & `donut` & `donut-vertical` & `pie`
|
||||
- `card_width` - Define a largura do cartão manualmente _(number)_
|
||||
|
||||
> :warning: **Importante:**
|
||||
> Nomes de linguagens devem ser uma sequência escapada de URI, como específicado em [Codificação por cento](https://pt.wikipedia.org/wiki/Codificação_por_cento)
|
||||
> (Ou seja: `c++` deve se tornar `c%2B%2B`, `jupyter notebook` deve se tornar `jupyter%20notebook`, etc.)
|
||||
|
||||
---
|
||||
|
||||
# Pins extras do GitHub
|
||||
|
||||
Os Pins extras do GitHub permitem fixar mais de 6 repositórios no seu perfil usando um perfil README.me do GitHub.
|
||||
|
||||
Uhu! Você não está mais limitado a 6 repositórios fixados.
|
||||
|
||||
### Utilização
|
||||
|
||||
Copie e cole esse código no seu README.md e altere os atributos.
|
||||
|
||||
Endpoint: `api/pin?username=anuraghazra&repo=github-readme-stats`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demonstração
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
Utilize a variável [show_owner](#personalização) para incluir o nome de usuário do proprietária do repositório
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# Cartão de principais linguagens de programação
|
||||
|
||||
Exibe uma métrica de linguagens de programação mais usadas pelo usuário do GitHub.
|
||||
|
||||
_Nota: As principais linguagens de programação não fazem declarações sobre habilidades pessoais ou similares, é apenas uma figura-chave com base nas estatísticas do GitHub do usuário indicando a frequência com que cada uma foi utilizada._
|
||||
|
||||
### Utilização
|
||||
|
||||
Copie e cole esse código no seu README.md e altere os atributos.
|
||||
|
||||
Endpoint: `api/top-langs?username=anuraghazra`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Ocultar linguagens individualmente
|
||||
|
||||
Utilize o parâmetro `?hide=language1,language2` para ocultar linguagens específicas.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Layout de cartão de linguagens compacto
|
||||
|
||||
Utilize a opção `&layout=compact` para mudar o layout do cartão.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demonstração
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Layout compacto
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# Estatística semanal WakaTime
|
||||
|
||||
Altere o valor de `?username=` para o seu username do WakaTime.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demonstração
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
|
||||
|
||||
### Todas as demonstrações
|
||||
|
||||
- Padronizado
|
||||
|
||||

|
||||
|
||||
- Ocultando estatísticas específicas
|
||||
|
||||

|
||||
|
||||
- Mostrando ícones
|
||||
|
||||

|
||||
|
||||
- Incluir todos os commits
|
||||
|
||||

|
||||
|
||||
- Temas
|
||||
|
||||
Escolha entre um dos [temas predefinidos](#temas)
|
||||
|
||||

|
||||
|
||||
- Personalizando o cartão de estatísticas
|
||||
|
||||

|
||||
|
||||
- Customizando o cartão de repositório
|
||||
|
||||

|
||||
|
||||
- Principais linguagens
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Dica (Alinhandos os cartões de repositório)
|
||||
|
||||
Por padrão, você não poderá organizar as imagens lado a lado. Para fazer isso, você pode usar a seguinte abordagem:
|
||||
|
||||
```html
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=convoychat" />
|
||||
</a>
|
||||
```
|
||||
|
||||
## Implante em sua própria instância do Vercel
|
||||
|
||||
#### [Check Out Step By Step Video Tutorial By @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
Como a API do GitHub permite apenas 5 mil solicitações por hora, é possível que minha `https://github-readme-stats.vercel.app/api` atinja a cota limite. Se hospedar em seu próprio servidor Vercel, não precisará se preocupar com nada. Clique no botão de implantação para começar!
|
||||
|
||||
Nota: Desde [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) há possibilidade de lidar com mais de 5 mil chamadas por hora, sem interrupções :D
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
<details>
|
||||
<summary>Guia de configuração do Vercel</summary>
|
||||
|
||||
1. Acesse [vercel.com](https://vercel.com/)
|
||||
1. Clique em `Login`
|
||||

|
||||
1. Acesse com o GitHub clicando em `Continue with GitHub`
|
||||

|
||||
1. Entre no GitHub e permita acesso a todos os repositórios, se solicitado
|
||||
1. Faça Fork neste repositório
|
||||
1. Volte ao seu [painel principal do Vercel](https://vercel.com/dashboard)
|
||||
1. Selecione `Import Project`
|
||||

|
||||
1. Selecione `Import Git Repository`
|
||||

|
||||
1. Selecione a raiz e mantenha tudo como está, basta adicionar sua variável de ambiente chamada PAT_1 (que será exibida), que conterá um token de acesso pessoal (PAT), que você pode criar facilmente [aqui](https://github.com/settings/tokens/new) (deixe tudo como está, apenas dê um nome, que pode ser o que você quiser)
|
||||

|
||||
1. Clique em `deploy` e já estará tudo pronto. Veja seus domínios para usar a API!
|
||||
|
||||
</details>
|
||||
|
||||
## :sparkling_heart: Apoie o projeto
|
||||
|
||||
Disponibilizo como código aberto quase tudo o que posso e tento responder a todos que precisam de ajuda para utilizar esses projetos. Claro,
|
||||
isso demanda tempo. Utilize este serviço gratuitamente.
|
||||
|
||||
No entanto, se você utilizar este projeto e estiver satisfeito com ele, ou apenas quiser me encorajar a continuar criando coisas, existem algumas formas fazê-lo:
|
||||
|
||||
- Dando os devidos créditos ao usar github-readme-stats no seu README.me, adicionando uma referência ao projeto :D
|
||||
- Dando uma estrela (Starring) e compartilhando o projeto 🚀
|
||||
- [](https://www.paypal.me/anuraghazra) - Você pode fazer doações únicas via PayPal. Provavelmente vou comprar um ~~café~~ chá. :tea:
|
||||
|
||||
Obrigado! :heart:
|
||||
|
||||
---
|
||||
|
||||
[](https://vercel.com?utm_source=github_readme_stats_team&utm_campaign=oss)
|
||||
|
||||
Contribuições são bem-vindas! <3
|
||||
|
||||
Feito com :heart: e JavaScript.
|
||||
@@ -1,432 +0,0 @@
|
||||
<p align="center">
|
||||
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
|
||||
<h2 align="center">GitHub Readme Stats</h2>
|
||||
<p align="center">Readme'lerinizde dinamik olarak oluşturulmuş GitHub istatistikleri alın!</p>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#demo">Demo</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">Hata İlet</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">Özellik Talep Et</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="/docs/readme_fr.md">Français </a>
|
||||
·
|
||||
<a href="/docs/readme_cn.md">简体中文</a>
|
||||
·
|
||||
<a href="/docs/readme_es.md">Español</a>
|
||||
·
|
||||
<a href="/docs/readme_de.md">Deutsch</a>
|
||||
·
|
||||
<a href="/docs/readme_ja.md">日本語</a>
|
||||
·
|
||||
<a href="/docs/readme_pt-BR.md">Português Brasileiro</a>
|
||||
·
|
||||
<a href="/docs/readme_it.md">Italiano</a>
|
||||
·
|
||||
<a href="/docs/readme_kr.md">한국어</a>
|
||||
.
|
||||
<a href="/docs/readme_nl.md">Nederlands</a>
|
||||
.
|
||||
<a href="/docs/readme_np.md">नेपाली</a>
|
||||
.
|
||||
<a href="/docs/readme_tr.md">Türkçe</a>
|
||||
</p>
|
||||
</p>
|
||||
<p align="center">Projeyi sevdiniz mi? Daha da gelişmesi için lütfen <a href="https://www.paypal.me/anuraghazra">bağış</a> yapın!
|
||||
|
||||
# Features <!-- omit in toc -->
|
||||
|
||||
- [GitHub İstatistikler Kartı](#github-i̇statistikler-kartı)
|
||||
- [Bazı İstatitistikleri Gizleme](#bazı-i̇statitistikleri-gizleme)
|
||||
- [Özel Katkı Sayısını Toplam Commit Sayısına Ekleme](#özel-katkı-sayısını-toplam-commit-sayısına-ekleme)
|
||||
- [İkonları Göstermek](#i̇konları-göstermek)
|
||||
- [Temalar](#temalar)
|
||||
- [Özelleştirmeler](#özelleştirmeler)
|
||||
- [GitHub Ekstra Pinler](#github-ekstra-pinler)
|
||||
- [Kullanım](#kullanım)
|
||||
- [Demo](#demo)
|
||||
- [En Çok Kullanılan Diller](#en-çok-kullanılan-diller)
|
||||
- [Kullanım](#kullanım-1)
|
||||
- [Belirli Repoları Çıkartın](#belirli-repoları-çıkartın)
|
||||
- [Belirli Dilleri Çıkartın](#belirli-dilleri-çıkartın)
|
||||
- [Daha Fazla Dil Gösterin](#daha-fazla-dil-gösterin)
|
||||
- [Kompakt Dil Kartı Düzeni](#kompakt-dil-kartı-düzeni)
|
||||
- [Demo](#demo-1)
|
||||
- [WakaTime Haftalık İstatistikler](#wakatime-haftalık-i̇statistikler)
|
||||
- [Demo](#demo-2)
|
||||
- [Tüm Demolar](#tüm-demolar)
|
||||
- [Hızlı İpucu (Repo Kartları Hizlayın)](#hızlı-i̇pucu-repo-kartları-hizlayın)
|
||||
- [Kendi Vercel Örneğinizde Yayınlayın](#kendi-vercel-örneğinizde-yayınlayın)
|
||||
- [:sparkling\_heart: Projeyi Destekleyin](#sparkling_heart-projeyi-destekleyin)
|
||||
|
||||
# GitHub İstatistikler Kartı
|
||||
|
||||
Alt kısımdaki kodu Kopyalayın ve yapıştırın. İşte bu kadar. Çok basit!
|
||||
|
||||
`?username=` değerini kendi GitHub kullanıcı adınız ile değiştirin.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
_Not: Şu sıralamalar mevcut: S+ (en üst 1%), S (en üst 25%), A++ (en üst 45%), A+ (en üst 60%), and B+ (herkes).
|
||||
Buradaki değerler [cumulative distribution function](https://en.wikipedia.org/wiki/Cumulative_distribution_function) ile hesaplanırken; commitler, katkılar, hatalar, yıldızlar, çekme istekleri, takipçiler ve sahip olunan depolar (repository) göz önünde bulundurulamaktadır.
|
||||
Uygulamanın yapısı [src/calculateRank.js](./src/calculateRank.js)'te daha detaylı incelenebilir._
|
||||
|
||||
### Bazı İstatitistikleri Gizleme
|
||||
|
||||
Bazı belirli istatistikleri gizlemek için `?hide=` paremetresi içerisinde virgülle ayırarak gönderebilirsiniz.
|
||||
|
||||
> Örnek: `&hide=stars,commits,prs,issues,contribs`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Özel Katkı Sayısını Toplam Commit Sayısına Ekleme
|
||||
|
||||
Özel (private) olarak geliştirdiğiniz depolardaki commit sayınızı toplam commit sayınız içerisinde göstermek istiyorsanız `?count_private=true` parametresini gönderebilirsiniz.
|
||||
|
||||
_Not: Eğer projeyi kendiniz yayınlayıp kullanacaksanız, özel depolardaki geliştirmelerinizin sayısını varsayılan olarak toplam commit sayınız içerisinde gösterilecektir. Aksi taktirde özel depolardaki katkı sayınızı paylaşmayı ayrıca seçmeniz gerekecektir.
|
||||
|
||||
> Örnek: `&count_private=true`
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### İkonları Göstermek
|
||||
|
||||
Eğer ikonları göstermek istiyorsanız, `show_icons=true` parametresini göndermeniz gerekmektedir. Örnek olarak:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Temalar
|
||||
|
||||
Dahili olarak gelen temalarla, herhangi bir [manuel özelleştirme](#özelleştirmeler) yapmadan kartın görünümünü özelleştirebilirsiniz.
|
||||
|
||||
`?theme=THEME_NAME` parametresini kullanabilirsiniz:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
#### Tüm Dahili Temalar :-
|
||||
|
||||
dark, radical, merko, gruvbox, tokyonight, onedark, cobalt, synthwave, highcontrast, dracula
|
||||
|
||||
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1595174536/grs-themes_l4ynja.png" alt="GitHub Readme Stat Temaları" width="600px"/>
|
||||
|
||||
Önizleme yapmak için şuralara göz atabilirsiniz: [tüm dahili temalar](./themes/README.md) veya [tema ayar dosyası](./themes/index.js) & **ayrıca siz de yeni bir tema oluşturarak katkı sağlayabilirsiniz** elbette isterseniz :D
|
||||
|
||||
### Özelleştirmeler
|
||||
|
||||
|
||||
`Stats Card` ya da `Repo Card` görüntünüzü istediğiniz gibi şu parametreler ile değiştirebilirsiniz:
|
||||
|
||||
#### Yaygın Seçenekler:
|
||||
|
||||
- `title_color` - Kart başlığı rengi _(hex color / hex rengi)_
|
||||
- `text_color` - İçerik rengi _(hex color / hex rengi)_
|
||||
- `icon_color` - Mümkünse ikon rengi _(hex color / hex rengi)_
|
||||
- `bg_color` - Kartın arkaplan rengi _(hex color / hex rengi)_ **ya da** gradient şeklinde _açı,başlangıç,bitiş_
|
||||
- `hide_border` - Kartın çerçevelerini gizler _(boolean)_
|
||||
- `theme` - Temanın rengi [tüm temalar](./themes/README.md)
|
||||
- `cache_seconds` - Manuel olarak cache'i belirleyebilirsiniz _(en az: 14400, en fazla: 86400)_
|
||||
- `locale` - Karttaki dili seçebilirsiniz _(örneğin; tr, cn, de, es, vb.)_
|
||||
|
||||
##### bg_color'da Gradient
|
||||
|
||||
bg_color içerisinde birden fazla rengi gradient olarak göstermek için virgülle ayırarak kullanabilirsiniz. Gradient kullanımı için örnek format:
|
||||
|
||||
```
|
||||
&bg_color=DEG,COLOR1,COLOR2,COLOR3...COLOR10
|
||||
```
|
||||
|
||||
> Cache Hakkında: Repo kartında fork ve yıldız sayısı 1.000'den küçükse varsayılan cache süresi 4 saat yani 14400 saniyedir. 1.000'den büyükse 2 saat yani 7200 saniyedir. Ayrıca, önbelleğin minimum 2 ve maksimum 24 saate sabitlendiğini unutmayın.
|
||||
|
||||
#### İstatistik Karları Exclusive Özellikler:
|
||||
|
||||
- `hide` - Spesifik özellikleri istatistiklerden gizleyebilirsiniz. _(Virgül ile ayırılmış değerlerle)_
|
||||
- `hide_title` - _(boolean)_
|
||||
- `hide_rank` - _(boolean)_ Sıralamayı gizler ve kartın genişliğini otomatik olarak tekrar düzenler
|
||||
- `show_icons` - _(boolean)_
|
||||
- `include_all_commits` - _(boolean)_ Sadece bu yılın değil tüm zamanlarda yaptığınız commit sayısını gösterir
|
||||
- `count_private` - _(boolean)_ Özel depolarda yaptığınız commitleri gösterir
|
||||
- `line_height` - _(number)_ Satır arası yüksekliği belirler
|
||||
- `custom_title` - Kart için istediğiniz bir başlığı belirler
|
||||
- `disable_animations` - _(boolean)_ Kart içerisindeki tüm animasyonları kapatır
|
||||
|
||||
#### Repo Kartları Exclusive Özellikler:
|
||||
|
||||
- `show_owner` - _(boolean)_ Reponun sahibinin ismini gösterir
|
||||
|
||||
#### Dil Kartları Exclusive Özellikler:
|
||||
|
||||
- `hide` - Belirli bir dili listede gizler _(Virgül ile ayırılmış değerlerle)_
|
||||
- `hide_title` - _(boolean)_
|
||||
- `layout` - Beş uygun tasarım / düzen arasında geçiş yapın `normal` & `compact` & `donut` & `donut-vertical` & `pie`
|
||||
- `card_width` - Kartın genişliğini manuel olarak belirler _(number)_
|
||||
- `langs_count` - 1-10 arasında istediğiniz kadar dil gösterebilirsiniz. Varsayılan: 5 _(number)_
|
||||
- `exclude_repo` - Belirli repoları listeden çıkartır _(Virgül ile ayırılmış değerlerle)_
|
||||
- `custom_title` - Kart için istediğiniz bir başlığı belirler
|
||||
|
||||
> :warning: **Önemli:**
|
||||
> Dİl isimleri [Percent Encoding](https://en.wikipedia.org/wiki/Percent-encoding)'te belirtildiği üzere uri-escaped olarak belirtilmelidir.
|
||||
> (ör: `c++` yerine `c%2B%2B`, `jupyter notebook` yerine `jupyter%20notebook`, vb.)
|
||||
> [urlencoder.org](https://www.urlencoder.org/) adresini kullanarak otomatik olarak değerleri bu şekle çevirebilirsiniz.
|
||||
|
||||
#### WakaTime Kart Exclusive Özellikler:
|
||||
|
||||
- `hide_title` - _(boolean)_
|
||||
- `line_height` - Satır aralığı yüksekliği _(number)_
|
||||
- `hide_progress` - Progresbarı ve yüzdeyi gizler _(boolean)_
|
||||
- `custom_title` - Kart için istediğiniz bir başlığı belirler
|
||||
- `layout` - Uygun olan iki tasarım / layout arasında değişiklik yapar `default` & `compact`
|
||||
|
||||
---
|
||||
|
||||
# GitHub Ekstra Pinler
|
||||
|
||||
GitHub ekstra pinler profilinize 6'dan fazla repoyu / depoyu profilinizde pinleyebilirsiniz.
|
||||
|
||||
Hey! Artık 6 pin ile kısıtlı kalmayacaksınız!
|
||||
|
||||
### Kullanım
|
||||
|
||||
Alttaki kodu kopyalayıp readme dosyanıza urlleri değiştirerek yapıştırın.
|
||||
|
||||
Endpoint: `api/pin?username=mustafacagri&repo=github-readme-stats`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
[show_owner](#özelleştirmeler) ile reponun sahibini gösterebilirsiniz.
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# En Çok Kullanılan Diller
|
||||
|
||||
En çok kullanılan diller kartı kullanıcının en çok kullandığı dilleri gösterir.
|
||||
|
||||
_NOTE: En çok kullanılan dillerde yer alan bilgiler sizin yeteneğinizi ve benzeri şeyleri göstermek. Bu, kodlarınızda en çok kullandığınız dilleri gösteren bir GitHub metriğidir. Ayrıca, github-readme-stats'ın yeni özelliğidir.
|
||||
|
||||
### Kullanım
|
||||
|
||||
Alttaki kodu kopyalayıp readme dosyanıza urlleri değiştirerek yapıştırın.
|
||||
|
||||
Endpoint: `api/top-langs?username=mustafacagri`
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Belirli Repoları Çıkartın
|
||||
|
||||
`?exclude_repo=repo1,repo2` parametresini kullanarak istediğiniz repoları çıkartabilirsiniz.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Belirli Dilleri Çıkartın
|
||||
|
||||
`?hide=language1,language2` parametresini kullanarak istediğiniz dilleri çıkartabilirsiniz.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Daha Fazla Dil Gösterin
|
||||
|
||||
`&langs_count=` parametresini kullanarak kartınızda gösterilen dil sayısını azaltabilir ya da artırabilirsiniz. Varsayılan değeri 5, kullanılabilir sayı aralığı ise 1-10'dur.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Kompakt Dil Kartı Düzeni
|
||||
|
||||
`&layout=compact` parametresiyle kart tasarımınızı değiştirebilirsiniz.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Kompakt Düzen / Layout
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
# WakaTime Haftalık İstatistikler
|
||||
|
||||
`?username=` değerini [WakaTime](https://wakatime.com)'daki kullanıcı adınızla değiştirin.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Demo
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- Kompakt Düzen
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Tüm Demolar
|
||||
|
||||
- Varsayılan
|
||||
|
||||

|
||||
|
||||
- Belirli istatistikler gizli
|
||||
|
||||

|
||||
|
||||
- İkonlar gösteriliyor
|
||||
|
||||

|
||||
|
||||
- Tüm commitler dahil
|
||||
|
||||

|
||||
|
||||
- Temalar
|
||||
|
||||
[default themes](#themes) adresinden istediğiniz temayı seçin.
|
||||
|
||||

|
||||
|
||||
- Gradient
|
||||
|
||||

|
||||
|
||||
- İstatistik Kartını Düzenleyin
|
||||
|
||||

|
||||
|
||||
- Kartın dilini seçin
|
||||
|
||||

|
||||
|
||||
- Repo kartı düzenleyin
|
||||
|
||||

|
||||
|
||||
- En çok kullanılan diller
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
- WakaTime kart
|
||||
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
---
|
||||
|
||||
### Hızlı İpucu (Repo Kartları Hizlayın)
|
||||
|
||||
Genellikle resimleri yan yana düzenleyemezsiniz. Bunu yapmak için şu yaklaşımı kullanabilirsiniz:
|
||||
|
||||
```html
|
||||
<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" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img align="center" src="https://github-readme-stats.vercel.app/api/pin/?username=anuraghazra&repo=convoychat" />
|
||||
</a>
|
||||
```
|
||||
|
||||
## Kendi Vercel Örneğinizde Yayınlayın
|
||||
|
||||
|
||||
#### [@codeSTACKr'ın Yayınladığı Video Eğitimine Göz Atın](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
GitHub API saatte sadece 5.000 isteğe izin verdiği için `https://github-readme-stats.vercel.app/api` adresindeki API'm bu limite muhtemelen takılmış olabilir. Eğer projeyi kendi Vercel sunucunuzda yayınlarsanız, böyle bir sorun yaşamayabilirsiniz. Deploy butonuna tıkla ve deploy başlasın!
|
||||
|
||||
|
||||
NOT: [#58](https://github.com/anuraghazra/github-readme-stats/pull/58) geliştirmesi sonrasında anlamadığımız bir şekilde 5.000 istek limitine takılmıyoruz :)
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/anuraghazra/github-readme-stats)
|
||||
|
||||
<details>
|
||||
<summary><strong> Vercel Kurulum Rehberi 🔨 </strong></summary>
|
||||
|
||||
1. [vercel.com](https://vercel.com/) adresine gidin
|
||||
1. `Log in`'e tıklayın
|
||||

|
||||
1. `Continue with GitHub`'e basarak GitHub ile giriş yapın
|
||||

|
||||
1. GitHub'a giriş yapın ve eğer çıkarsa tüm repolara izin verin.
|
||||
1. Bu repoyu fork'layın
|
||||
1. [Vercel dashboard](https://vercel.com/dashboard)'unuza geri dönün.
|
||||
1. `Import Project`'i seçin.
|
||||

|
||||
1. `Import Git Repository`'yi seçin.
|
||||

|
||||
1. Root'u seçin ve her şeyi olduğu gibi bırakın, [burada](https://github.com/settings/tokens/new) kolayca oluşturabileceğiniz kişisel bir erişim belirteci (personal access token) (PAT) içerecek olan PAT_1 adlı ortam değişkeninizi (gösterildiği gibi) ekleyin. (istediğiniz bir isim verin, çok da mühim değil açıkçası)
|
||||

|
||||
1. Deploy'u tıklayın ve hazırsınız.
|
||||
Click deploy, and you're good to go. API'ı kullanmak için alanlarınızı (domainlerinizi) görün!
|
||||
|
||||
</details>
|
||||
|
||||
## :sparkling_heart: Projeyi Destekleyin
|
||||
|
||||
Neredeyse yapabildiğim her şeyi açık kaynak yapıyorum ve bu projeleri kullanırken yardıma ihtiyacı olan herkese cevap vermeye çalışıyorum. Açıkçası,
|
||||
bu zaman alıyor. Destekleriniz sayesinde bu hizmeti ücretsiz olarak kullanabilirsiniz.
|
||||
|
||||
Ayrıca, bu projeyi kullanıyor ve memnunsanız veya sadece bir şeyler yaratmaya devam etmem için beni teşvik etmek istiyorsanız, bunu yapmanın birkaç yolu var: -
|
||||
|
||||
- Readme'nizde github-readme-stats'ı kullanırken bu projeye uygun bir link verebilirsiniz.
|
||||
- Projeye yıldız verebilir ve paylaşabilirsiniz :rocket:
|
||||
- [](https://www.paypal.me/anuraghazra) - PayPal ile tek seferlik bağış yapabilirsiniz. Muhtemelen bir ~~kahve~~ ya da çay :tea: alacağım.
|
||||
|
||||
Teşekkürler! :heart:
|
||||
|
||||
---
|
||||
|
||||
[](https://vercel.com?utm_source=github_readme_stats_team&utm_campaign=oss)
|
||||
|
||||
|
||||
Katkılara açığız! <3
|
||||
|
||||
:heart: ve JavaScript ile hazırlandı.
|
||||
@@ -0,0 +1,83 @@
|
||||
import globals from "globals";
|
||||
import path from "node:path";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import js from "@eslint/js";
|
||||
import { FlatCompat } from "@eslint/eslintrc";
|
||||
import jsdoc from "eslint-plugin-jsdoc";
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
const compat = new FlatCompat({
|
||||
baseDirectory: __dirname,
|
||||
recommendedConfig: js.configs.recommended,
|
||||
allConfig: js.configs.all,
|
||||
});
|
||||
|
||||
export default [
|
||||
...compat.extends("prettier"),
|
||||
{
|
||||
languageOptions: {
|
||||
globals: {
|
||||
...globals.node,
|
||||
...globals.browser,
|
||||
},
|
||||
|
||||
ecmaVersion: 2022,
|
||||
sourceType: "module",
|
||||
},
|
||||
plugins: {
|
||||
jsdoc,
|
||||
},
|
||||
rules: {
|
||||
"no-unexpected-multiline": "error",
|
||||
"accessor-pairs": [
|
||||
"error",
|
||||
{
|
||||
getWithoutSet: false,
|
||||
setWithoutGet: true,
|
||||
},
|
||||
],
|
||||
"block-scoped-var": "warn",
|
||||
"consistent-return": "error",
|
||||
curly: "error",
|
||||
"no-alert": "error",
|
||||
"no-caller": "error",
|
||||
"no-warning-comments": [
|
||||
"warn",
|
||||
{
|
||||
terms: ["TODO", "FIXME"],
|
||||
location: "start",
|
||||
},
|
||||
],
|
||||
"no-with": "warn",
|
||||
radix: "warn",
|
||||
"no-delete-var": "error",
|
||||
"no-undef-init": "off",
|
||||
"no-undef": "error",
|
||||
"no-undefined": "off",
|
||||
"no-unused-vars": "warn",
|
||||
"no-use-before-define": "error",
|
||||
"constructor-super": "error",
|
||||
"no-class-assign": "error",
|
||||
"no-const-assign": "error",
|
||||
"no-dupe-class-members": "error",
|
||||
"no-this-before-super": "error",
|
||||
"object-shorthand": ["warn"],
|
||||
"no-mixed-spaces-and-tabs": "warn",
|
||||
"no-multiple-empty-lines": "warn",
|
||||
"no-negated-condition": "warn",
|
||||
"no-unneeded-ternary": "warn",
|
||||
"keyword-spacing": [
|
||||
"error",
|
||||
{
|
||||
before: true,
|
||||
after: true,
|
||||
},
|
||||
],
|
||||
"jsdoc/require-returns": "warn",
|
||||
"jsdoc/require-returns-description": "warn",
|
||||
"jsdoc/require-param-description": "warn",
|
||||
"jsdoc/require-jsdoc": "warn",
|
||||
},
|
||||
},
|
||||
];
|
||||
+21
-6
@@ -7,10 +7,25 @@ import gistCard from "./api/gist.js";
|
||||
import express from "express";
|
||||
|
||||
const app = express();
|
||||
app.listen(process.env.port || 9000);
|
||||
const router = express.Router();
|
||||
|
||||
app.get("/", statsCard);
|
||||
app.get("/pin", repoCard);
|
||||
app.get("/top-langs", langCard);
|
||||
app.get("/wakatime", wakatimeCard);
|
||||
app.get("/gist", gistCard);
|
||||
router.get("/", statsCard);
|
||||
router.get("/pin", repoCard);
|
||||
router.get("/top-langs", langCard);
|
||||
router.get("/wakatime", wakatimeCard);
|
||||
router.get("/gist", gistCard);
|
||||
|
||||
app.use("/api", router);
|
||||
|
||||
const port = process.env.PORT || process.env.port || 9000;
|
||||
const server = app.listen(port, "0.0.0.0", () => {
|
||||
console.log(`Server running on port ${port}`);
|
||||
});
|
||||
|
||||
/* stop gracefully when requested */
|
||||
process.on("SIGTERM", () => {
|
||||
console.log("stopping, received SIGTERM signal");
|
||||
server.close(() => {
|
||||
process.exit();
|
||||
});
|
||||
});
|
||||
|
||||
+10
-13
@@ -1,16 +1,13 @@
|
||||
export default {
|
||||
// Jest-bench need its own test environment to function
|
||||
testEnvironment: "jest-bench/environment",
|
||||
testEnvironmentOptions: {
|
||||
// still Jest-bench environment will run your environment if you specify it here
|
||||
testEnvironment: "jest-environment-node",
|
||||
testEnvironmentOptions: {
|
||||
// specify any option for your environment
|
||||
},
|
||||
},
|
||||
// always include "default" reporter along with Jest-bench reporter
|
||||
// for error reporting
|
||||
reporters: ["default", "jest-bench/reporter"],
|
||||
// will pick up "*.bench.js" file.
|
||||
clearMocks: true,
|
||||
transform: {},
|
||||
testEnvironment: "jsdom",
|
||||
coverageProvider: "v8",
|
||||
testPathIgnorePatterns: ["<rootDir>/node_modules/", "<rootDir>/tests/e2e/"],
|
||||
modulePathIgnorePatterns: ["<rootDir>/node_modules/", "<rootDir>/tests/e2e/"],
|
||||
coveragePathIgnorePatterns: [
|
||||
"<rootDir>/node_modules/",
|
||||
"<rootDir>/tests/e2e/",
|
||||
],
|
||||
testRegex: "(\\.bench)\\.(ts|tsx|js)$",
|
||||
};
|
||||
|
||||
Generated
+6579
-4771
File diff suppressed because it is too large
Load Diff
+22
-19
@@ -36,38 +36,41 @@
|
||||
"author": "Anurag Hazra",
|
||||
"license": "MIT",
|
||||
"devDependencies": {
|
||||
"@actions/core": "^1.10.1",
|
||||
"@actions/github": "^6.0.0",
|
||||
"@testing-library/dom": "^10.1.0",
|
||||
"@testing-library/jest-dom": "^6.4.5",
|
||||
"@actions/core": "^2.0.1",
|
||||
"@actions/github": "^6.0.1",
|
||||
"@eslint/eslintrc": "^3.3.3",
|
||||
"@eslint/js": "^9.39.2",
|
||||
"@testing-library/dom": "^10.4.1",
|
||||
"@testing-library/jest-dom": "^6.9.1",
|
||||
"@uppercod/css-to-object": "^1.1.1",
|
||||
"axios-mock-adapter": "^1.22.0",
|
||||
"axios-mock-adapter": "^2.1.0",
|
||||
"color-contrast-checker": "^2.1.0",
|
||||
"eslint": "^8.57.0",
|
||||
"eslint-config-prettier": "^9.1.0",
|
||||
"eslint": "^9.39.2",
|
||||
"eslint-config-prettier": "^10.1.8",
|
||||
"eslint-plugin-jsdoc": "^61.5.0",
|
||||
"express": "^5.2.1",
|
||||
"globals": "^16.5.0",
|
||||
"hjson": "^3.2.2",
|
||||
"husky": "^9.0.11",
|
||||
"jest": "^29.7.0",
|
||||
"jest-bench": "^29.7.1",
|
||||
"jest-environment-jsdom": "^29.7.0",
|
||||
"js-yaml": "^4.1.0",
|
||||
"lint-staged": "^15.2.2",
|
||||
"husky": "^9.1.7",
|
||||
"jest": "^30.2.0",
|
||||
"jest-environment-jsdom": "^30.2.0",
|
||||
"js-yaml": "^4.1.1",
|
||||
"lint-staged": "^16.2.7",
|
||||
"lodash.snakecase": "^4.1.1",
|
||||
"parse-diff": "^0.11.1",
|
||||
"prettier": "^3.2.5"
|
||||
"prettier": "^3.7.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^1.7.1",
|
||||
"dotenv": "^16.4.5",
|
||||
"emoji-name-map": "^1.2.8",
|
||||
"axios": "^1.13.1",
|
||||
"dotenv": "^17.2.3",
|
||||
"emoji-name-map": "^2.0.3",
|
||||
"github-username-regex": "^1.0.0",
|
||||
"upgrade": "^1.1.0",
|
||||
"word-wrap": "^1.2.5"
|
||||
},
|
||||
"lint-staged": {
|
||||
"*.{js,css,md}": "prettier --write"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=18.0.0"
|
||||
"node": ">=22"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,104 +1,71 @@
|
||||
<div align="center">
|
||||
<img src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" width="100px" alt="GitHub Readme Stats" />
|
||||
<h1 style="font-size: 28px; margin: 10px 0;">GitHub Readme Stats</h1>
|
||||
<p>Get dynamically generated GitHub stats on your READMEs!</p>
|
||||
</div>
|
||||
|
||||
<p align="center">
|
||||
<img width="100px" src="https://res.cloudinary.com/anuraghazra/image/upload/v1594908242/logo_ccswme.svg" align="center" alt="GitHub Readme Stats" />
|
||||
<h2 align="center">GitHub Readme Stats</h2>
|
||||
<p align="center">Get dynamically generated GitHub stats on your READMEs!</p>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
<a href="https://vercel.com?utm\_source=github\_readme\_stats\_team\&utm\_campaign=oss">
|
||||
<img src="./powered-by-vercel.svg"/>
|
||||
</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/actions">
|
||||
<img alt="Tests Passing" src="https://github.com/anuraghazra/github-readme-stats/workflows/Test/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/graphs/contributors">
|
||||
<img alt="GitHub Contributors" src="https://img.shields.io/github/contributors/anuraghazra/github-readme-stats" />
|
||||
</a>
|
||||
<a href="https://codecov.io/gh/anuraghazra/github-readme-stats">
|
||||
<img alt="Tests Coverage" src="https://codecov.io/gh/anuraghazra/github-readme-stats/branch/master/graph/badge.svg" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues">
|
||||
<img alt="Issues" src="https://img.shields.io/github/issues/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/pulls">
|
||||
<img alt="GitHub pull requests" src="https://img.shields.io/github/issues-pr/anuraghazra/github-readme-stats?color=0088ff" />
|
||||
</a>
|
||||
<a href="https://securityscorecards.dev/viewer/?uri=github.com/anuraghazra/github-readme-stats">
|
||||
<img alt="OpenSSF Scorecard" src="https://api.securityscorecards.dev/projects/github.com/anuraghazra/github-readme-stats/badge" />
|
||||
</a>
|
||||
<br />
|
||||
<br />
|
||||
<a href="https://vercel.com?utm\_source=github\_readme\_stats\_team\&utm\_campaign=oss">
|
||||
<img src="./powered-by-vercel.svg"/>
|
||||
</a>
|
||||
</p>
|
||||
|
||||
<p align="center">
|
||||
<a href="#all-demos">View Demo</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">Report Bug</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">Request Feature</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/discussions/1770">FAQ</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/discussions/new?category=q-a">Ask Question</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="/docs/readme_fr.md">Français </a>
|
||||
·
|
||||
<a href="/docs/readme_cn.md">简体中文</a>
|
||||
·
|
||||
<a href="/docs/readme_es.md">Español</a>
|
||||
·
|
||||
<a href="/docs/readme_de.md">Deutsch</a>
|
||||
·
|
||||
<a href="/docs/readme_ja.md">日本語</a>
|
||||
·
|
||||
<a href="/docs/readme_pt-BR.md">Português Brasileiro</a>
|
||||
·
|
||||
<a href="/docs/readme_it.md">Italiano</a>
|
||||
·
|
||||
<a href="/docs/readme_kr.md">한국어</a>
|
||||
·
|
||||
<a href="/docs/readme_nl.md">Nederlands</a>
|
||||
·
|
||||
<a href="/docs/readme_np.md">नेपाली</a>
|
||||
·
|
||||
<a href="/docs/readme_tr.md">Türkçe</a>
|
||||
</p>
|
||||
<p align="center">
|
||||
<a href="#all-demos">View Demo</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=bug&projects=&template=bug_report.yml">Report Bug</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/issues/new?assignees=&labels=enhancement&projects=&template=feature_request.yml">Request Feature</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/discussions/1770">FAQ</a>
|
||||
·
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats/discussions/new?category=q-a">Ask Question</a>
|
||||
</p>
|
||||
|
||||
<p align="center">Please note that documentation translations may be outdated; try to use English documentation if possible.</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">
|
||||
<img src="https://cfstatic.give.do/logo.png" alt="Give india logo" width="200" />
|
||||
</a>
|
||||
|
||||
Are you considering supporting the project by donating to me? Please DO NOT!!!
|
||||
|
||||
<img src="https://cfstatic.give.do/910ede2a-7892-43fe-8c8a-dea45e96d950.webp" alt="Picture of Coromandel Express train tragedy" width="35%">
|
||||
|
||||
India has recently suffered one of the most devastating train accidents, and your help will be immensely valuable for the people who were affected by this tragedy.
|
||||
|
||||
Please visit [this link](https://give.do/fundraisers/stand-beside-the-victims-of-the-coromandel-express-train-tragedy-in-odisha-donate-now) and make a small donation to help the people in need. A small donation goes a long way. :heart:
|
||||
|
||||
</p>
|
||||
|
||||
# Features <!-- omit in toc -->
|
||||
<details>
|
||||
<summary>Table of contents (Click to show)</summary>
|
||||
|
||||
- [GitHub Stats Card](#github-stats-card)
|
||||
- [Hiding individual stats](#hiding-individual-stats)
|
||||
- [Showing additional individual stats](#showing-additional-individual-stats)
|
||||
- [Showing icons](#showing-icons)
|
||||
- [Showing commits count for specified year](#showing-commits-count-for-specified-year)
|
||||
- [Themes](#themes)
|
||||
- [Customization](#customization)
|
||||
- [GitHub Extra Pins](#github-extra-pins)
|
||||
- [Usage](#usage)
|
||||
- [Options](#options)
|
||||
- [Demo](#demo)
|
||||
- [GitHub Gist Pins](#github-gist-pins)
|
||||
- [Usage](#usage-1)
|
||||
- [Options](#options-1)
|
||||
- [Demo](#demo-1)
|
||||
- [Top Languages Card](#top-languages-card)
|
||||
- [Usage](#usage-2)
|
||||
- [Options](#options-2)
|
||||
- [Language stats algorithm](#language-stats-algorithm)
|
||||
- [Exclude individual repositories](#exclude-individual-repositories)
|
||||
- [Hide individual languages](#hide-individual-languages)
|
||||
@@ -108,27 +75,35 @@ Please visit [this link](https://give.do/fundraisers/stand-beside-the-victims-of
|
||||
- [Donut Vertical Chart Language Card Layout](#donut-vertical-chart-language-card-layout)
|
||||
- [Pie Chart Language Card Layout](#pie-chart-language-card-layout)
|
||||
- [Hide Progress Bars](#hide-progress-bars)
|
||||
- [Change format of language's stats](#change-format-of-languages-stats)
|
||||
- [Demo](#demo-2)
|
||||
- [WakaTime Stats Card](#wakatime-stats-card)
|
||||
- [Options](#options-3)
|
||||
- [Demo](#demo-3)
|
||||
- [All Demos](#all-demos)
|
||||
- [Quick Tip (Align The Cards)](#quick-tip-align-the-cards)
|
||||
- [Stats and top languages cards](#stats-and-top-languages-cards)
|
||||
- [Pinning repositories](#pinning-repositories)
|
||||
- [Deploy on your own](#deploy-on-your-own)
|
||||
- [On Vercel](#on-vercel)
|
||||
- [GitHub Actions (Recommended)](#github-actions-recommended)
|
||||
- [Self-hosted (Vercel/Other) (Recommended)](#self-hosted-vercelother-recommended)
|
||||
- [First step: get your Personal Access Token (PAT)](#first-step-get-your-personal-access-token-pat)
|
||||
- [On Vercel](#on-vercel)
|
||||
- [:film\_projector: Check Out Step By Step Video Tutorial By @codeSTACKr](#film_projector-check-out-step-by-step-video-tutorial-by-codestackr)
|
||||
- [On other platforms](#on-other-platforms)
|
||||
- [Disable rate limit protections](#disable-rate-limit-protections)
|
||||
- [On other platforms](#on-other-platforms)
|
||||
- [Available environment variables](#available-environment-variables)
|
||||
- [Keep your fork up to date](#keep-your-fork-up-to-date)
|
||||
- [:sparkling\_heart: Support the project](#sparkling_heart-support-the-project)
|
||||
</details>
|
||||
|
||||
# Important Notices <!-- omit in toc -->
|
||||
|
||||
> [!IMPORTANT]\
|
||||
> Since the GitHub API only [allows 5k requests per hour per user account](https://docs.github.com/en/graphql/overview/resource-limitations), the public Vercel instance hosted on `https://github-readme-stats.vercel.app/api` could possibly hit the rate limiter (see [#1471](https://github.com/anuraghazra/github-readme-stats/issues/1471)). We use caching to prevent this from happening (see https://github.com/anuraghazra/github-readme-stats#common-options). You can turn off these rate limit protections by deploying [your own Vercel instance](#disable-rate-limit-protections).
|
||||
> [!IMPORTANT]
|
||||
> The public Vercel instance at `https://github-readme-stats.vercel.app/api` is best-effort and can be unreliable due to rate limits and traffic spikes (see [#1471](https://github.com/anuraghazra/github-readme-stats/issues/1471)). We use caching to improve stability (see [common options](#common-options)), but for reliable cards we recommend [self-hosting](#deploy-on-your-own) (Vercel or other) or using the [GitHub Actions workflow](#github-actions-recommended) to generate cards in your [profile repository](https://docs.github.com/en/account-and-profile/how-tos/profile-customization/managing-your-profile-readme).
|
||||
|
||||
<img alt="Uptime Badge" src="https://img.shields.io/endpoint?url=https%3A%2F%2Fgithub-readme-stats-git-monitoring-github-readme-stats-team.vercel.app%2Fapi%2Fstatus%2Fup%3Ftype%3Dshields">
|
||||
|
||||
> [!IMPORTANT]\
|
||||
> [!IMPORTANT]
|
||||
> We're a small team, and to prioritize, we rely on upvotes :+1:. We use the Top Issues dashboard for tracking community demand (see [#1935](https://github.com/anuraghazra/github-readme-stats/issues/1935)). Do not hesitate to upvote the issues and pull requests you are interested in. We will work on the most upvoted first.
|
||||
|
||||
# GitHub Stats Card
|
||||
@@ -141,10 +116,10 @@ Change the `?username=` value to your GitHub username.
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
> [!WARNING]\
|
||||
> [!WARNING]
|
||||
> By default, the stats card only shows statistics like stars, commits, and pull requests from public repositories. To show private statistics on the stats card, you should [deploy your own instance](#deploy-on-your-own) using your own GitHub API token.
|
||||
|
||||
> [!NOTE]\
|
||||
> [!NOTE]
|
||||
> Available ranks are S (top 1%), A+ (12.5%), A (25%), A- (37.5%), B+ (50%), B (62.5%), B- (75%), C+ (87.5%) and C (everyone). This ranking scheme is based on the [Japanese academic grading](https://wikipedia.org/wiki/Academic_grading_in_Japan) system. The global percentile is calculated as a weighted sum of percentiles for each statistic (number of commits, pull requests, reviews, issues, stars, and followers), based on the cumulative distribution function of the [exponential](https://wikipedia.org/wiki/exponential_distribution) and the [log-normal](https://wikipedia.org/wiki/Log-normal_distribution) distributions. The implementation can be investigated at [src/calculateRank.js](https://github.com/anuraghazra/github-readme-stats/blob/master/src/calculateRank.js). The circle around the rank shows 100 minus the global percentile.
|
||||
|
||||
### Hiding individual stats
|
||||
@@ -175,6 +150,14 @@ To enable icons, you can pass `&show_icons=true` in the query param, like so:
|
||||

|
||||
```
|
||||
|
||||
### Showing commits count for specified year
|
||||
|
||||
You can specify a year and fetch only the commits that were made in that year by passing `&commits_year=YYYY` to the parameter.
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
### Themes
|
||||
|
||||
With inbuilt themes, you can customize the look of the card without doing any [manual customization](#customization).
|
||||
@@ -301,8 +284,8 @@ You can customize the appearance of all your cards however you wish with URL par
|
||||
| `locale` | Sets the language in the card, you can check full list of available locales [here](#available-locales). | enum | `en` |
|
||||
| `border_radius` | Corner rounding on the card. | number | `4.5` |
|
||||
|
||||
> [!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 6 hours (21600 seconds). Also, note that the cache is clamped to a minimum of 6 hours and a maximum of 24 hours. If you want the data on your statistics card to be updated more often you can [deploy your own instance](#deploy-on-your-own) and set [environment variable](#disable-rate-limit-protections) `CACHE_SECONDS` to a value of your choosing.
|
||||
> [!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 the following default cache hours: stats card - 24 hours, top languages card - 144 hours (6 days), pin card - 240 hours (10 days), gist card - 48 hours (2 days), and wakatime card - 24 hours. If you want the data on your cards to be updated more often you can [deploy your own instance](#deploy-on-your-own) and set [environment variable](#available-environment-variables) `CACHE_SECONDS` to a value of your choosing.
|
||||
|
||||
##### Gradient in bg\_color
|
||||
|
||||
@@ -319,45 +302,62 @@ Here is a list of all available locales:
|
||||
|
||||
| Code | Locale |
|
||||
| --- | --- |
|
||||
| `ar` | Arabic |
|
||||
| `az` | Azerbaijani |
|
||||
| `bn` | Bengali |
|
||||
| `bg` | Bulgarian |
|
||||
| `my` | Burmese |
|
||||
| `ca` | Catalan |
|
||||
| `cn` | Chinese |
|
||||
| `zh-tw` | Chinese (Taiwan) |
|
||||
| `ar` | Arabic |
|
||||
| `cs` | Czech |
|
||||
| `de` | German |
|
||||
| `nl` | Dutch |
|
||||
| `en` | English |
|
||||
| `bn` | Bengali |
|
||||
| `es` | Spanish |
|
||||
| `fil` | Filipino |
|
||||
| `fi` | Finnish |
|
||||
| `fr` | French |
|
||||
| `hu` | Hungarian |
|
||||
| `de` | German |
|
||||
| `el` | Greek |
|
||||
|
||||
</td><td>
|
||||
|
||||
| Code | Locale |
|
||||
| --- | --- |
|
||||
| `he` | Hebrew |
|
||||
| `hi` | Hindi |
|
||||
| `hu` | Hungarian |
|
||||
| `id` | Indonesian |
|
||||
| `it` | Italian |
|
||||
| `ja` | Japanese |
|
||||
| `kr` | Korean |
|
||||
| `nl` | Dutch |
|
||||
| `pt-pt` | Portuguese (Portugal) |
|
||||
| `pt-br` | Portuguese (Brazil) |
|
||||
| `ml` | Malayalam |
|
||||
| `np` | Nepali |
|
||||
| `el` | Greek |
|
||||
| `ru` | Russian |
|
||||
| `uk-ua` | Ukrainian |
|
||||
| `no` | Norwegian |
|
||||
| `fa` | Persian (Farsi) |
|
||||
| `pl` | Polish |
|
||||
| `pt-br` | Portuguese (Brazil) |
|
||||
| `pt-pt` | Portuguese (Portugal) |
|
||||
| `ro` | Romanian |
|
||||
|
||||
</td><td>
|
||||
|
||||
| Code | Locale |
|
||||
| --- | --- |
|
||||
| `id` | Indonesian |
|
||||
| `ml` | Malayalam |
|
||||
| `my` | Burmese |
|
||||
| `ru` | Russian |
|
||||
| `sa` | Sanskrit |
|
||||
| `sr` | Serbian (Cyrillic) |
|
||||
| `sr-latn` | Serbian (Latin) |
|
||||
| `sk` | Slovak |
|
||||
| `es` | Spanish |
|
||||
| `sw` | Swahili |
|
||||
| `se` | Swedish |
|
||||
| `ta` | Tamil |
|
||||
| `th` | Thai |
|
||||
| `tr` | Turkish |
|
||||
| `pl` | Polish |
|
||||
| `uk-ua` | Ukrainian |
|
||||
| `ur` | Urdu |
|
||||
| `uz` | Uzbek |
|
||||
| `vi` | Vietnamese |
|
||||
| `se` | Swedish |
|
||||
|
||||
</td></tr>
|
||||
</table>
|
||||
@@ -382,60 +382,16 @@ If we don't support your language, please consider contributing! You can find mo
|
||||
| `disable_animations` | Disables all animations in the card. | boolean | `false` |
|
||||
| `ring_color` | Color of the rank circle. | string (hex color) | `2f80ed` |
|
||||
| `number_format` | Switches between two available formats for displaying the card values `short` (i.e. `6.6k`) and `long` (i.e. `6626`). | enum | `short` |
|
||||
| `number_precision` | Enforce the number of digits after the decimal point for `short` number format. Must be an integer between 0 and 2. Will be ignored for `long` number format. | integer (0, 1 or 2) | `null` |
|
||||
| `show` | Shows [additional items](#showing-additional-individual-stats) on stats card (i.e. `reviews`, `discussions_started`, `discussions_answered`, `prs_merged` or `prs_merged_percentage`). | string (comma-separated values) | `null` |
|
||||
| `commits_year` | Filters and counts only commits made in the specified year. | integer _(YYYY)_ | `<current year> (one year to date)` |
|
||||
|
||||
> [!NOTE]\
|
||||
> [!WARNING]
|
||||
> Custom title should be URI-escaped, as specified in [Percent Encoding](https://en.wikipedia.org/wiki/Percent-encoding) (i.e: `Anurag's GitHub Stats` should become `Anurag%27s%20GitHub%20Stats`). You can use [urlencoder.org](https://www.urlencoder.org/) to help you do this automatically.
|
||||
|
||||
> [!NOTE]
|
||||
> When hide\_rank=`true`, the minimum card width is 270 px + the title length and padding.
|
||||
|
||||
#### Repo Card Exclusive Options
|
||||
|
||||
| Name | Description | Type | Default value |
|
||||
| --- | --- | --- | --- |
|
||||
| `show_owner` | Shows the repo's owner name. | boolean | `false` |
|
||||
| `description_lines_count` | Manually set the number of lines for the description. Specified value will be clamped between 1 and 3. If this parameter is not specified, the number of lines will be automatically adjusted according to the actual length of the description. | number | `null` |
|
||||
|
||||
#### Gist Card Exclusive Options
|
||||
|
||||
| Name | Description | Type | Default value |
|
||||
| --- | --- | --- | --- |
|
||||
| `show_owner` | Shows the gist's owner name. | boolean | `false` |
|
||||
|
||||
#### Language Card Exclusive Options
|
||||
|
||||
| Name | Description | Type | Default value |
|
||||
| --- | --- | --- | --- |
|
||||
| `hide` | Hides the [specified languages](#hide-individual-languages) from card. | string (comma-separated values) | `null` |
|
||||
| `hide_title` | Hides the title of your card. | boolean | `false` |
|
||||
| `layout` | Switches between five available layouts `normal` & `compact` & `donut` & `donut-vertical` & `pie`. | enum | `normal` |
|
||||
| `card_width` | Sets the card's width manually. | number | `300` |
|
||||
| `langs_count` | Shows more languages on the card, between 1-20. | integer | `5` for `normal` and `donut`, `6` for other layouts |
|
||||
| `exclude_repo` | Excludes specified repositories. | string (comma-separated values) | `null` |
|
||||
| `custom_title` | Sets a custom title for the card. | string | `Most Used Languages` |
|
||||
| `disable_animations` | Disables all animations in the card. | boolean | `false` |
|
||||
| `hide_progress` | Uses the compact layout option, hides percentages, and removes the bars. | boolean | `false` |
|
||||
| `size_weight` | Configures language stats algorithm (see [Language stats algorithm](#language-stats-algorithm)). | integer | `1` |
|
||||
| `count_weight` | Configures language stats algorithm (see [Language stats algorithm](#language-stats-algorithm)). | integer | `0` |
|
||||
|
||||
> [!WARNING]\
|
||||
> Language names should be URI-escaped, as specified in [Percent Encoding](https://en.wikipedia.org/wiki/Percent-encoding)
|
||||
> (i.e: `c++` should become `c%2B%2B`, `jupyter notebook` should become `jupyter%20notebook`, etc.) You can use
|
||||
> [urlencoder.org](https://www.urlencoder.org/) to help you do this automatically.
|
||||
|
||||
#### WakaTime Card Exclusive Options
|
||||
|
||||
| Name | Description | Type | Default value |
|
||||
| --- | --- | --- | --- |
|
||||
| `hide` | Hides the languages specified from the card. | string (comma-separated values) | `null` |
|
||||
| `hide_title` | Hides the title of your card. | boolean | `false` |
|
||||
| `line_height` | Sets the line height between text. | integer | `25` |
|
||||
| `hide_progress` | Hides the progress bar and percentage. | boolean | `false` |
|
||||
| `custom_title` | Sets a custom title for the card. | string | `WakaTime Stats` |
|
||||
| `layout` | Switches between two available layouts `default` & `compact`. | enum | `default` |
|
||||
| `langs_count` | Limits the number of languages on the card, defaults to all reported languages. | integer | `null` |
|
||||
| `api_domain` | Sets a custom API domain for the card, e.g. to use services like [Hakatime](https://github.com/mujx/hakatime) or [Wakapi](https://github.com/muety/wakapi) | string | `wakatime.com` |
|
||||
| `display_format` | Sets the WakaTime stats display format. Choose `time` to display time-based stats or `percent` to show percentages. | enum | `time` |
|
||||
| `disable_animations` | Disables all animations in the card. | boolean | `false` |
|
||||
|
||||
***
|
||||
|
||||
# GitHub Extra Pins
|
||||
@@ -454,11 +410,20 @@ Endpoint: `api/pin?username=anuraghazra&repo=github-readme-stats`
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
You can customize the appearance and behavior of the pinned repository card using the [common options](#common-options) and exclusive options listed in the table below.
|
||||
|
||||
| Name | Description | Type | Default value |
|
||||
| --- | --- | --- | --- |
|
||||
| `show_owner` | Shows the repo's owner name. | boolean | `false` |
|
||||
| `description_lines_count` | Manually set the number of lines for the description. Specified value will be clamped between 1 and 3. If this parameter is not specified, the number of lines will be automatically adjusted according to the actual length of the description. | number | `null` |
|
||||
|
||||
### Demo
|
||||
|
||||

|
||||
|
||||
Use [show\_owner](#repo-card-exclusive-options) query option to include the repo's owner username
|
||||
Use `show_owner` query option to include the repo's owner username
|
||||
|
||||

|
||||
|
||||
@@ -476,11 +441,19 @@ Endpoint: `api/gist?id=bbfce31e0217a3689c8d961a356cb10d`
|
||||
[](https://gist.github.com/Yizack/bbfce31e0217a3689c8d961a356cb10d/)
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
You can customize the appearance and behavior of the gist card using the [common options](#common-options) and exclusive options listed in the table below.
|
||||
|
||||
| Name | Description | Type | Default value |
|
||||
| --- | --- | --- | --- |
|
||||
| `show_owner` | Shows the gist's owner name. | boolean | `false` |
|
||||
|
||||
### Demo
|
||||
|
||||

|
||||
|
||||
Use [show\_owner](#gist-card-exclusive-options) query option to include the gist's owner username
|
||||
Use `show_owner` query option to include the gist's owner username
|
||||
|
||||

|
||||
|
||||
@@ -488,16 +461,16 @@ Use [show\_owner](#gist-card-exclusive-options) query option to include the gist
|
||||
|
||||
The top languages card shows a GitHub user's most frequently used languages.
|
||||
|
||||
> [!WARNING]\
|
||||
> [!WARNING]
|
||||
> By default, the language card shows language results only from public repositories. To include languages used in private repositories, you should [deploy your own instance](#deploy-on-your-own) using your own GitHub API token.
|
||||
|
||||
> [!NOTE]\
|
||||
> [!NOTE]
|
||||
> Top Languages does not indicate the user's 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.
|
||||
|
||||
> [!WARNING]\
|
||||
> [!WARNING]
|
||||
> This card shows language usage only inside your own non-forked repositories, not depending on who the author of the commits is. It does not include your contributions into another users/organizations repositories. Currently there are no way to get this data from GitHub API. If you want this behavior to be improved you can support [this feature request](https://github.com/orgs/community/discussions/18230) created by [@rickstaa](https://github.com/rickstaa) inside GitHub Community.
|
||||
|
||||
> [!WARNING]\
|
||||
> [!WARNING]
|
||||
> Currently this card shows data only about first 100 repositories. This is because GitHub API limitations which cause downtimes of public instances (see [#1471](https://github.com/anuraghazra/github-readme-stats/issues/1471)). In future this behavior will be improved by releasing GitHub action or providing environment variables for user's own instances.
|
||||
|
||||
### Usage
|
||||
@@ -510,6 +483,28 @@ Endpoint: `api/top-langs?username=anuraghazra`
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
You can customize the appearance and behavior of the top languages card using the [common options](#common-options) and exclusive options listed in the table below.
|
||||
|
||||
| Name | Description | Type | Default value |
|
||||
| --- | --- | --- | --- |
|
||||
| `hide` | Hides the [specified languages](#hide-individual-languages) from card. | string (comma-separated values) | `null` |
|
||||
| `hide_title` | Hides the title of your card. | boolean | `false` |
|
||||
| `layout` | Switches between five available layouts `normal` & `compact` & `donut` & `donut-vertical` & `pie`. | enum | `normal` |
|
||||
| `card_width` | Sets the card's width manually. | number | `300` |
|
||||
| `langs_count` | Shows more languages on the card, between 1-20. | integer | `5` for `normal` and `donut`, `6` for other layouts |
|
||||
| `exclude_repo` | Excludes specified repositories. | string (comma-separated values) | `null` |
|
||||
| `custom_title` | Sets a custom title for the card. | string | `Most Used Languages` |
|
||||
| `disable_animations` | Disables all animations in the card. | boolean | `false` |
|
||||
| `hide_progress` | Uses the compact layout option, hides percentages, and removes the bars. | boolean | `false` |
|
||||
| `size_weight` | Configures language stats algorithm (see [Language stats algorithm](#language-stats-algorithm)). | integer | `1` |
|
||||
| `count_weight` | Configures language stats algorithm (see [Language stats algorithm](#language-stats-algorithm)). | integer | `0` |
|
||||
| `stats_format` | Switches between two available formats for language's stats `percentages` and `bytes`. | enum | `percentages` |
|
||||
|
||||
> [!WARNING]
|
||||
> Language names and custom title should be URI-escaped, as specified in [Percent Encoding](https://en.wikipedia.org/wiki/Percent-encoding) (i.e: `c++` should become `c%2B%2B`, `jupyter notebook` should become `jupyter%20notebook`, `Most Used Languages` should become `Most%20Used%20Languages`, etc.) You can use [urlencoder.org](https://www.urlencoder.org/) to help you do this automatically.
|
||||
|
||||
### Language stats algorithm
|
||||
|
||||
We use the following algorithm to calculate the languages percentages on the language card:
|
||||
@@ -592,6 +587,15 @@ You can use the `&hide_progress=true` option to hide the percentages and the pro
|
||||

|
||||
```
|
||||
|
||||
### Change format of language's stats
|
||||
|
||||
You can use the `&stats_format=bytes` option to display the stats in bytes instead of percentage.
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
|
||||
### Demo
|
||||
|
||||

|
||||
@@ -616,17 +620,46 @@ You can use the `&hide_progress=true` option to hide the percentages and the pro
|
||||
|
||||

|
||||
|
||||
|
||||
* Display bytes instead of percentage
|
||||
|
||||

|
||||
|
||||
# WakaTime Stats Card
|
||||
|
||||
> [!WARNING]\
|
||||
> [!WARNING]
|
||||
> Please be aware that we currently only show data from WakaTime profiles that are public. You therefore have to make sure that **BOTH** `Display code time publicly` and `Display languages, editors, os, categories publicly` are enabled.
|
||||
|
||||
> [!WARNING]
|
||||
> In case you just created a new WakaTime account, then it might take up to 24 hours until your stats will become visible on the WakaTime stats card.
|
||||
|
||||
Change the `?username=` value to your [WakaTime](https://wakatime.com) username.
|
||||
|
||||
```md
|
||||
[](https://github.com/anuraghazra/github-readme-stats)
|
||||
```
|
||||
|
||||
### Options
|
||||
|
||||
You can customize the appearance and behavior of the WakaTime stats card using the [common options](#common-options) and exclusive options listed in the table below.
|
||||
|
||||
| Name | Description | Type | Default value |
|
||||
| --- | --- | --- | --- |
|
||||
| `hide` | Hides the languages specified from the card. | string (comma-separated values) | `null` |
|
||||
| `hide_title` | Hides the title of your card. | boolean | `false` |
|
||||
| `card_width` | Sets the card's width manually. | number | `495` |
|
||||
| `line_height` | Sets the line height between text. | integer | `25` |
|
||||
| `hide_progress` | Hides the progress bar and percentage. | boolean | `false` |
|
||||
| `custom_title` | Sets a custom title for the card. | string | `WakaTime Stats` |
|
||||
| `layout` | Switches between two available layouts `default` & `compact`. | enum | `default` |
|
||||
| `langs_count` | Limits the number of languages on the card, defaults to all reported languages. | integer | `null` |
|
||||
| `api_domain` | Sets a custom API domain for the card, e.g. to use services like [Hakatime](https://github.com/mujx/hakatime) or [Wakapi](https://github.com/muety/wakapi) | string | `wakatime.com` |
|
||||
| `display_format` | Sets the WakaTime stats display format. Choose `time` to display time-based stats or `percent` to show percentages. | enum | `time` |
|
||||
| `disable_animations` | Disables all animations in the card. | boolean | `false` |
|
||||
|
||||
> [!WARNING]
|
||||
> Custom title should be URI-escaped, as specified in [Percent Encoding](https://en.wikipedia.org/wiki/Percent-encoding) (i.e: `WakaTime Stats` should become `WakaTime%20Stats`). You can use [urlencoder.org](https://www.urlencoder.org/) to help you do this automatically.
|
||||
|
||||
### Demo
|
||||
|
||||

|
||||
@@ -657,7 +690,7 @@ Change the `?username=` value to your [WakaTime](https://wakatime.com) username.
|
||||
|
||||

|
||||
|
||||
* Shows Github logo instead rank level
|
||||
* Shows GitHub logo instead rank level
|
||||
|
||||

|
||||
|
||||
@@ -715,7 +748,9 @@ Choose from any of the [default themes](#themes)
|
||||
|
||||
## Quick Tip (Align The Cards)
|
||||
|
||||
By default, GitHub does not lay out the cards side by side. To do that, you can use this approach:
|
||||
By default, GitHub does not lay out the cards side by side. To do that, you can use such approaches:
|
||||
|
||||
### Stats and top languages cards
|
||||
|
||||
```html
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats">
|
||||
@@ -726,6 +761,20 @@ By default, GitHub does not lay out the cards side by side. To do that, you can
|
||||
</a>
|
||||
```
|
||||
|
||||
<details>
|
||||
<summary>:eyes: Show example</summary>
|
||||
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats">
|
||||
<img height=200 align="center" src="https://github-readme-stats.vercel.app/api?username=anuraghazra" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img height=200 align="center" src="https://github-readme-stats.vercel.app/api/top-langs?username=anuraghazra&layout=compact&langs_count=8&card_width=320" />
|
||||
</a>
|
||||
|
||||
</details>
|
||||
|
||||
### Pinning repositories
|
||||
|
||||
```html
|
||||
<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" />
|
||||
@@ -738,15 +787,6 @@ By default, GitHub does not lay out the cards side by side. To do that, you can
|
||||
<details>
|
||||
<summary>:eyes: Show example</summary>
|
||||
|
||||
<a href="https://github.com/anuraghazra/github-readme-stats">
|
||||
<img height=200 align="center" src="https://github-readme-stats.vercel.app/api?username=anuraghazra" />
|
||||
</a>
|
||||
<a href="https://github.com/anuraghazra/convoychat">
|
||||
<img height=200 align="center" src="https://github-readme-stats.vercel.app/api/top-langs?username=anuraghazra&layout=compact&langs_count=8&card_width=320" />
|
||||
</a>
|
||||
|
||||
***
|
||||
|
||||
<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" />
|
||||
</a>
|
||||
@@ -756,18 +796,101 @@ By default, GitHub does not lay out the cards side by side. To do that, you can
|
||||
|
||||
</details>
|
||||
|
||||
# Deploy on your own
|
||||
# Deploy on your own (recommended)
|
||||
|
||||
## On Vercel
|
||||
Because the public endpoint is [not reliable](#Important-Notices), we recommend self-deployment via GitHub Actions or your own hosted instance. GitHub Actions is the simplest setup with static SVGs stored in your repo but less frequent updates, while self-hosting takes more work and can serve fresher stats (with caching).
|
||||
|
||||
## GitHub Actions
|
||||
|
||||
GitHub Actions generates static SVGs and avoids per-request API calls. By default it uses `GITHUB_TOKEN` (public stats only), for private stats, set a [PAT](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens) as a secret and pass it to the action instead.
|
||||
|
||||
Create `/.github/workflows/grs.yml` in your profile repo (`USERNAME/USERNAME`):
|
||||
|
||||
```yaml
|
||||
name: Update README cards
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "0 3 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- name: Generate stats card
|
||||
uses: readme-tools/github-readme-stats-action@v1
|
||||
with:
|
||||
card: stats
|
||||
options: username=${{ github.repository_owner }}&show_icons=true
|
||||
path: profile/stats.svg
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Commit cards
|
||||
run: |
|
||||
git config user.name "github-actions"
|
||||
git config user.email "github-actions@users.noreply.github.com"
|
||||
git add profile/*.svg
|
||||
git commit -m "Update README cards" || exit 0
|
||||
git push
|
||||
```
|
||||
|
||||
Then embed from your profile README:
|
||||
|
||||
```md
|
||||

|
||||
```
|
||||
|
||||
See more options and examples in the [GitHub Readme Stats Action README](https://github.com/readme-tools/github-readme-stats-action#readme).
|
||||
|
||||
## Self-hosted (Vercel/Other)
|
||||
|
||||
Running your own instance avoids public rate limits and gives you full control over caching, tokens, and private stats.
|
||||
|
||||
### First step: get your Personal Access Token (PAT)
|
||||
|
||||
For deploying your own instance of GitHub Readme Stats, you will need to create a GitHub Personal Access Token (PAT). Below are the steps to create one and the scopes you need to select for both classic and fine-grained tokens.
|
||||
|
||||
Selecting the right scopes for your token is important in case you want to display private contributions on your cards.
|
||||
|
||||
#### Classic token
|
||||
|
||||
* Go to [Account -> Settings -> Developer Settings -> Personal access tokens -> Tokens (classic)](https://github.com/settings/tokens).
|
||||
* Click on `Generate new token -> Generate new token (classic)`.
|
||||
* Scopes to select:
|
||||
* repo
|
||||
* read:user
|
||||
* Click on `Generate token` and copy it.
|
||||
|
||||
#### Fine-grained token
|
||||
|
||||
> [!WARNING]\
|
||||
> This limits the scope to issues in your repositories and includes only public commits.
|
||||
|
||||
* Go to [Account -> Settings -> Developer Settings -> Personal access tokens -> Fine-grained tokens](https://github.com/settings/tokens).
|
||||
* Click on `Generate new token -> Generate new token`.
|
||||
* Select an expiration date
|
||||
* Select `All repositories`
|
||||
* Scopes to select in `Repository permission`:
|
||||
* Commit statuses: read-only
|
||||
* Contents: read-only
|
||||
* Issues: read-only
|
||||
* Metadata: read-only
|
||||
* Pull requests: read-only
|
||||
* Click on `Generate token` and copy it.
|
||||
|
||||
### On Vercel
|
||||
|
||||
### :film\_projector: [Check Out Step By Step Video Tutorial By @codeSTACKr](https://youtu.be/n6d4KHSKqGk?t=107)
|
||||
|
||||
Since the GitHub API only allows 5k requests per hour, my `https://github-readme-stats.vercel.app/api` could possibly hit the rate limiter. If you host it on your own Vercel server, then you do not have to worry about anything. Click on the deploy button to get started!
|
||||
|
||||
> [!NOTE]\
|
||||
> [!NOTE]
|
||||
> Since [#58](https://github.com/anuraghazra/github-readme-stats/pull/58), we should be able to handle more than 5k requests and have fewer issues with downtime :grin:.
|
||||
|
||||
> [!NOTE]\
|
||||
> [!NOTE]
|
||||
> If you are on the [Pro (i.e. paid)](https://vercel.com/pricing) Vercel plan, the [maxDuration](https://vercel.com/docs/concepts/projects/project-configuration#value-definition) value found in the [vercel.json](https://github.com/anuraghazra/github-readme-stats/blob/master/vercel.json) can be increased when your Vercel instance frequently times out during the card request. You are advised to keep this value lower than `30` seconds to prevent high memory usage.
|
||||
|
||||
[](https://vercel.com/import/project?template=https://github.com/anuraghazra/github-readme-stats)
|
||||
@@ -787,23 +910,23 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme
|
||||

|
||||
8. Click the `Continue with GitHub` button, search for the required Git Repository and import it by clicking the `Import` button. Alternatively, you can import a Third-Party Git Repository using the `Import Third-Party Git Repository ->` link at the bottom of the page.
|
||||

|
||||
9. Create a personal access token (PAT) [here](https://github.com/settings/tokens/new) and enable the `repo` and `user` permissions (this allows access to see private repo and user stats).
|
||||
9. Create a Personal Access Token (PAT) as described in the [previous section](#first-step-get-your-personal-access-token-pat).
|
||||
10. Add the PAT as an environment variable named `PAT_1` (as shown).
|
||||

|
||||
11. Click deploy, and you're good to go. See your domains to use the API!
|
||||
|
||||
</details>
|
||||
|
||||
## On other platforms
|
||||
### On other platforms
|
||||
|
||||
> [!WARNING]\
|
||||
> [!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](https://github.com/anuraghazra/github-readme-stats/discussions/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`
|
||||
2. Move `express` from the devDependencies 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
|
||||
@@ -811,14 +934,52 @@ Since the GitHub API only allows 5k requests per hour, my `https://github-readme
|
||||
5. You're done 🎉
|
||||
</details>
|
||||
|
||||
## Disable rate limit protections
|
||||
### Available environment variables
|
||||
|
||||
Github Readme Stats contains several Vercel environment variables that can be used to remove the rate limit protections:
|
||||
GitHub Readme Stats provides several environment variables that can be used to customize the behavior of your self-hosted instance. These include:
|
||||
|
||||
* `CACHE_SECONDS`: This environment variable takes precedence over our cache minimum and maximum values and can circumvent these values for self-hosted Vercel instances.
|
||||
<table>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Description</th>
|
||||
<th>Supported values</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><code>CACHE_SECONDS</code></td>
|
||||
<td>Sets the cache duration in seconds for the generated cards. This variable takes precedence over the default cache timings for the public instance. If this variable is not set, the default cache duration is 24 hours (86,400 seconds).</td>
|
||||
<td>Any positive integer or <code>0</code> to disable caching</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>WHITELIST</code></td>
|
||||
<td>A comma-separated list of GitHub usernames that are allowed to access your instance. If this variable is not set, all usernames are allowed.</td>
|
||||
<td>Comma-separated GitHub usernames</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>GIST_WHITELIST</code></td>
|
||||
<td>A comma-separated list of GitHub Gist IDs that are allowed to be accessed on your instance. If this variable is not set, all Gist IDs are allowed.</td>
|
||||
<td>Comma-separated GitHub Gist IDs</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>EXCLUDE_REPO</code></td>
|
||||
<td>A comma-separated list of repositories that will be excluded from stats and top languages cards on your instance. This allows repository exclusion without exposing repository names in public URLs. This enhances privacy for self-hosted instances that include private repositories in stats cards.</td>
|
||||
<td>Comma-separated repository names</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><code>FETCH_MULTI_PAGE_STARS</code></td>
|
||||
<td>Enables fetching all starred repositories for accurate star counts, especially for users with more than 100 repositories. This may increase response times and API points usage, so it is disabled on the public instance.</td>
|
||||
<td><code>true</code> or <code>false</code></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
See [the Vercel documentation](https://vercel.com/docs/concepts/projects/environment-variables) on adding these environment variables to your Vercel instance.
|
||||
|
||||
> [!WARNING]
|
||||
> Please remember to redeploy your instance after making any changes to the environment variables so that the updates take effect. The changes will not be applied to the previous deployments.
|
||||
|
||||
## Keep your fork up to date
|
||||
|
||||
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.
|
||||
@@ -832,7 +993,7 @@ However, if you are using this project and are happy with it or just want to enc
|
||||
|
||||
* Giving proper credit when you use github-readme-stats on your readme, linking back to it. :D
|
||||
* Starring and sharing the project. :rocket:
|
||||
* [](https://www.paypal.me/anuraghazra) - You can make a one-time donations via PayPal. I'll probably buy a ~~coffee~~ tea. :tea:
|
||||
* [](https://www.paypal.me/anuraghazra) - You can make a one-time donation via PayPal. I'll probably buy a ~~coffee~~ tea. :tea:
|
||||
|
||||
Thanks! :heart:
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ Use \`?theme=THEME_NAME\` parameter like so:
|
||||
|
||||
## Stats
|
||||
|
||||
> These themes works with all five our cards: Stats Card, Repo Card, Gist Card, Top languages Card and WakaTime Card.
|
||||
> These themes work with all five of our cards: Stats Card, Repo Card, Gist Card, Top Languages Card, and WakaTime Card.
|
||||
|
||||
| | | |
|
||||
| :--: | :--: | :--: |
|
||||
@@ -30,7 +30,7 @@ ${STAT_CARD_TABLE_FLAG}
|
||||
|
||||
## Repo Card
|
||||
|
||||
> These themes works with all five our cards: Stats Card, Repo Card, Gist Card, Top languages Card and WakaTime Card.
|
||||
> These themes work with all five of our cards: Stats Card, Repo Card, Gist Card, Top Languages Card, and WakaTime Card.
|
||||
|
||||
| | | |
|
||||
| :--: | :--: | :--: |
|
||||
@@ -39,11 +39,6 @@ ${REPO_CARD_TABLE_FLAG}
|
||||
${STAT_CARD_LINKS_FLAG}
|
||||
|
||||
${REPO_CARD_LINKS_FLAG}
|
||||
|
||||
|
||||
[add-theme]: https://github.com/anuraghazra/github-readme-stats/edit/master/themes/index.js
|
||||
|
||||
Want to add a new theme? Consider reading the [contribution guidelines](../CONTRIBUTING.md#themes-contribution) :D
|
||||
`;
|
||||
|
||||
const createRepoMdLink = (theme) => {
|
||||
@@ -81,15 +76,7 @@ const generateTable = ({ isRepoCard }) => {
|
||||
let tableItem2 = createTableItem({ link: two, label: two, isRepoCard });
|
||||
let tableItem3 = createTableItem({ link: three, label: three, isRepoCard });
|
||||
|
||||
if (three === undefined) {
|
||||
tableItem3 = `[Add your theme][add-theme]`;
|
||||
}
|
||||
rows.push(`| ${tableItem1} | ${tableItem2} | ${tableItem3} |`);
|
||||
|
||||
// if it's the last row & the row has no empty space push a new row
|
||||
if (three && i + 3 === themesFiltered.length) {
|
||||
rows.push(`| [Add your theme][add-theme] | | |`);
|
||||
}
|
||||
}
|
||||
|
||||
return rows.join("\n");
|
||||
|
||||
@@ -20,6 +20,9 @@ export const getRepoInfo = (ctx) => {
|
||||
repo: ctx.repo.repo,
|
||||
};
|
||||
} catch (error) {
|
||||
// Resolve eslint no-unused-vars
|
||||
error;
|
||||
|
||||
return {
|
||||
owner: OWNER,
|
||||
repo: REPO,
|
||||
|
||||
@@ -12,7 +12,7 @@ import Hjson from "hjson";
|
||||
import snakeCase from "lodash.snakecase";
|
||||
import parse from "parse-diff";
|
||||
import { inspect } from "util";
|
||||
import { isValidHexColor, isValidGradient } from "../src/common/utils.js";
|
||||
import { isValidHexColor, isValidGradient } from "../src/common/color.js";
|
||||
import { themes } from "../themes/index.js";
|
||||
import { getGithubToken, getRepoInfo } from "./helpers.js";
|
||||
|
||||
@@ -332,6 +332,9 @@ const parseJSON = (json) => {
|
||||
);
|
||||
}
|
||||
} catch (error) {
|
||||
// Resolve eslint no-unused-vars
|
||||
error;
|
||||
|
||||
// Remove trailing commas (if any).
|
||||
let parsedJson = json.replace(/(,\s*})/g, "}");
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ function log_normal_cdf(x) {
|
||||
* @param {number} params.repos Total number of repos.
|
||||
* @param {number} params.stars The number of stars.
|
||||
* @param {number} params.followers The number of followers.
|
||||
* @returns {{level: string, percentile: number}}} The users rank.
|
||||
* @returns {{ level: string, percentile: number }} The users rank.
|
||||
*/
|
||||
function calculateRank({
|
||||
all_commits,
|
||||
|
||||
@@ -1,18 +1,17 @@
|
||||
// @ts-check
|
||||
|
||||
import {
|
||||
getCardColors,
|
||||
parseEmojis,
|
||||
wrapTextMultiline,
|
||||
encodeHTML,
|
||||
kFormatter,
|
||||
measureText,
|
||||
flexLayout,
|
||||
iconWithLabel,
|
||||
createLanguageNode,
|
||||
} from "../common/utils.js";
|
||||
} from "../common/render.js";
|
||||
import Card from "../common/Card.js";
|
||||
import { getCardColors } from "../common/color.js";
|
||||
import { kFormatter, wrapTextMultiline } from "../common/fmt.js";
|
||||
import { encodeHTML } from "../common/html.js";
|
||||
import { icons } from "../common/icons.js";
|
||||
import { parseEmojis } from "../common/ops.js";
|
||||
|
||||
/** Import language colors.
|
||||
*
|
||||
@@ -96,6 +95,7 @@ const renderGistCard = (gistData, options = {}) => {
|
||||
);
|
||||
|
||||
const languageName = language || "Unspecified";
|
||||
// @ts-ignore
|
||||
const languageColor = languageColors[languageName] || "#858585";
|
||||
|
||||
const svgLanguage = createLanguageNode(languageName, languageColor);
|
||||
+4
-4
@@ -1,4 +1,4 @@
|
||||
export { renderRepoCard } from "./repo-card.js";
|
||||
export { renderStatsCard } from "./stats-card.js";
|
||||
export { renderTopLanguages } from "./top-languages-card.js";
|
||||
export { renderWakatimeCard } from "./wakatime-card.js";
|
||||
export { renderRepoCard } from "./repo.js";
|
||||
export { renderStatsCard } from "./stats.js";
|
||||
export { renderTopLanguages } from "./top-languages.js";
|
||||
export { renderWakatimeCard } from "./wakatime.js";
|
||||
|
||||
@@ -1,19 +1,18 @@
|
||||
// @ts-check
|
||||
|
||||
import { Card } from "../common/Card.js";
|
||||
import { getCardColors } from "../common/color.js";
|
||||
import { kFormatter, wrapTextMultiline } from "../common/fmt.js";
|
||||
import { encodeHTML } from "../common/html.js";
|
||||
import { I18n } from "../common/I18n.js";
|
||||
import { icons } from "../common/icons.js";
|
||||
import { clampValue, parseEmojis } from "../common/ops.js";
|
||||
import {
|
||||
encodeHTML,
|
||||
flexLayout,
|
||||
getCardColors,
|
||||
kFormatter,
|
||||
measureText,
|
||||
parseEmojis,
|
||||
wrapTextMultiline,
|
||||
iconWithLabel,
|
||||
createLanguageNode,
|
||||
clampValue,
|
||||
} from "../common/utils.js";
|
||||
} from "../common/render.js";
|
||||
import { repoCardLocales } from "../translations.js";
|
||||
|
||||
const ICON_SIZE = 16;
|
||||
@@ -1,16 +1,14 @@
|
||||
// @ts-check
|
||||
|
||||
import { Card } from "../common/Card.js";
|
||||
import { getCardColors } from "../common/color.js";
|
||||
import { CustomError } from "../common/error.js";
|
||||
import { kFormatter } from "../common/fmt.js";
|
||||
import { I18n } from "../common/I18n.js";
|
||||
import { icons, rankIcon } from "../common/icons.js";
|
||||
import {
|
||||
CustomError,
|
||||
clampValue,
|
||||
flexLayout,
|
||||
getCardColors,
|
||||
kFormatter,
|
||||
measureText,
|
||||
} from "../common/utils.js";
|
||||
import { statCardLocales } from "../translations.js";
|
||||
import { clampValue } from "../common/ops.js";
|
||||
import { flexLayout, measureText } from "../common/render.js";
|
||||
import { statCardLocales, wakatimeCardLocales } from "../translations.js";
|
||||
|
||||
const CARD_MIN_WIDTH = 287;
|
||||
const CARD_DEFAULT_WIDTH = 287;
|
||||
@@ -19,20 +17,55 @@ const RANK_CARD_DEFAULT_WIDTH = 450;
|
||||
const RANK_ONLY_CARD_MIN_WIDTH = 290;
|
||||
const RANK_ONLY_CARD_DEFAULT_WIDTH = 290;
|
||||
|
||||
/**
|
||||
* Long locales that need more space for text. Keep sorted alphabetically.
|
||||
*
|
||||
* @type {(keyof typeof wakatimeCardLocales["wakatimecard.title"])[]}
|
||||
*/
|
||||
const LONG_LOCALES = [
|
||||
"az",
|
||||
"bg",
|
||||
"cs",
|
||||
"de",
|
||||
"el",
|
||||
"es",
|
||||
"fil",
|
||||
"fi",
|
||||
"fr",
|
||||
"hu",
|
||||
"id",
|
||||
"ja",
|
||||
"ml",
|
||||
"my",
|
||||
"nl",
|
||||
"pl",
|
||||
"pt-br",
|
||||
"pt-pt",
|
||||
"ru",
|
||||
"sr",
|
||||
"sr-latn",
|
||||
"sw",
|
||||
"ta",
|
||||
"uk-ua",
|
||||
"uz",
|
||||
"zh-tw",
|
||||
];
|
||||
|
||||
/**
|
||||
* Create a stats card text item.
|
||||
*
|
||||
* @param {object} createTextNodeParams Object that contains the createTextNode parameters.
|
||||
* @param {string} createTextNodeParams.icon The icon to display.
|
||||
* @param {string} createTextNodeParams.label The label to display.
|
||||
* @param {number} createTextNodeParams.value The value to display.
|
||||
* @param {string} createTextNodeParams.id The id of the stat.
|
||||
* @param {string=} createTextNodeParams.unitSymbol The unit symbol of the stat.
|
||||
* @param {number} createTextNodeParams.index The index of the stat.
|
||||
* @param {boolean} createTextNodeParams.showIcons Whether to show icons.
|
||||
* @param {number} createTextNodeParams.shiftValuePos Number of pixels the value has to be shifted to the right.
|
||||
* @param {boolean} createTextNodeParams.bold Whether to bold the label.
|
||||
* @param {string} createTextNodeParams.number_format The format of numbers on card.
|
||||
* @param {object} params Object that contains the createTextNode parameters.
|
||||
* @param {string} params.icon The icon to display.
|
||||
* @param {string} params.label The label to display.
|
||||
* @param {number} params.value The value to display.
|
||||
* @param {string} params.id The id of the stat.
|
||||
* @param {string=} params.unitSymbol The unit symbol of the stat.
|
||||
* @param {number} params.index The index of the stat.
|
||||
* @param {boolean} params.showIcons Whether to show icons.
|
||||
* @param {number} params.shiftValuePos Number of pixels the value has to be shifted to the right.
|
||||
* @param {boolean} params.bold Whether to bold the label.
|
||||
* @param {string} params.numberFormat The format of numbers on card.
|
||||
* @param {number=} params.numberPrecision The precision of numbers on card.
|
||||
* @returns {string} The stats card text item SVG object.
|
||||
*/
|
||||
const createTextNode = ({
|
||||
@@ -45,10 +78,17 @@ const createTextNode = ({
|
||||
showIcons,
|
||||
shiftValuePos,
|
||||
bold,
|
||||
number_format,
|
||||
numberFormat,
|
||||
numberPrecision,
|
||||
}) => {
|
||||
const precision =
|
||||
typeof numberPrecision === "number" && !isNaN(numberPrecision)
|
||||
? clampValue(numberPrecision, 0, 2)
|
||||
: undefined;
|
||||
const kValue =
|
||||
number_format.toLowerCase() === "long" ? value : kFormatter(value);
|
||||
numberFormat.toLowerCase() === "long" || id === "prs_merged_percentage"
|
||||
? value
|
||||
: kFormatter(value, precision);
|
||||
const staggerDelay = (index + 3) * 150;
|
||||
|
||||
const labelOffset = showIcons ? `x="25"` : "";
|
||||
@@ -187,6 +227,21 @@ const getStyles = ({
|
||||
`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Return the label for commits according to the selected options
|
||||
*
|
||||
* @param {boolean} include_all_commits Option to include all years
|
||||
* @param {number|undefined} commits_year Option to include only selected year
|
||||
* @param {I18n} i18n The I18n instance.
|
||||
* @returns {string} The label corresponding to the options.
|
||||
*/
|
||||
const getTotalCommitsYearLabel = (include_all_commits, commits_year, i18n) =>
|
||||
include_all_commits
|
||||
? ""
|
||||
: commits_year
|
||||
? ` (${commits_year})`
|
||||
: ` (${i18n.t("wakatimecard.lastyear")})`;
|
||||
|
||||
/**
|
||||
* @typedef {import('../fetchers/types').StatsData} StatsData
|
||||
* @typedef {import('./types').StatCardOptions} StatCardOptions
|
||||
@@ -222,6 +277,7 @@ const renderStatsCard = (stats, options = {}) => {
|
||||
card_width,
|
||||
hide_rank = false,
|
||||
include_all_commits = false,
|
||||
commits_year,
|
||||
line_height = 25,
|
||||
title_color,
|
||||
ring_color,
|
||||
@@ -234,6 +290,7 @@ const renderStatsCard = (stats, options = {}) => {
|
||||
border_radius,
|
||||
border_color,
|
||||
number_format = "short",
|
||||
number_precision,
|
||||
locale,
|
||||
disable_animations = false,
|
||||
rank_icon = "default",
|
||||
@@ -254,12 +311,13 @@ const renderStatsCard = (stats, options = {}) => {
|
||||
theme,
|
||||
});
|
||||
|
||||
const apostrophe = ["x", "s"].includes(name.slice(-1).toLocaleLowerCase())
|
||||
? ""
|
||||
: "s";
|
||||
const apostrophe = /s$/i.test(name.trim()) ? "" : "s";
|
||||
const i18n = new I18n({
|
||||
locale,
|
||||
translations: statCardLocales({ name, apostrophe }),
|
||||
translations: {
|
||||
...statCardLocales({ name, apostrophe }),
|
||||
...wakatimeCardLocales,
|
||||
},
|
||||
});
|
||||
|
||||
// Meta data for creating text nodes with createTextNode function
|
||||
@@ -273,9 +331,11 @@ const renderStatsCard = (stats, options = {}) => {
|
||||
};
|
||||
STATS.commits = {
|
||||
icon: icons.commits,
|
||||
label: `${i18n.t("statcard.commits")}${
|
||||
include_all_commits ? "" : ` (${new Date().getFullYear()})`
|
||||
}`,
|
||||
label: `${i18n.t("statcard.commits")}${getTotalCommitsYearLabel(
|
||||
include_all_commits,
|
||||
commits_year,
|
||||
i18n,
|
||||
)}`,
|
||||
value: totalCommits,
|
||||
id: "commits",
|
||||
};
|
||||
@@ -299,7 +359,11 @@ const renderStatsCard = (stats, options = {}) => {
|
||||
STATS.prs_merged_percentage = {
|
||||
icon: icons.prs_merged_percentage,
|
||||
label: i18n.t("statcard.prs-merged-percentage"),
|
||||
value: mergedPRsPercentage.toFixed(2),
|
||||
value: mergedPRsPercentage.toFixed(
|
||||
typeof number_precision === "number" && !isNaN(number_precision)
|
||||
? clampValue(number_precision, 0, 2)
|
||||
: 2,
|
||||
),
|
||||
id: "prs_merged_percentage",
|
||||
unitSymbol: "%",
|
||||
};
|
||||
@@ -345,42 +409,31 @@ const renderStatsCard = (stats, options = {}) => {
|
||||
id: "contribs",
|
||||
};
|
||||
|
||||
const longLocales = [
|
||||
"cn",
|
||||
"es",
|
||||
"fr",
|
||||
"pt-br",
|
||||
"ru",
|
||||
"uk-ua",
|
||||
"id",
|
||||
"ml",
|
||||
"my",
|
||||
"pl",
|
||||
"de",
|
||||
"nl",
|
||||
"zh-tw",
|
||||
"uz",
|
||||
];
|
||||
const isLongLocale = locale ? longLocales.includes(locale) : false;
|
||||
// @ts-ignore
|
||||
const isLongLocale = locale ? LONG_LOCALES.includes(locale) : false;
|
||||
|
||||
// filter out hidden stats defined by user & create the text nodes
|
||||
const statItems = Object.keys(STATS)
|
||||
.filter((key) => !hide.includes(key))
|
||||
.map((key, index) =>
|
||||
.map((key, index) => {
|
||||
// @ts-ignore
|
||||
const stats = STATS[key];
|
||||
|
||||
// create the text nodes, and pass index so that we can calculate the line spacing
|
||||
createTextNode({
|
||||
icon: STATS[key].icon,
|
||||
label: STATS[key].label,
|
||||
value: STATS[key].value,
|
||||
id: STATS[key].id,
|
||||
unitSymbol: STATS[key].unitSymbol,
|
||||
return createTextNode({
|
||||
icon: stats.icon,
|
||||
label: stats.label,
|
||||
value: stats.value,
|
||||
id: stats.id,
|
||||
unitSymbol: stats.unitSymbol,
|
||||
index,
|
||||
showIcons: show_icons,
|
||||
shiftValuePos: 79.01 + (isLongLocale ? 50 : 0),
|
||||
bold: text_bold,
|
||||
number_format,
|
||||
}),
|
||||
);
|
||||
numberFormat: number_format,
|
||||
numberPrecision: number_precision,
|
||||
});
|
||||
});
|
||||
|
||||
if (statItems.length === 0 && hide_rank) {
|
||||
throw new CustomError(
|
||||
@@ -515,12 +568,16 @@ const renderStatsCard = (stats, options = {}) => {
|
||||
const labels = Object.keys(STATS)
|
||||
.filter((key) => !hide.includes(key))
|
||||
.map((key) => {
|
||||
// @ts-ignore
|
||||
const stats = STATS[key];
|
||||
if (key === "commits") {
|
||||
return `${i18n.t("statcard.commits")} ${
|
||||
include_all_commits ? "" : `in ${new Date().getFullYear()}`
|
||||
} : ${STATS[key].value}`;
|
||||
return `${i18n.t("statcard.commits")} ${getTotalCommitsYearLabel(
|
||||
include_all_commits,
|
||||
commits_year,
|
||||
i18n,
|
||||
)} : ${stats.value}`;
|
||||
}
|
||||
return `${STATS[key].label}: ${STATS[key].value}`;
|
||||
return `${stats.label}: ${stats.value}`;
|
||||
})
|
||||
.join(", ");
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
// @ts-check
|
||||
|
||||
import { Card } from "../common/Card.js";
|
||||
import { createProgressNode } from "../common/createProgressNode.js";
|
||||
import { getCardColors } from "../common/color.js";
|
||||
import { formatBytes } from "../common/fmt.js";
|
||||
import { I18n } from "../common/I18n.js";
|
||||
import { chunkArray, clampValue, lowercaseTrim } from "../common/ops.js";
|
||||
import {
|
||||
chunkArray,
|
||||
clampValue,
|
||||
createProgressNode,
|
||||
flexLayout,
|
||||
getCardColors,
|
||||
lowercaseTrim,
|
||||
measureText,
|
||||
} from "../common/utils.js";
|
||||
} from "../common/render.js";
|
||||
import { langCardLocales } from "../translations.js";
|
||||
|
||||
const DEFAULT_CARD_WIDTH = 300;
|
||||
@@ -179,6 +179,7 @@ const trimTopLanguages = (topLangs, langs_count, hide) => {
|
||||
// while filtering out
|
||||
if (hide) {
|
||||
hide.forEach((langName) => {
|
||||
// @ts-ignore
|
||||
langsToHide[lowercaseTrim(langName)] = true;
|
||||
});
|
||||
}
|
||||
@@ -187,6 +188,7 @@ const trimTopLanguages = (topLangs, langs_count, hide) => {
|
||||
langs = langs
|
||||
.sort((a, b) => b.size - a.size)
|
||||
.filter((lang) => {
|
||||
// @ts-ignore
|
||||
return !langsToHide[lowercaseTrim(lang.name)];
|
||||
})
|
||||
.slice(0, langsCount);
|
||||
@@ -196,6 +198,18 @@ const trimTopLanguages = (topLangs, langs_count, hide) => {
|
||||
return { langs, totalLanguageSize };
|
||||
};
|
||||
|
||||
/**
|
||||
* Get display value corresponding to the format.
|
||||
*
|
||||
* @param {number} size Bytes size.
|
||||
* @param {number} percentages Percentage value.
|
||||
* @param {string} format Format of the stats.
|
||||
* @returns {string} Display value.
|
||||
*/
|
||||
const getDisplayValue = (size, percentages, format) => {
|
||||
return format === "bytes" ? formatBytes(size) : `${percentages.toFixed(2)}%`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create progress bar text item for a programming language.
|
||||
*
|
||||
@@ -203,20 +217,33 @@ const trimTopLanguages = (topLangs, langs_count, hide) => {
|
||||
* @param {number} props.width The card width
|
||||
* @param {string} props.color Color of the programming language.
|
||||
* @param {string} props.name Name of the programming language.
|
||||
* @param {number} props.progress Usage of the programming language in percentage.
|
||||
* @param {number} props.size Size of the programming language.
|
||||
* @param {number} props.totalSize Total size of all languages.
|
||||
* @param {string} props.statsFormat Stats format.
|
||||
* @param {number} props.index Index of the programming language.
|
||||
* @returns {string} Programming language SVG node.
|
||||
*/
|
||||
const createProgressTextNode = ({ width, color, name, progress, index }) => {
|
||||
const createProgressTextNode = ({
|
||||
width,
|
||||
color,
|
||||
name,
|
||||
size,
|
||||
totalSize,
|
||||
statsFormat,
|
||||
index,
|
||||
}) => {
|
||||
const staggerDelay = (index + 3) * 150;
|
||||
const paddingRight = 95;
|
||||
const progressTextX = width - paddingRight + 10;
|
||||
const progressWidth = width - paddingRight;
|
||||
|
||||
const progress = (size / totalSize) * 100;
|
||||
const displayValue = getDisplayValue(size, progress, statsFormat);
|
||||
|
||||
return `
|
||||
<g class="stagger" style="animation-delay: ${staggerDelay}ms">
|
||||
<text data-testid="lang-name" x="2" y="15" class="lang-name">${name}</text>
|
||||
<text x="${progressTextX}" y="34" class="lang-name">${progress}%</text>
|
||||
<text x="${progressTextX}" y="34" class="lang-name">${displayValue}</text>
|
||||
${createProgressNode({
|
||||
x: 0,
|
||||
y: 25,
|
||||
@@ -237,11 +264,20 @@ const createProgressTextNode = ({ width, color, name, progress, index }) => {
|
||||
* @param {Lang} props.lang Programming language object.
|
||||
* @param {number} props.totalSize Total size of all languages.
|
||||
* @param {boolean=} props.hideProgress Whether to hide percentage.
|
||||
* @param {string=} props.statsFormat Stats format
|
||||
* @param {number} props.index Index of the programming language.
|
||||
* @returns {string} Compact layout programming language SVG node.
|
||||
*/
|
||||
const createCompactLangNode = ({ lang, totalSize, hideProgress, index }) => {
|
||||
const percentage = ((lang.size / totalSize) * 100).toFixed(2);
|
||||
const createCompactLangNode = ({
|
||||
lang,
|
||||
totalSize,
|
||||
hideProgress,
|
||||
statsFormat = "percentages",
|
||||
index,
|
||||
}) => {
|
||||
const percentages = (lang.size / totalSize) * 100;
|
||||
const displayValue = getDisplayValue(lang.size, percentages, statsFormat);
|
||||
|
||||
const staggerDelay = (index + 3) * 150;
|
||||
const color = lang.color || "#858585";
|
||||
|
||||
@@ -249,7 +285,7 @@ const createCompactLangNode = ({ lang, totalSize, hideProgress, index }) => {
|
||||
<g class="stagger" style="animation-delay: ${staggerDelay}ms">
|
||||
<circle cx="5" cy="6" r="5" fill="${color}" />
|
||||
<text data-testid="lang-name" x="15" y="10" class='lang-name'>
|
||||
${lang.name} ${hideProgress ? "" : percentage + "%"}
|
||||
${lang.name} ${hideProgress ? "" : displayValue}
|
||||
</text>
|
||||
</g>
|
||||
`;
|
||||
@@ -262,9 +298,15 @@ const createCompactLangNode = ({ lang, totalSize, hideProgress, index }) => {
|
||||
* @param {Lang[]} props.langs Array of programming languages.
|
||||
* @param {number} props.totalSize Total size of all languages.
|
||||
* @param {boolean=} props.hideProgress Whether to hide percentage.
|
||||
* @param {string=} props.statsFormat Stats format
|
||||
* @returns {string} Programming languages SVG node.
|
||||
*/
|
||||
const createLanguageTextNode = ({ langs, totalSize, hideProgress }) => {
|
||||
const createLanguageTextNode = ({
|
||||
langs,
|
||||
totalSize,
|
||||
hideProgress,
|
||||
statsFormat,
|
||||
}) => {
|
||||
const longestLang = getLongestLang(langs);
|
||||
const chunked = chunkArray(langs, langs.length / 2);
|
||||
const layouts = chunked.map((array) => {
|
||||
@@ -274,6 +316,7 @@ const createLanguageTextNode = ({ langs, totalSize, hideProgress }) => {
|
||||
lang,
|
||||
totalSize,
|
||||
hideProgress,
|
||||
statsFormat,
|
||||
index,
|
||||
}),
|
||||
);
|
||||
@@ -299,15 +342,17 @@ const createLanguageTextNode = ({ langs, totalSize, hideProgress }) => {
|
||||
* @param {object} props Function properties.
|
||||
* @param {Lang[]} props.langs Array of programming languages.
|
||||
* @param {number} props.totalSize Total size of all languages.
|
||||
* @param {string} props.statsFormat Stats format
|
||||
* @returns {string} Donut layout programming language SVG node.
|
||||
*/
|
||||
const createDonutLanguagesNode = ({ langs, totalSize }) => {
|
||||
const createDonutLanguagesNode = ({ langs, totalSize, statsFormat }) => {
|
||||
return flexLayout({
|
||||
items: langs.map((lang, index) => {
|
||||
return createCompactLangNode({
|
||||
lang,
|
||||
totalSize,
|
||||
hideProgress: false,
|
||||
statsFormat,
|
||||
index,
|
||||
});
|
||||
}),
|
||||
@@ -322,18 +367,19 @@ const createDonutLanguagesNode = ({ langs, totalSize }) => {
|
||||
* @param {Lang[]} langs Array of programming languages.
|
||||
* @param {number} width Card width.
|
||||
* @param {number} totalLanguageSize Total size of all languages.
|
||||
* @param {string} statsFormat Stats format.
|
||||
* @returns {string} Normal layout card SVG object.
|
||||
*/
|
||||
const renderNormalLayout = (langs, width, totalLanguageSize) => {
|
||||
const renderNormalLayout = (langs, width, totalLanguageSize, statsFormat) => {
|
||||
return flexLayout({
|
||||
items: langs.map((lang, index) => {
|
||||
return createProgressTextNode({
|
||||
width,
|
||||
name: lang.name,
|
||||
color: lang.color || DEFAULT_LANG_COLOR,
|
||||
progress: parseFloat(
|
||||
((lang.size / totalLanguageSize) * 100).toFixed(2),
|
||||
),
|
||||
size: lang.size,
|
||||
totalSize: totalLanguageSize,
|
||||
statsFormat,
|
||||
index,
|
||||
});
|
||||
}),
|
||||
@@ -349,9 +395,16 @@ const renderNormalLayout = (langs, width, totalLanguageSize) => {
|
||||
* @param {number} width Card width.
|
||||
* @param {number} totalLanguageSize Total size of all languages.
|
||||
* @param {boolean=} hideProgress Whether to hide progress bar.
|
||||
* @param {string} statsFormat Stats format.
|
||||
* @returns {string} Compact layout card SVG object.
|
||||
*/
|
||||
const renderCompactLayout = (langs, width, totalLanguageSize, hideProgress) => {
|
||||
const renderCompactLayout = (
|
||||
langs,
|
||||
width,
|
||||
totalLanguageSize,
|
||||
hideProgress,
|
||||
statsFormat = "percentages",
|
||||
) => {
|
||||
const paddingRight = 50;
|
||||
const offsetWidth = width - paddingRight;
|
||||
// progressOffset holds the previous language's width and used to offset the next language
|
||||
@@ -397,6 +450,7 @@ const renderCompactLayout = (langs, width, totalLanguageSize, hideProgress) => {
|
||||
langs,
|
||||
totalSize: totalLanguageSize,
|
||||
hideProgress,
|
||||
statsFormat,
|
||||
})}
|
||||
</g>
|
||||
`;
|
||||
@@ -407,9 +461,10 @@ const renderCompactLayout = (langs, width, totalLanguageSize, hideProgress) => {
|
||||
*
|
||||
* @param {Lang[]} langs Array of programming languages.
|
||||
* @param {number} totalLanguageSize Total size of all languages.
|
||||
* @param {string} statsFormat Stats format.
|
||||
* @returns {string} Compact layout card SVG object.
|
||||
*/
|
||||
const renderDonutVerticalLayout = (langs, totalLanguageSize) => {
|
||||
const renderDonutVerticalLayout = (langs, totalLanguageSize, statsFormat) => {
|
||||
// Donut vertical chart radius and total length
|
||||
const radius = 80;
|
||||
const totalCircleLength = getCircleLength(radius);
|
||||
@@ -465,6 +520,7 @@ const renderDonutVerticalLayout = (langs, totalLanguageSize) => {
|
||||
langs,
|
||||
totalSize: totalLanguageSize,
|
||||
hideProgress: false,
|
||||
statsFormat,
|
||||
})}
|
||||
</svg>
|
||||
</g>
|
||||
@@ -477,9 +533,10 @@ const renderDonutVerticalLayout = (langs, totalLanguageSize) => {
|
||||
*
|
||||
* @param {Lang[]} langs Array of programming languages.
|
||||
* @param {number} totalLanguageSize Total size of all languages.
|
||||
* @param {string} statsFormat Stats format.
|
||||
* @returns {string} Compact layout card SVG object.
|
||||
*/
|
||||
const renderPieLayout = (langs, totalLanguageSize) => {
|
||||
const renderPieLayout = (langs, totalLanguageSize, statsFormat) => {
|
||||
// Pie chart radius and center coordinates
|
||||
const radius = 90;
|
||||
const centerX = 150;
|
||||
@@ -560,6 +617,7 @@ const renderPieLayout = (langs, totalLanguageSize) => {
|
||||
langs,
|
||||
totalSize: totalLanguageSize,
|
||||
hideProgress: false,
|
||||
statsFormat,
|
||||
})}
|
||||
</svg>
|
||||
</g>
|
||||
@@ -610,9 +668,10 @@ const createDonutPaths = (cx, cy, radius, percentages) => {
|
||||
* @param {Lang[]} langs Array of programming languages.
|
||||
* @param {number} width Card width.
|
||||
* @param {number} totalLanguageSize Total size of all languages.
|
||||
* @param {string} statsFormat Stats format.
|
||||
* @returns {string} Donut layout card SVG object.
|
||||
*/
|
||||
const renderDonutLayout = (langs, width, totalLanguageSize) => {
|
||||
const renderDonutLayout = (langs, width, totalLanguageSize, statsFormat) => {
|
||||
const centerX = width / 3;
|
||||
const centerY = width / 3;
|
||||
const radius = centerX - 60;
|
||||
@@ -655,7 +714,7 @@ const renderDonutLayout = (langs, width, totalLanguageSize) => {
|
||||
return `
|
||||
<g transform="translate(0, 0)">
|
||||
<g transform="translate(0, 0)">
|
||||
${createDonutLanguagesNode({ langs, totalSize: totalLanguageSize })}
|
||||
${createDonutLanguagesNode({ langs, totalSize: totalLanguageSize, statsFormat })}
|
||||
</g>
|
||||
|
||||
<g transform="translate(125, ${donutCenterTranslation(langs.length)})">
|
||||
@@ -738,6 +797,7 @@ const renderTopLanguages = (topLangs, options = {}) => {
|
||||
border_radius,
|
||||
border_color,
|
||||
disable_animations,
|
||||
stats_format = "percentages",
|
||||
} = options;
|
||||
|
||||
const i18n = new I18n({
|
||||
@@ -779,10 +839,14 @@ const renderTopLanguages = (topLangs, options = {}) => {
|
||||
});
|
||||
} else if (layout === "pie") {
|
||||
height = calculatePieLayoutHeight(langs.length);
|
||||
finalLayout = renderPieLayout(langs, totalLanguageSize);
|
||||
finalLayout = renderPieLayout(langs, totalLanguageSize, stats_format);
|
||||
} else if (layout === "donut-vertical") {
|
||||
height = calculateDonutVerticalLayoutHeight(langs.length);
|
||||
finalLayout = renderDonutVerticalLayout(langs, totalLanguageSize);
|
||||
finalLayout = renderDonutVerticalLayout(
|
||||
langs,
|
||||
totalLanguageSize,
|
||||
stats_format,
|
||||
);
|
||||
} else if (layout === "compact" || hide_progress == true) {
|
||||
height =
|
||||
calculateCompactLayoutHeight(langs.length) + (hide_progress ? -25 : 0);
|
||||
@@ -792,13 +856,24 @@ const renderTopLanguages = (topLangs, options = {}) => {
|
||||
width,
|
||||
totalLanguageSize,
|
||||
hide_progress,
|
||||
stats_format,
|
||||
);
|
||||
} else if (layout === "donut") {
|
||||
height = calculateDonutLayoutHeight(langs.length);
|
||||
width = width + 50; // padding
|
||||
finalLayout = renderDonutLayout(langs, width, totalLanguageSize);
|
||||
finalLayout = renderDonutLayout(
|
||||
langs,
|
||||
width,
|
||||
totalLanguageSize,
|
||||
stats_format,
|
||||
);
|
||||
} else {
|
||||
finalLayout = renderNormalLayout(langs, width, totalLanguageSize);
|
||||
finalLayout = renderNormalLayout(
|
||||
langs,
|
||||
width,
|
||||
totalLanguageSize,
|
||||
stats_format,
|
||||
);
|
||||
}
|
||||
|
||||
const card = new Card({
|
||||
Vendored
+4
@@ -20,10 +20,12 @@ export type StatCardOptions = CommonOptions & {
|
||||
card_width: number;
|
||||
hide_rank: boolean;
|
||||
include_all_commits: boolean;
|
||||
commits_year: number;
|
||||
line_height: number | string;
|
||||
custom_title: string;
|
||||
disable_animations: boolean;
|
||||
number_format: string;
|
||||
number_precision: number;
|
||||
ring_color: string;
|
||||
text_bold: boolean;
|
||||
rank_icon: RankIcon;
|
||||
@@ -44,11 +46,13 @@ export type TopLangOptions = CommonOptions & {
|
||||
langs_count: number;
|
||||
disable_animations: boolean;
|
||||
hide_progress: boolean;
|
||||
stats_format: "percentages" | "bytes";
|
||||
};
|
||||
|
||||
export type WakaTimeOptions = CommonOptions & {
|
||||
hide_title: boolean;
|
||||
hide: string[];
|
||||
card_width: number;
|
||||
line_height: string;
|
||||
hide_progress: boolean;
|
||||
custom_title: string;
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
// @ts-check
|
||||
|
||||
import { Card } from "../common/Card.js";
|
||||
import { createProgressNode } from "../common/createProgressNode.js";
|
||||
import { getCardColors } from "../common/color.js";
|
||||
import { I18n } from "../common/I18n.js";
|
||||
import {
|
||||
clampValue,
|
||||
flexLayout,
|
||||
getCardColors,
|
||||
lowercaseTrim,
|
||||
} from "../common/utils.js";
|
||||
import { clampValue, lowercaseTrim } from "../common/ops.js";
|
||||
import { createProgressNode, flexLayout } from "../common/render.js";
|
||||
import { wakatimeCardLocales } from "../translations.js";
|
||||
|
||||
/** Import language colors.
|
||||
@@ -21,6 +18,15 @@ import { createRequire } from "module";
|
||||
const require = createRequire(import.meta.url);
|
||||
const languageColors = require("../common/languageColors.json"); // now works
|
||||
|
||||
const DEFAULT_CARD_WIDTH = 495;
|
||||
const MIN_CARD_WIDTH = 250;
|
||||
const COMPACT_LAYOUT_MIN_WIDTH = 400;
|
||||
const DEFAULT_LINE_HEIGHT = 25;
|
||||
const PROGRESSBAR_PADDING = 130;
|
||||
const HIDDEN_PROGRESSBAR_PADDING = 170;
|
||||
const COMPACT_LAYOUT_PROGRESSBAR_PADDING = 25;
|
||||
const TOTAL_TEXT_WIDTH = 275;
|
||||
|
||||
/**
|
||||
* Creates the no coding activity SVG node.
|
||||
*
|
||||
@@ -64,6 +70,7 @@ const formatLanguageValue = ({ display_format, lang }) => {
|
||||
* @returns {string} The compact layout language SVG node.
|
||||
*/
|
||||
const createCompactLangNode = ({ lang, x, y, display_format }) => {
|
||||
// @ts-ignore
|
||||
const color = languageColors[lang.name] || "#858585";
|
||||
const value = formatLanguageValue({ display_format, lang });
|
||||
|
||||
@@ -84,22 +91,21 @@ const createCompactLangNode = ({ lang, x, y, display_format }) => {
|
||||
* @param {WakaTimeLang[]} args.langs The language objects.
|
||||
* @param {number} args.y The y position of the language node.
|
||||
* @param {"time" | "percent"} args.display_format The display format of the language node.
|
||||
* @param {number} args.card_width Width in px of the card.
|
||||
* @returns {string[]} The language text node items.
|
||||
*/
|
||||
const createLanguageTextNode = ({ langs, y, display_format }) => {
|
||||
const createLanguageTextNode = ({ langs, y, display_format, card_width }) => {
|
||||
const LEFT_X = 25;
|
||||
const RIGHT_X_BASE = 230;
|
||||
const rightOffset = (card_width - DEFAULT_CARD_WIDTH) / 2;
|
||||
const RIGHT_X = RIGHT_X_BASE + rightOffset;
|
||||
|
||||
return langs.map((lang, index) => {
|
||||
if (index % 2 === 0) {
|
||||
return createCompactLangNode({
|
||||
lang,
|
||||
x: 25,
|
||||
y: 12.5 * index + y,
|
||||
display_format,
|
||||
});
|
||||
}
|
||||
const isLeft = index % 2 === 0;
|
||||
return createCompactLangNode({
|
||||
lang,
|
||||
x: 230,
|
||||
y: 12.5 + 12.5 * index,
|
||||
x: isLeft ? LEFT_X : RIGHT_X,
|
||||
y: y + DEFAULT_LINE_HEIGHT * Math.floor(index / 2),
|
||||
display_format,
|
||||
});
|
||||
});
|
||||
@@ -117,6 +123,7 @@ const createLanguageTextNode = ({ langs, y, display_format }) => {
|
||||
* @param {boolean=} args.hideProgress Whether to hide the progress bar.
|
||||
* @param {string} args.progressBarColor The color of the progress bar.
|
||||
* @param {string} args.progressBarBackgroundColor The color of the progress bar background.
|
||||
* @param {number} args.progressBarWidth The width of the progress bar.
|
||||
* @returns {string} The text SVG node.
|
||||
*/
|
||||
const createTextNode = ({
|
||||
@@ -128,9 +135,9 @@ const createTextNode = ({
|
||||
hideProgress,
|
||||
progressBarColor,
|
||||
progressBarBackgroundColor,
|
||||
progressBarWidth,
|
||||
}) => {
|
||||
const staggerDelay = (index + 3) * 150;
|
||||
|
||||
const cardProgress = hideProgress
|
||||
? null
|
||||
: createProgressNode({
|
||||
@@ -138,7 +145,7 @@ const createTextNode = ({
|
||||
y: 4,
|
||||
progress: percent,
|
||||
color: progressBarColor,
|
||||
width: 220,
|
||||
width: progressBarWidth,
|
||||
// @ts-ignore
|
||||
name: label,
|
||||
progressBarBackgroundColor,
|
||||
@@ -150,7 +157,7 @@ const createTextNode = ({
|
||||
<text class="stat bold" y="12.5" data-testid="${id}">${label}:</text>
|
||||
<text
|
||||
class="stat"
|
||||
x="${hideProgress ? 170 : 350}"
|
||||
x="${hideProgress ? HIDDEN_PROGRESSBAR_PADDING : PROGRESSBAR_PADDING + progressBarWidth}"
|
||||
y="12.5"
|
||||
>${value}</text>
|
||||
${cardProgress}
|
||||
@@ -206,6 +213,24 @@ const getStyles = ({
|
||||
`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Normalize incoming width (string or number) and clamp to minimum.
|
||||
*
|
||||
* @param {Object} args The function arguments.
|
||||
* @param {WakaTimeOptions["layout"] | undefined} args.layout The incoming layout value.
|
||||
* @param {number|undefined} args.value The incoming width value.
|
||||
* @returns {number} The normalized width value.
|
||||
*/
|
||||
const normalizeCardWidth = ({ value, layout }) => {
|
||||
if (value === undefined || value === null || isNaN(value)) {
|
||||
return DEFAULT_CARD_WIDTH;
|
||||
}
|
||||
return Math.max(
|
||||
layout === "compact" ? COMPACT_LAYOUT_MIN_WIDTH : MIN_CARD_WIDTH,
|
||||
value,
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {import('../fetchers/types').WakaTimeData} WakaTimeData
|
||||
* @typedef {import('./types').WakaTimeOptions} WakaTimeOptions
|
||||
@@ -223,8 +248,9 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
const {
|
||||
hide_title = false,
|
||||
hide_border = false,
|
||||
card_width,
|
||||
hide,
|
||||
line_height = 25,
|
||||
line_height = DEFAULT_LINE_HEIGHT,
|
||||
title_color,
|
||||
icon_color,
|
||||
text_color,
|
||||
@@ -241,6 +267,8 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
disable_animations,
|
||||
} = options;
|
||||
|
||||
const normalizedWidth = normalizeCardWidth({ value: card_width, layout });
|
||||
|
||||
const shouldHideLangs = Array.isArray(hide) && hide.length > 0;
|
||||
if (shouldHideLangs) {
|
||||
const languagesToHide = new Set(hide.map((lang) => lowercaseTrim(lang)));
|
||||
@@ -289,21 +317,22 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
|
||||
let finalLayout = "";
|
||||
|
||||
let width = 440;
|
||||
|
||||
// RENDER COMPACT LAYOUT
|
||||
if (layout === "compact") {
|
||||
width = width + 50;
|
||||
height = 90 + Math.round(filteredLanguages.length / 2) * 25;
|
||||
const width = normalizedWidth - 5;
|
||||
height =
|
||||
90 + Math.round(filteredLanguages.length / 2) * DEFAULT_LINE_HEIGHT;
|
||||
|
||||
// progressOffset holds the previous language's width and used to offset the next language
|
||||
// so that we can stack them one after another, like this: [--][----][---]
|
||||
let progressOffset = 0;
|
||||
const compactProgressBar = filteredLanguages
|
||||
.map((language) => {
|
||||
// const progress = (width * lang.percent) / 100;
|
||||
const progress = ((width - 25) * language.percent) / 100;
|
||||
const progress =
|
||||
((width - COMPACT_LAYOUT_PROGRESSBAR_PADDING) * language.percent) /
|
||||
100;
|
||||
|
||||
// @ts-ignore
|
||||
const languageColor = languageColors[language.name] || "#858585";
|
||||
|
||||
const output = `
|
||||
@@ -324,7 +353,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
|
||||
finalLayout = `
|
||||
<mask id="rect-mask">
|
||||
<rect x="25" y="0" width="${width - 50}" height="8" fill="white" rx="5" />
|
||||
<rect x="${COMPACT_LAYOUT_PROGRESSBAR_PADDING}" y="0" width="${width - 2 * COMPACT_LAYOUT_PROGRESSBAR_PADDING}" height="8" fill="white" rx="5" />
|
||||
</mask>
|
||||
${compactProgressBar}
|
||||
${
|
||||
@@ -333,6 +362,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
y: 25,
|
||||
langs: filteredLanguages,
|
||||
display_format,
|
||||
card_width: normalizedWidth,
|
||||
}).join("")
|
||||
: noCodingActivityNode({
|
||||
// @ts-ignore
|
||||
@@ -360,6 +390,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
// @ts-ignore
|
||||
progressBarBackgroundColor: textColor,
|
||||
hideProgress: hide_progress,
|
||||
progressBarWidth: normalizedWidth - TOTAL_TEXT_WIDTH,
|
||||
});
|
||||
})
|
||||
: [
|
||||
@@ -392,7 +423,7 @@ const renderWakatimeCard = (stats = {}, options = { hide: [] }) => {
|
||||
const card = new Card({
|
||||
customTitle: custom_title,
|
||||
defaultTitle: titleText,
|
||||
width: 495,
|
||||
width: normalizedWidth,
|
||||
height,
|
||||
border_radius,
|
||||
colors: {
|
||||
+17
-15
@@ -1,23 +1,25 @@
|
||||
import { encodeHTML, flexLayout } from "./utils.js";
|
||||
// @ts-check
|
||||
|
||||
import { encodeHTML } from "./html.js";
|
||||
import { flexLayout } from "./render.js";
|
||||
|
||||
class Card {
|
||||
/**
|
||||
* Creates a new card instance.
|
||||
*
|
||||
* @param {object} args Card arguments.
|
||||
* @param {number?=} args.width Card width.
|
||||
* @param {number?=} args.height Card height.
|
||||
* @param {number?=} args.border_radius Card border radius.
|
||||
* @param {string?=} args.customTitle Card custom title.
|
||||
* @param {string?=} args.defaultTitle Card default title.
|
||||
* @param {string?=} args.titlePrefixIcon Card title prefix icon.
|
||||
* @param {object?=} args.colors Card colors arguments.
|
||||
* @param {string} args.colors.titleColor Card title color.
|
||||
* @param {string} args.colors.textColor Card text color.
|
||||
* @param {string} args.colors.iconColor Card icon color.
|
||||
* @param {string|Array} args.colors.bgColor Card background color.
|
||||
* @param {string} args.colors.borderColor Card border color.
|
||||
* @returns {Card} Card instance.
|
||||
* @param {number=} args.width Card width.
|
||||
* @param {number=} args.height Card height.
|
||||
* @param {number=} args.border_radius Card border radius.
|
||||
* @param {string=} args.customTitle Card custom title.
|
||||
* @param {string=} args.defaultTitle Card default title.
|
||||
* @param {string=} args.titlePrefixIcon Card title prefix icon.
|
||||
* @param {object} [args.colors={}] Card colors arguments.
|
||||
* @param {string=} args.colors.titleColor Card title color.
|
||||
* @param {string=} args.colors.textColor Card text color.
|
||||
* @param {string=} args.colors.iconColor Card icon color.
|
||||
* @param {string|string[]=} args.colors.bgColor Card background color.
|
||||
* @param {string=} args.colors.borderColor Card border color.
|
||||
*/
|
||||
constructor({
|
||||
width = 100,
|
||||
@@ -138,7 +140,7 @@ class Card {
|
||||
transform="translate(${this.paddingX}, ${this.paddingY})"
|
||||
>
|
||||
${flexLayout({
|
||||
items: [this.titlePrefixIcon && prefixIcon, titleText],
|
||||
items: [this.titlePrefixIcon ? prefixIcon : "", titleText],
|
||||
gap: 25,
|
||||
}).join("")}
|
||||
</g>
|
||||
|
||||
+3
-1
@@ -1,3 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
const FALLBACK_LOCALE = "en";
|
||||
|
||||
/**
|
||||
@@ -9,7 +11,7 @@ class I18n {
|
||||
*
|
||||
* @param {Object} options Options.
|
||||
* @param {string=} options.locale Locale.
|
||||
* @param {Object} options.translations Translations.
|
||||
* @param {any} options.translations Translations.
|
||||
*/
|
||||
constructor({ locale, translations }) {
|
||||
this.locale = locale || FALLBACK_LOCALE;
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
// @ts-check
|
||||
|
||||
import { renderError } from "./render.js";
|
||||
import { blacklist } from "./blacklist.js";
|
||||
import { whitelist, gistWhitelist } from "./envs.js";
|
||||
|
||||
const NOT_WHITELISTED_USERNAME_MESSAGE = "This username is not whitelisted";
|
||||
const NOT_WHITELISTED_GIST_MESSAGE = "This gist ID is not whitelisted";
|
||||
const BLACKLISTED_MESSAGE = "This username is blacklisted";
|
||||
|
||||
/**
|
||||
* Guards access using whitelist/blacklist.
|
||||
*
|
||||
* @param {Object} args The parameters object.
|
||||
* @param {any} args.res The response object.
|
||||
* @param {string} args.id Resource identifier (username or gist id).
|
||||
* @param {"username"|"gist"|"wakatime"} args.type The type of identifier.
|
||||
* @param {{ title_color?: string, text_color?: string, bg_color?: string, border_color?: string, theme?: string }} args.colors Color options for the error card.
|
||||
* @returns {{ isPassed: boolean, result?: any }} The result object indicating success or failure.
|
||||
*/
|
||||
const guardAccess = ({ res, id, type, colors }) => {
|
||||
if (!["username", "gist", "wakatime"].includes(type)) {
|
||||
throw new Error(
|
||||
'Invalid type. Expected "username", "gist", or "wakatime".',
|
||||
);
|
||||
}
|
||||
|
||||
const currentWhitelist = type === "gist" ? gistWhitelist : whitelist;
|
||||
const notWhitelistedMsg =
|
||||
type === "gist"
|
||||
? NOT_WHITELISTED_GIST_MESSAGE
|
||||
: NOT_WHITELISTED_USERNAME_MESSAGE;
|
||||
|
||||
if (Array.isArray(currentWhitelist) && !currentWhitelist.includes(id)) {
|
||||
const result = res.send(
|
||||
renderError({
|
||||
message: notWhitelistedMsg,
|
||||
secondaryMessage: "Please deploy your own instance",
|
||||
renderOptions: {
|
||||
...colors,
|
||||
show_repo_link: false,
|
||||
},
|
||||
}),
|
||||
);
|
||||
return { isPassed: false, result };
|
||||
}
|
||||
|
||||
if (
|
||||
type === "username" &&
|
||||
currentWhitelist === undefined &&
|
||||
blacklist.includes(id)
|
||||
) {
|
||||
const result = res.send(
|
||||
renderError({
|
||||
message: BLACKLISTED_MESSAGE,
|
||||
secondaryMessage: "Please deploy your own instance",
|
||||
renderOptions: {
|
||||
...colors,
|
||||
show_repo_link: false,
|
||||
},
|
||||
}),
|
||||
);
|
||||
return { isPassed: false, result };
|
||||
}
|
||||
|
||||
return { isPassed: true };
|
||||
};
|
||||
|
||||
export { guardAccess };
|
||||
@@ -1,4 +1,10 @@
|
||||
const blacklist = ["renovate-bot", "technote-space", "sw-yx"];
|
||||
const blacklist = [
|
||||
"renovate-bot",
|
||||
"technote-space",
|
||||
"sw-yx",
|
||||
"YourUsername",
|
||||
"[YourUsername]",
|
||||
];
|
||||
|
||||
export { blacklist };
|
||||
export default blacklist;
|
||||
|
||||
@@ -0,0 +1,153 @@
|
||||
// @ts-check
|
||||
|
||||
import { clampValue } from "./ops.js";
|
||||
|
||||
const MIN = 60;
|
||||
const HOUR = 60 * MIN;
|
||||
const DAY = 24 * HOUR;
|
||||
|
||||
/**
|
||||
* Common durations in seconds.
|
||||
*/
|
||||
const DURATIONS = {
|
||||
ONE_MINUTE: MIN,
|
||||
FIVE_MINUTES: 5 * MIN,
|
||||
TEN_MINUTES: 10 * MIN,
|
||||
FIFTEEN_MINUTES: 15 * MIN,
|
||||
THIRTY_MINUTES: 30 * MIN,
|
||||
|
||||
TWO_HOURS: 2 * HOUR,
|
||||
FOUR_HOURS: 4 * HOUR,
|
||||
SIX_HOURS: 6 * HOUR,
|
||||
EIGHT_HOURS: 8 * HOUR,
|
||||
TWELVE_HOURS: 12 * HOUR,
|
||||
|
||||
ONE_DAY: DAY,
|
||||
TWO_DAY: 2 * DAY,
|
||||
SIX_DAY: 6 * DAY,
|
||||
TEN_DAY: 10 * DAY,
|
||||
};
|
||||
|
||||
/**
|
||||
* Common cache TTL values in seconds.
|
||||
*/
|
||||
const CACHE_TTL = {
|
||||
STATS_CARD: {
|
||||
DEFAULT: DURATIONS.ONE_DAY,
|
||||
MIN: DURATIONS.TWELVE_HOURS,
|
||||
MAX: DURATIONS.TWO_DAY,
|
||||
},
|
||||
TOP_LANGS_CARD: {
|
||||
DEFAULT: DURATIONS.SIX_DAY,
|
||||
MIN: DURATIONS.TWO_DAY,
|
||||
MAX: DURATIONS.TEN_DAY,
|
||||
},
|
||||
PIN_CARD: {
|
||||
DEFAULT: DURATIONS.TEN_DAY,
|
||||
MIN: DURATIONS.ONE_DAY,
|
||||
MAX: DURATIONS.TEN_DAY,
|
||||
},
|
||||
GIST_CARD: {
|
||||
DEFAULT: DURATIONS.TWO_DAY,
|
||||
MIN: DURATIONS.ONE_DAY,
|
||||
MAX: DURATIONS.TEN_DAY,
|
||||
},
|
||||
WAKATIME_CARD: {
|
||||
DEFAULT: DURATIONS.ONE_DAY,
|
||||
MIN: DURATIONS.TWELVE_HOURS,
|
||||
MAX: DURATIONS.TWO_DAY,
|
||||
},
|
||||
ERROR: DURATIONS.TEN_MINUTES,
|
||||
};
|
||||
|
||||
/**
|
||||
* Resolves the cache seconds based on the requested, default, min, and max values.
|
||||
*
|
||||
* @param {Object} args The parameters object.
|
||||
* @param {number} args.requested The requested cache seconds.
|
||||
* @param {number} args.def The default cache seconds.
|
||||
* @param {number} args.min The minimum cache seconds.
|
||||
* @param {number} args.max The maximum cache seconds.
|
||||
* @returns {number} The resolved cache seconds.
|
||||
*/
|
||||
const resolveCacheSeconds = ({ requested, def, min, max }) => {
|
||||
let cacheSeconds = clampValue(isNaN(requested) ? def : requested, min, max);
|
||||
|
||||
if (process.env.CACHE_SECONDS) {
|
||||
const envCacheSeconds = parseInt(process.env.CACHE_SECONDS, 10);
|
||||
if (!isNaN(envCacheSeconds)) {
|
||||
cacheSeconds = envCacheSeconds;
|
||||
}
|
||||
}
|
||||
|
||||
return cacheSeconds;
|
||||
};
|
||||
|
||||
/**
|
||||
* Disables caching by setting appropriate headers on the response object.
|
||||
*
|
||||
* @param {any} res The response object.
|
||||
*/
|
||||
const disableCaching = (res) => {
|
||||
// Disable caching for browsers, shared caches/CDNs, and GitHub Camo.
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
"no-cache, no-store, must-revalidate, max-age=0, s-maxage=0",
|
||||
);
|
||||
res.setHeader("Pragma", "no-cache");
|
||||
res.setHeader("Expires", "0");
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the Cache-Control headers on the response object.
|
||||
*
|
||||
* @param {any} res The response object.
|
||||
* @param {number} cacheSeconds The cache seconds to set in the headers.
|
||||
*/
|
||||
const setCacheHeaders = (res, cacheSeconds) => {
|
||||
if (cacheSeconds < 1 || process.env.NODE_ENV === "development") {
|
||||
disableCaching(res);
|
||||
return;
|
||||
}
|
||||
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=${cacheSeconds}, ` +
|
||||
`s-maxage=${cacheSeconds}, ` +
|
||||
`stale-while-revalidate=${DURATIONS.ONE_DAY}`,
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Sets the Cache-Control headers for error responses on the response object.
|
||||
*
|
||||
* @param {any} res The response object.
|
||||
*/
|
||||
const setErrorCacheHeaders = (res) => {
|
||||
const envCacheSeconds = process.env.CACHE_SECONDS
|
||||
? parseInt(process.env.CACHE_SECONDS, 10)
|
||||
: NaN;
|
||||
if (
|
||||
(!isNaN(envCacheSeconds) && envCacheSeconds < 1) ||
|
||||
process.env.NODE_ENV === "development"
|
||||
) {
|
||||
disableCaching(res);
|
||||
return;
|
||||
}
|
||||
|
||||
// Use lower cache period for errors.
|
||||
res.setHeader(
|
||||
"Cache-Control",
|
||||
`max-age=${CACHE_TTL.ERROR}, ` +
|
||||
`s-maxage=${CACHE_TTL.ERROR}, ` +
|
||||
`stale-while-revalidate=${DURATIONS.ONE_DAY}`,
|
||||
);
|
||||
};
|
||||
|
||||
export {
|
||||
resolveCacheSeconds,
|
||||
setCacheHeaders,
|
||||
setErrorCacheHeaders,
|
||||
DURATIONS,
|
||||
CACHE_TTL,
|
||||
};
|
||||
@@ -0,0 +1,144 @@
|
||||
// @ts-check
|
||||
|
||||
import { themes } from "../../themes/index.js";
|
||||
|
||||
/**
|
||||
* Checks if a string is a valid hex color.
|
||||
*
|
||||
* @param {string} hexColor String to check.
|
||||
* @returns {boolean} True if the given string is a valid hex color.
|
||||
*/
|
||||
const isValidHexColor = (hexColor) => {
|
||||
return new RegExp(
|
||||
/^([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{4})$/,
|
||||
).test(hexColor);
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the given string is a valid gradient.
|
||||
*
|
||||
* @param {string[]} colors Array of colors.
|
||||
* @returns {boolean} True if the given string is a valid gradient.
|
||||
*/
|
||||
const isValidGradient = (colors) => {
|
||||
return (
|
||||
colors.length > 2 &&
|
||||
colors.slice(1).every((color) => isValidHexColor(color))
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves a gradient if color has more than one valid hex codes else a single color.
|
||||
*
|
||||
* @param {string} color The color to parse.
|
||||
* @param {string | string[]} fallbackColor The fallback color.
|
||||
* @returns {string | string[]} The gradient or color.
|
||||
*/
|
||||
const fallbackColor = (color, fallbackColor) => {
|
||||
let gradient = null;
|
||||
|
||||
let colors = color ? color.split(",") : [];
|
||||
if (colors.length > 1 && isValidGradient(colors)) {
|
||||
gradient = colors;
|
||||
}
|
||||
|
||||
return (
|
||||
(gradient ? gradient : isValidHexColor(color) && `#${color}`) ||
|
||||
fallbackColor
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Object containing card colors.
|
||||
* @typedef {{
|
||||
* titleColor: string;
|
||||
* iconColor: string;
|
||||
* textColor: string;
|
||||
* bgColor: string | string[];
|
||||
* borderColor: string;
|
||||
* ringColor: string;
|
||||
* }} CardColors
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns theme based colors with proper overrides and defaults.
|
||||
*
|
||||
* @param {Object} args Function arguments.
|
||||
* @param {string=} args.title_color Card title color.
|
||||
* @param {string=} args.text_color Card text color.
|
||||
* @param {string=} args.icon_color Card icon color.
|
||||
* @param {string=} args.bg_color Card background color.
|
||||
* @param {string=} args.border_color Card border color.
|
||||
* @param {string=} args.ring_color Card ring color.
|
||||
* @param {string=} args.theme Card theme.
|
||||
* @returns {CardColors} Card colors.
|
||||
*/
|
||||
const getCardColors = ({
|
||||
title_color,
|
||||
text_color,
|
||||
icon_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
ring_color,
|
||||
theme,
|
||||
}) => {
|
||||
const defaultTheme = themes["default"];
|
||||
const isThemeProvided = theme !== null && theme !== undefined;
|
||||
|
||||
// @ts-ignore
|
||||
const selectedTheme = isThemeProvided ? themes[theme] : defaultTheme;
|
||||
|
||||
const defaultBorderColor =
|
||||
"border_color" in selectedTheme
|
||||
? selectedTheme.border_color
|
||||
: // @ts-ignore
|
||||
defaultTheme.border_color;
|
||||
|
||||
// get the color provided by the user else the theme color
|
||||
// finally if both colors are invalid fallback to default theme
|
||||
const titleColor = fallbackColor(
|
||||
title_color || selectedTheme.title_color,
|
||||
"#" + defaultTheme.title_color,
|
||||
);
|
||||
|
||||
// get the color provided by the user else the theme color
|
||||
// finally if both colors are invalid we use the titleColor
|
||||
const ringColor = fallbackColor(
|
||||
// @ts-ignore
|
||||
ring_color || selectedTheme.ring_color,
|
||||
titleColor,
|
||||
);
|
||||
const iconColor = fallbackColor(
|
||||
icon_color || selectedTheme.icon_color,
|
||||
"#" + defaultTheme.icon_color,
|
||||
);
|
||||
const textColor = fallbackColor(
|
||||
text_color || selectedTheme.text_color,
|
||||
"#" + defaultTheme.text_color,
|
||||
);
|
||||
const bgColor = fallbackColor(
|
||||
bg_color || selectedTheme.bg_color,
|
||||
"#" + defaultTheme.bg_color,
|
||||
);
|
||||
|
||||
const borderColor = fallbackColor(
|
||||
border_color || defaultBorderColor,
|
||||
"#" + defaultBorderColor,
|
||||
);
|
||||
|
||||
if (
|
||||
typeof titleColor !== "string" ||
|
||||
typeof textColor !== "string" ||
|
||||
typeof ringColor !== "string" ||
|
||||
typeof iconColor !== "string" ||
|
||||
typeof borderColor !== "string"
|
||||
) {
|
||||
throw new Error(
|
||||
"Unexpected behavior, all colors except background should be string.",
|
||||
);
|
||||
}
|
||||
|
||||
return { titleColor, iconColor, textColor, bgColor, borderColor, ringColor };
|
||||
};
|
||||
|
||||
export { isValidHexColor, isValidGradient, getCardColors };
|
||||
@@ -1,46 +0,0 @@
|
||||
// @ts-check
|
||||
|
||||
import { clampValue } from "./utils.js";
|
||||
|
||||
/**
|
||||
* Create a node to indicate progress in percentage along a horizontal line.
|
||||
*
|
||||
* @param {Object} createProgressNodeParams Object that contains the createProgressNode parameters.
|
||||
* @param {number} createProgressNodeParams.x X-axis position.
|
||||
* @param {number} createProgressNodeParams.y Y-axis position.
|
||||
* @param {number} createProgressNodeParams.width Width of progress bar.
|
||||
* @param {string} createProgressNodeParams.color Progress color.
|
||||
* @param {number} createProgressNodeParams.progress Progress value.
|
||||
* @param {string} createProgressNodeParams.progressBarBackgroundColor Progress bar bg color.
|
||||
* @param {number} createProgressNodeParams.delay Delay before animation starts.
|
||||
* @returns {string} Progress node.
|
||||
*/
|
||||
const createProgressNode = ({
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
color,
|
||||
progress,
|
||||
progressBarBackgroundColor,
|
||||
delay,
|
||||
}) => {
|
||||
const progressPercentage = clampValue(progress, 2, 100);
|
||||
|
||||
return `
|
||||
<svg width="${width}" x="${x}" y="${y}">
|
||||
<rect rx="5" ry="5" x="0" y="0" width="${width}" height="8" fill="${progressBarBackgroundColor}"></rect>
|
||||
<svg data-testid="lang-progress" width="${progressPercentage}%">
|
||||
<rect
|
||||
height="8"
|
||||
fill="${color}"
|
||||
rx="5" ry="5" x="0" y="0"
|
||||
class="lang-progress"
|
||||
style="animation-delay: ${delay}ms;"
|
||||
/>
|
||||
</svg>
|
||||
</svg>
|
||||
`;
|
||||
};
|
||||
|
||||
export { createProgressNode };
|
||||
export default createProgressNode;
|
||||
@@ -0,0 +1,15 @@
|
||||
// @ts-check
|
||||
|
||||
const whitelist = process.env.WHITELIST
|
||||
? process.env.WHITELIST.split(",")
|
||||
: undefined;
|
||||
|
||||
const gistWhitelist = process.env.GIST_WHITELIST
|
||||
? process.env.GIST_WHITELIST.split(",")
|
||||
: undefined;
|
||||
|
||||
const excludeRepositories = process.env.EXCLUDE_REPO
|
||||
? process.env.EXCLUDE_REPO.split(",")
|
||||
: [];
|
||||
|
||||
export { whitelist, gistWhitelist, excludeRepositories };
|
||||
@@ -0,0 +1,84 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* @type {string} A general message to ask user to try again later.
|
||||
*/
|
||||
const TRY_AGAIN_LATER = "Please try again later";
|
||||
|
||||
/**
|
||||
* @type {Object<string, string>} A map of error types to secondary error messages.
|
||||
*/
|
||||
const SECONDARY_ERROR_MESSAGES = {
|
||||
MAX_RETRY:
|
||||
"You can deploy own instance or wait until public will be no longer limited",
|
||||
NO_TOKENS:
|
||||
"Please add an env variable called PAT_1 with your GitHub API token in vercel",
|
||||
USER_NOT_FOUND: "Make sure the provided username is not an organization",
|
||||
GRAPHQL_ERROR: TRY_AGAIN_LATER,
|
||||
GITHUB_REST_API_ERROR: TRY_AGAIN_LATER,
|
||||
WAKATIME_USER_NOT_FOUND: "Make sure you have a public WakaTime profile",
|
||||
};
|
||||
|
||||
/**
|
||||
* Custom error class to handle custom GRS errors.
|
||||
*/
|
||||
class CustomError extends Error {
|
||||
/**
|
||||
* Custom error constructor.
|
||||
*
|
||||
* @param {string} message Error message.
|
||||
* @param {string} type Error type.
|
||||
*/
|
||||
constructor(message, type) {
|
||||
super(message);
|
||||
this.type = type;
|
||||
this.secondaryMessage = SECONDARY_ERROR_MESSAGES[type] || type;
|
||||
}
|
||||
|
||||
static MAX_RETRY = "MAX_RETRY";
|
||||
static NO_TOKENS = "NO_TOKENS";
|
||||
static USER_NOT_FOUND = "USER_NOT_FOUND";
|
||||
static GRAPHQL_ERROR = "GRAPHQL_ERROR";
|
||||
static GITHUB_REST_API_ERROR = "GITHUB_REST_API_ERROR";
|
||||
static WAKATIME_ERROR = "WAKATIME_ERROR";
|
||||
}
|
||||
|
||||
/**
|
||||
* Missing query parameter class.
|
||||
*/
|
||||
class MissingParamError extends Error {
|
||||
/**
|
||||
* Missing query parameter error constructor.
|
||||
*
|
||||
* @param {string[]} missedParams An array of missing parameters names.
|
||||
* @param {string=} secondaryMessage Optional secondary message to display.
|
||||
*/
|
||||
constructor(missedParams, secondaryMessage) {
|
||||
const msg = `Missing params ${missedParams
|
||||
.map((p) => `"${p}"`)
|
||||
.join(", ")} make sure you pass the parameters in URL`;
|
||||
super(msg);
|
||||
this.missedParams = missedParams;
|
||||
this.secondaryMessage = secondaryMessage;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve secondary message from an error object.
|
||||
*
|
||||
* @param {Error} err The error object.
|
||||
* @returns {string|undefined} The secondary message if available, otherwise undefined.
|
||||
*/
|
||||
const retrieveSecondaryMessage = (err) => {
|
||||
return "secondaryMessage" in err && typeof err.secondaryMessage === "string"
|
||||
? err.secondaryMessage
|
||||
: undefined;
|
||||
};
|
||||
|
||||
export {
|
||||
CustomError,
|
||||
MissingParamError,
|
||||
SECONDARY_ERROR_MESSAGES,
|
||||
TRY_AGAIN_LATER,
|
||||
retrieveSecondaryMessage,
|
||||
};
|
||||
@@ -0,0 +1,90 @@
|
||||
// @ts-check
|
||||
|
||||
import wrap from "word-wrap";
|
||||
import { encodeHTML } from "./html.js";
|
||||
|
||||
/**
|
||||
* Retrieves num with suffix k(thousands) precise to given decimal places.
|
||||
*
|
||||
* @param {number} num The number to format.
|
||||
* @param {number=} precision The number of decimal places to include.
|
||||
* @returns {string|number} The formatted number.
|
||||
*/
|
||||
const kFormatter = (num, precision) => {
|
||||
const abs = Math.abs(num);
|
||||
const sign = Math.sign(num);
|
||||
|
||||
if (typeof precision === "number" && !isNaN(precision)) {
|
||||
return (sign * (abs / 1000)).toFixed(precision) + "k";
|
||||
}
|
||||
|
||||
if (abs < 1000) {
|
||||
return sign * abs;
|
||||
}
|
||||
|
||||
return sign * parseFloat((abs / 1000).toFixed(1)) + "k";
|
||||
};
|
||||
|
||||
/**
|
||||
* Convert bytes to a human-readable string representation.
|
||||
*
|
||||
* @param {number} bytes The number of bytes to convert.
|
||||
* @returns {string} The human-readable representation of bytes.
|
||||
* @throws {Error} If bytes is negative or too large.
|
||||
*/
|
||||
const formatBytes = (bytes) => {
|
||||
if (bytes < 0) {
|
||||
throw new Error("Bytes must be a non-negative number");
|
||||
}
|
||||
|
||||
if (bytes === 0) {
|
||||
return "0 B";
|
||||
}
|
||||
|
||||
const sizes = ["B", "KB", "MB", "GB", "TB", "PB", "EB"];
|
||||
const base = 1024;
|
||||
const i = Math.floor(Math.log(bytes) / Math.log(base));
|
||||
|
||||
if (i >= sizes.length) {
|
||||
throw new Error("Bytes is too large to convert to a human-readable string");
|
||||
}
|
||||
|
||||
return `${(bytes / Math.pow(base, i)).toFixed(1)} ${sizes[i]}`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Split text over multiple lines based on the card width.
|
||||
*
|
||||
* @param {string} text Text to split.
|
||||
* @param {number} width Line width in number of characters.
|
||||
* @param {number} maxLines Maximum number of lines.
|
||||
* @returns {string[]} Array of lines.
|
||||
*/
|
||||
const wrapTextMultiline = (text, width = 59, maxLines = 3) => {
|
||||
const fullWidthComma = ",";
|
||||
const encoded = encodeHTML(text);
|
||||
const isChinese = encoded.includes(fullWidthComma);
|
||||
|
||||
let wrapped = [];
|
||||
|
||||
if (isChinese) {
|
||||
wrapped = encoded.split(fullWidthComma); // Chinese full punctuation
|
||||
} else {
|
||||
wrapped = wrap(encoded, {
|
||||
width,
|
||||
}).split("\n"); // Split wrapped lines to get an array of lines
|
||||
}
|
||||
|
||||
const lines = wrapped.map((line) => line.trim()).slice(0, maxLines); // Only consider maxLines lines
|
||||
|
||||
// Add "..." to the last line if the text exceeds maxLines
|
||||
if (wrapped.length > maxLines) {
|
||||
lines[maxLines - 1] += "...";
|
||||
}
|
||||
|
||||
// Remove empty lines if text fits in less than maxLines lines
|
||||
const multiLineText = lines.filter(Boolean);
|
||||
return multiLineText;
|
||||
};
|
||||
|
||||
export { kFormatter, formatBytes, wrapTextMultiline };
|
||||
@@ -0,0 +1,19 @@
|
||||
// @ts-check
|
||||
|
||||
/**
|
||||
* Encode string as HTML.
|
||||
*
|
||||
* @see https://stackoverflow.com/a/48073476/10629172
|
||||
*
|
||||
* @param {string} str String to encode.
|
||||
* @returns {string} Encoded string.
|
||||
*/
|
||||
const encodeHTML = (str) => {
|
||||
return str
|
||||
.replace(/[\u00A0-\u9999<>&](?!#)/gim, (i) => {
|
||||
return "&#" + i.charCodeAt(0) + ";";
|
||||
})
|
||||
.replace(/\u0008/gim, "");
|
||||
};
|
||||
|
||||
export { encodeHTML };
|
||||
@@ -0,0 +1,21 @@
|
||||
// @ts-check
|
||||
|
||||
import axios from "axios";
|
||||
|
||||
/**
|
||||
* Send GraphQL request to GitHub API.
|
||||
*
|
||||
* @param {import('axios').AxiosRequestConfig['data']} data Request data.
|
||||
* @param {import('axios').AxiosRequestConfig['headers']} headers Request headers.
|
||||
* @returns {Promise<any>} Request response.
|
||||
*/
|
||||
const request = (data, headers) => {
|
||||
return axios({
|
||||
url: "https://api.github.com/graphql",
|
||||
method: "post",
|
||||
headers,
|
||||
data,
|
||||
});
|
||||
};
|
||||
|
||||
export { request };
|
||||
@@ -1,3 +1,5 @@
|
||||
// @ts-check
|
||||
|
||||
const icons = {
|
||||
star: `<path fill-rule="evenodd" d="M8 .25a.75.75 0 01.673.418l1.882 3.815 4.21.612a.75.75 0 01.416 1.279l-3.046 2.97.719 4.192a.75.75 0 01-1.088.791L8 12.347l-3.766 1.98a.75.75 0 01-1.088-.79l.72-4.194L.818 6.374a.75.75 0 01.416-1.28l4.21-.611L7.327.668A.75.75 0 018 .25zm0 2.445L6.615 5.5a.75.75 0 01-.564.41l-3.097.45 2.24 2.184a.75.75 0 01.216.664l-.528 3.084 2.769-1.456a.75.75 0 01.698 0l2.77 1.456-.53-3.084a.75.75 0 01.216-.664l2.24-2.183-3.096-.45a.75.75 0 01-.564-.41L8 2.694v.001z"/>`,
|
||||
commits: `<path fill-rule="evenodd" d="M1.643 3.143L.427 1.927A.25.25 0 000 2.104V5.75c0 .138.112.25.25.25h3.646a.25.25 0 00.177-.427L2.715 4.215a6.5 6.5 0 11-1.18 4.458.75.75 0 10-1.493.154 8.001 8.001 0 101.6-5.684zM7.75 4a.75.75 0 01.75.75v2.992l2.028.812a.75.75 0 01-.557 1.392l-2.5-1A.75.75 0 017 8.25v-3.5A.75.75 0 017.75 4z"/>`,
|
||||
|
||||
+3
-20
@@ -1,30 +1,13 @@
|
||||
// @ts-check
|
||||
|
||||
export { blacklist } from "./blacklist.js";
|
||||
export { Card } from "./Card.js";
|
||||
export { createProgressNode } from "./createProgressNode.js";
|
||||
export { I18n } from "./I18n.js";
|
||||
export { icons } from "./icons.js";
|
||||
export { retryer } from "./retryer.js";
|
||||
export {
|
||||
ERROR_CARD_LENGTH,
|
||||
renderError,
|
||||
encodeHTML,
|
||||
kFormatter,
|
||||
isValidHexColor,
|
||||
parseBoolean,
|
||||
parseArray,
|
||||
clampValue,
|
||||
isValidGradient,
|
||||
fallbackColor,
|
||||
request,
|
||||
flexLayout,
|
||||
getCardColors,
|
||||
wrapTextMultiline,
|
||||
logger,
|
||||
CONSTANTS,
|
||||
CustomError,
|
||||
MissingParamError,
|
||||
measureText,
|
||||
lowercaseTrim,
|
||||
chunkArray,
|
||||
parseEmojis,
|
||||
} from "./utils.js";
|
||||
} from "./render.js";
|
||||
|
||||
@@ -18,10 +18,12 @@
|
||||
"Adblock Filter List": "#800000",
|
||||
"Adobe Font Metrics": "#fa0f00",
|
||||
"Agda": "#315665",
|
||||
"Aiken": "#640ff8",
|
||||
"Alloy": "#64C800",
|
||||
"Alpine Abuild": "#0D597F",
|
||||
"Altium Designer": "#A89663",
|
||||
"AngelScript": "#C7D7DC",
|
||||
"Answer Set Programming": "#A9CC29",
|
||||
"Ant Build System": "#A9157E",
|
||||
"Antlers": "#ff269e",
|
||||
"ApacheConf": "#d12127",
|
||||
@@ -29,6 +31,7 @@
|
||||
"Apollo Guidance Computer": "#0B3D91",
|
||||
"AppleScript": "#101F1F",
|
||||
"Arc": "#aa2afe",
|
||||
"ArkTS": "#0080ff",
|
||||
"AsciiDoc": "#73a0c5",
|
||||
"AspectJ": "#a957b0",
|
||||
"Assembly": "#6E4C13",
|
||||
@@ -39,7 +42,9 @@
|
||||
"AutoIt": "#1C3552",
|
||||
"Avro IDL": "#0040FF",
|
||||
"Awk": "#c30e9b",
|
||||
"B4X": "#00e4ff",
|
||||
"BASIC": "#ff0000",
|
||||
"BQN": "#2b7067",
|
||||
"Ballerina": "#FF5000",
|
||||
"Batchfile": "#C1F12E",
|
||||
"Beef": "#a52f4e",
|
||||
@@ -60,23 +65,30 @@
|
||||
"BrighterScript": "#66AABB",
|
||||
"Brightscript": "#662D91",
|
||||
"Browserslist": "#ffd539",
|
||||
"Bru": "#F4AA41",
|
||||
"BuildStream": "#006bff",
|
||||
"C": "#555555",
|
||||
"C#": "#178600",
|
||||
"C++": "#f34b7d",
|
||||
"C3": "#2563eb",
|
||||
"CAP CDS": "#0092d1",
|
||||
"CLIPS": "#00A300",
|
||||
"CMake": "#DA3434",
|
||||
"COLLADA": "#F1A42B",
|
||||
"CSON": "#244776",
|
||||
"CSS": "#563d7c",
|
||||
"CSS": "#663399",
|
||||
"CSV": "#237346",
|
||||
"CUE": "#5886E1",
|
||||
"CWeb": "#00007a",
|
||||
"Cabal Config": "#483465",
|
||||
"Caddyfile": "#22b638",
|
||||
"Cadence": "#00ef8b",
|
||||
"Cairo": "#ff4a48",
|
||||
"Cairo Zero": "#ff4a48",
|
||||
"CameLIGO": "#3be133",
|
||||
"Cangjie": "#00868B",
|
||||
"Cap'n Proto": "#c42727",
|
||||
"Carbon": "#222222",
|
||||
"Ceylon": "#dfa535",
|
||||
"Chapel": "#8dc63f",
|
||||
"ChucK": "#3f8000",
|
||||
@@ -90,6 +102,7 @@
|
||||
"Clojure": "#db5855",
|
||||
"Closure Templates": "#0d948f",
|
||||
"Cloud Firestore Security Rules": "#FFA000",
|
||||
"Clue": "#0009b5",
|
||||
"CodeQL": "#140f46",
|
||||
"CoffeeScript": "#244776",
|
||||
"ColdFusion": "#ed2cd6",
|
||||
@@ -97,13 +110,14 @@
|
||||
"Common Lisp": "#3fb68b",
|
||||
"Common Workflow Language": "#B5314C",
|
||||
"Component Pascal": "#B0CE4E",
|
||||
"Coq": "#d0b68c",
|
||||
"Cooklang": "#E15A29",
|
||||
"Crystal": "#000100",
|
||||
"Csound": "#1a1a1a",
|
||||
"Csound Document": "#1a1a1a",
|
||||
"Csound Score": "#1a1a1a",
|
||||
"Cuda": "#3A4E3A",
|
||||
"Curry": "#531242",
|
||||
"Cylc": "#00b3fd",
|
||||
"Cypher": "#34c0eb",
|
||||
"Cython": "#fedf5b",
|
||||
"D": "#ba595e",
|
||||
@@ -112,6 +126,7 @@
|
||||
"Dafny": "#FFEC25",
|
||||
"Darcs Patch": "#8eff23",
|
||||
"Dart": "#00B4AB",
|
||||
"Daslang": "#d3d3d3",
|
||||
"DataWeave": "#003a52",
|
||||
"Debian Package Control File": "#D70751",
|
||||
"DenizenScript": "#FBEE96",
|
||||
@@ -120,6 +135,7 @@
|
||||
"Dockerfile": "#384d54",
|
||||
"Dogescript": "#cca760",
|
||||
"Dotenv": "#e5d559",
|
||||
"Dune": "#89421e",
|
||||
"Dylan": "#6c616e",
|
||||
"E": "#ccce35",
|
||||
"ECL": "#8a1267",
|
||||
@@ -145,6 +161,7 @@
|
||||
"F#": "#b845fc",
|
||||
"F*": "#572e30",
|
||||
"FIGlet Font": "#FFDDBB",
|
||||
"FIRRTL": "#2f632f",
|
||||
"FLUX": "#88ccff",
|
||||
"Factor": "#636746",
|
||||
"Fancy": "#7b9db4",
|
||||
@@ -152,11 +169,12 @@
|
||||
"Faust": "#c37240",
|
||||
"Fennel": "#fff3d7",
|
||||
"Filebench WML": "#F6B900",
|
||||
"Flix": "#d44a45",
|
||||
"Fluent": "#ffcc33",
|
||||
"Forth": "#341708",
|
||||
"Fortran": "#4d41b1",
|
||||
"Fortran Free Form": "#4d41b1",
|
||||
"FreeBasic": "#141AC9",
|
||||
"FreeBASIC": "#141AC9",
|
||||
"FreeMarker": "#0050b2",
|
||||
"Frege": "#00cafe",
|
||||
"Futhark": "#5f021f",
|
||||
@@ -166,6 +184,7 @@
|
||||
"GAP": "#0000cc",
|
||||
"GCC Machine Description": "#FFCFAB",
|
||||
"GDScript": "#355570",
|
||||
"GDShader": "#478CBF",
|
||||
"GEDCOM": "#003058",
|
||||
"GLSL": "#5686a5",
|
||||
"GSC": "#FF6800",
|
||||
@@ -181,6 +200,7 @@
|
||||
"Gerber Image": "#d20b00",
|
||||
"Gherkin": "#5B2063",
|
||||
"Git Attributes": "#F44D27",
|
||||
"Git Commit": "#F44D27",
|
||||
"Git Config": "#F44D27",
|
||||
"Git Revision List": "#F44D27",
|
||||
"Gleam": "#ffaff3",
|
||||
@@ -205,6 +225,7 @@
|
||||
"Groovy Server Pages": "#4298b8",
|
||||
"HAProxy": "#106da9",
|
||||
"HCL": "#844FBA",
|
||||
"HIP": "#4F3A4F",
|
||||
"HLSL": "#aace60",
|
||||
"HOCON": "#9ff8ee",
|
||||
"HTML": "#e34c26",
|
||||
@@ -219,15 +240,18 @@
|
||||
"Haml": "#ece2a9",
|
||||
"Handlebars": "#f7931e",
|
||||
"Harbour": "#0e60e3",
|
||||
"Hare": "#9d7424",
|
||||
"Haskell": "#5e5086",
|
||||
"Haxe": "#df7900",
|
||||
"HiveQL": "#dce200",
|
||||
"HolyC": "#ffefaf",
|
||||
"Hosts File": "#308888",
|
||||
"Hurl": "#FF0288",
|
||||
"Hy": "#7790B2",
|
||||
"IDL": "#a3522f",
|
||||
"IGOR Pro": "#0000cc",
|
||||
"INI": "#d1dbe0",
|
||||
"ISPC": "#2D68B1",
|
||||
"Idris": "#b30000",
|
||||
"Ignore List": "#000000",
|
||||
"ImageJ Macro": "#99AAFF",
|
||||
@@ -246,11 +270,13 @@
|
||||
"JSON5": "#267CB9",
|
||||
"JSONLD": "#0c479c",
|
||||
"JSONiq": "#40d47e",
|
||||
"Jai": "#ab8b4b",
|
||||
"Janet": "#0886a5",
|
||||
"Jasmin": "#d03600",
|
||||
"Java": "#b07219",
|
||||
"Java Properties": "#2A6277",
|
||||
"Java Server Pages": "#2A6277",
|
||||
"Java Template Engine": "#2A6277",
|
||||
"JavaScript": "#f1e05a",
|
||||
"JavaScript+ERB": "#f1e05a",
|
||||
"Jest Snapshot": "#15c213",
|
||||
@@ -261,8 +287,10 @@
|
||||
"Jolie": "#843179",
|
||||
"Jsonnet": "#0064bd",
|
||||
"Julia": "#a270ba",
|
||||
"Julia REPL": "#a270ba",
|
||||
"Jupyter Notebook": "#DA5B0B",
|
||||
"Just": "#384d54",
|
||||
"KDL": "#ffb3b3",
|
||||
"KRL": "#28430A",
|
||||
"Kaitai Struct": "#773b37",
|
||||
"KakouneScript": "#6f8042",
|
||||
@@ -270,6 +298,8 @@
|
||||
"KiCad Layout": "#2f4aab",
|
||||
"KiCad Legacy Layout": "#2f4aab",
|
||||
"KiCad Schematic": "#2f4aab",
|
||||
"KoLmafia ASH": "#B9D9B9",
|
||||
"Koka": "#215166",
|
||||
"Kotlin": "#A97BFF",
|
||||
"LFE": "#4C3023",
|
||||
"LLVM": "#185619",
|
||||
@@ -279,6 +309,7 @@
|
||||
"Lark": "#2980B9",
|
||||
"Lasso": "#999999",
|
||||
"Latte": "#f2a542",
|
||||
"Leo": "#C4FFC2",
|
||||
"Less": "#1d365d",
|
||||
"Lex": "#DBCA00",
|
||||
"LigoLANG": "#0e74ff",
|
||||
@@ -287,10 +318,13 @@
|
||||
"Literate Agda": "#315665",
|
||||
"Literate CoffeeScript": "#244776",
|
||||
"Literate Haskell": "#5e5086",
|
||||
"LiveCode Script": "#0c5ba5",
|
||||
"LiveScript": "#499886",
|
||||
"Logtalk": "#295b9a",
|
||||
"LookML": "#652B81",
|
||||
"Lua": "#000080",
|
||||
"Luau": "#00A2FF",
|
||||
"M3U": "#179C7D",
|
||||
"MATLAB": "#e16737",
|
||||
"MAXScript": "#00a6a6",
|
||||
"MDX": "#fcb32c",
|
||||
@@ -304,13 +338,13 @@
|
||||
"Markdown": "#083fa1",
|
||||
"Marko": "#42bff2",
|
||||
"Mask": "#f97732",
|
||||
"Mathematica": "#dd1100",
|
||||
"Max": "#c4a79c",
|
||||
"Mercury": "#ff2b2b",
|
||||
"Mermaid": "#ff3670",
|
||||
"Meson": "#007800",
|
||||
"Metal": "#8f14e9",
|
||||
"MiniYAML": "#ff1111",
|
||||
"MiniZinc": "#06a9e6",
|
||||
"Mint": "#02b046",
|
||||
"Mirah": "#c7a938",
|
||||
"Modelica": "#de1d31",
|
||||
@@ -318,12 +352,14 @@
|
||||
"Modula-3": "#223388",
|
||||
"Mojo": "#ff4c1f",
|
||||
"Monkey C": "#8D6747",
|
||||
"MoonBit": "#b92381",
|
||||
"MoonScript": "#ff4585",
|
||||
"Motoko": "#fbb03b",
|
||||
"Motorola 68K Assembly": "#005daa",
|
||||
"Move": "#4a137a",
|
||||
"Mustache": "#724b3b",
|
||||
"NCL": "#28431f",
|
||||
"NMODL": "#00356B",
|
||||
"NPM Config": "#cb3837",
|
||||
"NWScript": "#111522",
|
||||
"Nasal": "#1d2c4e",
|
||||
@@ -335,9 +371,11 @@
|
||||
"NewLisp": "#87AED7",
|
||||
"Nextflow": "#3ac486",
|
||||
"Nginx": "#009639",
|
||||
"Nickel": "#E0C3FC",
|
||||
"Nim": "#ffc200",
|
||||
"Nit": "#009917",
|
||||
"Nix": "#7e7eff",
|
||||
"Noir": "#2f1f49",
|
||||
"Nu": "#c9df40",
|
||||
"NumPy": "#9C8AF9",
|
||||
"Nunjucks": "#3d8137",
|
||||
@@ -347,6 +385,8 @@
|
||||
"OASv3-json": "#85ea2d",
|
||||
"OASv3-yaml": "#85ea2d",
|
||||
"OCaml": "#ef7a08",
|
||||
"OMNeT++ MSG": "#a0e0a0",
|
||||
"OMNeT++ NED": "#08607c",
|
||||
"ObjectScript": "#424893",
|
||||
"Objective-C": "#438eff",
|
||||
"Objective-C++": "#6866fb",
|
||||
@@ -363,6 +403,7 @@
|
||||
"OpenSCAD": "#e5cd45",
|
||||
"Option List": "#476732",
|
||||
"Org": "#77aa99",
|
||||
"OverpassQL": "#cce2aa",
|
||||
"Oxygene": "#cdd0e3",
|
||||
"Oz": "#fab738",
|
||||
"P4": "#7055b5",
|
||||
@@ -384,6 +425,7 @@
|
||||
"PigLatin": "#fcd7de",
|
||||
"Pike": "#005390",
|
||||
"Pip Requirements": "#FFD343",
|
||||
"Pkl": "#6b9543",
|
||||
"PlantUML": "#fbbd16",
|
||||
"PogoScript": "#d80074",
|
||||
"Polar": "#ae81ff",
|
||||
@@ -411,12 +453,16 @@
|
||||
"QML": "#44a51c",
|
||||
"Qt Script": "#00b841",
|
||||
"Quake": "#882233",
|
||||
"QuakeC": "#975777",
|
||||
"QuickBASIC": "#008080",
|
||||
"R": "#198CE7",
|
||||
"RAML": "#77d9fb",
|
||||
"RBS": "#701516",
|
||||
"RDoc": "#701516",
|
||||
"REXX": "#d90e09",
|
||||
"RMarkdown": "#198ce7",
|
||||
"RON": "#a62c00",
|
||||
"ROS Interface": "#22314e",
|
||||
"RPGLE": "#2BDE21",
|
||||
"RUNOFF": "#665a4e",
|
||||
"Racket": "#3c5caa",
|
||||
@@ -436,6 +482,7 @@
|
||||
"Riot": "#A71E49",
|
||||
"RobotFramework": "#00c0b5",
|
||||
"Roc": "#7c38f5",
|
||||
"Rocq Prover": "#d0b68c",
|
||||
"Roff": "#ecdebe",
|
||||
"Roff Manpage": "#ecdebe",
|
||||
"Rouge": "#cc0088",
|
||||
@@ -451,6 +498,7 @@
|
||||
"SRecode Template": "#348a34",
|
||||
"STL": "#373b5e",
|
||||
"SVG": "#ff9900",
|
||||
"Sail": "#259dd5",
|
||||
"SaltStack": "#646464",
|
||||
"Sass": "#a53b70",
|
||||
"Scala": "#c22d40",
|
||||
@@ -465,6 +513,7 @@
|
||||
"Shen": "#120F14",
|
||||
"Simple File Verification": "#C9BFED",
|
||||
"Singularity": "#64E6AD",
|
||||
"Slang": "#1fbec9",
|
||||
"Slash": "#007eff",
|
||||
"Slice": "#003fa2",
|
||||
"Slim": "#2b2b2b",
|
||||
@@ -486,6 +535,7 @@
|
||||
"SubRip Text": "#9e0101",
|
||||
"SugarSS": "#2fcc9f",
|
||||
"SuperCollider": "#46390b",
|
||||
"Survex data": "#ffcc99",
|
||||
"Svelte": "#ff3e00",
|
||||
"Sway": "#00F58C",
|
||||
"Sweave": "#198ce7",
|
||||
@@ -499,9 +549,11 @@
|
||||
"TSV": "#237346",
|
||||
"TSX": "#3178c6",
|
||||
"TXL": "#0178b8",
|
||||
"Tact": "#48b5ff",
|
||||
"Talon": "#333333",
|
||||
"Tcl": "#e4cc98",
|
||||
"TeX": "#3D6117",
|
||||
"Teal": "#00B1BC",
|
||||
"Terra": "#00004c",
|
||||
"Terraform Template": "#7b42bb",
|
||||
"TextGrid": "#c8506d",
|
||||
@@ -509,14 +561,18 @@
|
||||
"Textile": "#ffe7ac",
|
||||
"Thrift": "#D12127",
|
||||
"Toit": "#c2c9fb",
|
||||
"Tor Config": "#59316b",
|
||||
"Tree-sitter Query": "#8ea64c",
|
||||
"Turing": "#cf142b",
|
||||
"Twig": "#c1d026",
|
||||
"TypeScript": "#3178c6",
|
||||
"TypeSpec": "#4A3665",
|
||||
"Typst": "#239dad",
|
||||
"Unified Parallel C": "#4e3617",
|
||||
"Unity3D Asset": "#222c37",
|
||||
"Uno": "#9933cc",
|
||||
"UnrealScript": "#a54c4d",
|
||||
"Untyped Plutus Core": "#36adbd",
|
||||
"UrWeb": "#ccccee",
|
||||
"V": "#4f87c4",
|
||||
"VBA": "#867db1",
|
||||
@@ -526,6 +582,7 @@
|
||||
"Vala": "#a56de2",
|
||||
"Valve Data Format": "#f26025",
|
||||
"Velocity Template Language": "#507cff",
|
||||
"Vento": "#ff0080",
|
||||
"Verilog": "#b2b7f8",
|
||||
"Vim Help File": "#199f4b",
|
||||
"Vim Script": "#199f4b",
|
||||
@@ -534,7 +591,7 @@
|
||||
"Visual Basic 6.0": "#2c6353",
|
||||
"Volt": "#1F1F1F",
|
||||
"Vue": "#41b883",
|
||||
"Vyper": "#2980b9",
|
||||
"Vyper": "#9F4CF2",
|
||||
"WDL": "#42f1f4",
|
||||
"WGSL": "#1a5e9a",
|
||||
"Web Ontology Language": "#5b70bd",
|
||||
@@ -544,6 +601,7 @@
|
||||
"Wikitext": "#fc5757",
|
||||
"Windows Registry Entries": "#52d5ff",
|
||||
"Witcher Script": "#ff0000",
|
||||
"Wolfram Language": "#dd1100",
|
||||
"Wollok": "#a23738",
|
||||
"World of Warcraft Addon Data": "#f7e43f",
|
||||
"Wren": "#383838",
|
||||
@@ -553,6 +611,7 @@
|
||||
"XML Property List": "#0060ac",
|
||||
"XQuery": "#5232e7",
|
||||
"XSLT": "#EB8CEB",
|
||||
"Xmake": "#22a079",
|
||||
"Xojo": "#81bd41",
|
||||
"Xonsh": "#285EEF",
|
||||
"Xtend": "#24255d",
|
||||
@@ -567,13 +626,17 @@
|
||||
"Zephir": "#118f9e",
|
||||
"Zig": "#ec915c",
|
||||
"Zimpl": "#d67711",
|
||||
"Zmodel": "#ff7100",
|
||||
"crontab": "#ead7ac",
|
||||
"eC": "#913960",
|
||||
"fish": "#4aae47",
|
||||
"hoon": "#00b171",
|
||||
"iCalendar": "#ec564c",
|
||||
"jq": "#c7254e",
|
||||
"kvlang": "#1da6e0",
|
||||
"mIRC Script": "#3d57c3",
|
||||
"mcfunction": "#E22837",
|
||||
"mdsvex": "#5f9ea0",
|
||||
"mupad": "#244963",
|
||||
"nanorc": "#2d004d",
|
||||
"nesC": "#94B0C7",
|
||||
@@ -581,6 +644,8 @@
|
||||
"q": "#0040cd",
|
||||
"reStructuredText": "#141414",
|
||||
"sed": "#64b970",
|
||||
"templ": "#66D0DD",
|
||||
"vCard": "#ee2647",
|
||||
"wisp": "#7582D1",
|
||||
"xBase": "#403a40"
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
// @ts-check
|
||||
|
||||
const noop = () => {};
|
||||
|
||||
/**
|
||||
* Return console instance based on the environment.
|
||||
*
|
||||
* @type {Console | {log: () => void, error: () => void}}
|
||||
*/
|
||||
const logger =
|
||||
process.env.NODE_ENV === "test" ? { log: noop, error: noop } : console;
|
||||
|
||||
export { logger };
|
||||
export default logger;
|
||||
@@ -0,0 +1,124 @@
|
||||
// @ts-check
|
||||
|
||||
import toEmoji from "emoji-name-map";
|
||||
|
||||
/**
|
||||
* Returns boolean if value is either "true" or "false" else the value as it is.
|
||||
*
|
||||
* @param {string | boolean} value The value to parse.
|
||||
* @returns {boolean | undefined } The parsed value.
|
||||
*/
|
||||
const parseBoolean = (value) => {
|
||||
if (typeof value === "boolean") {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (typeof value === "string") {
|
||||
if (value.toLowerCase() === "true") {
|
||||
return true;
|
||||
} else if (value.toLowerCase() === "false") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse string to array of strings.
|
||||
*
|
||||
* @param {string} str The string to parse.
|
||||
* @returns {string[]} The array of strings.
|
||||
*/
|
||||
const parseArray = (str) => {
|
||||
if (!str) {
|
||||
return [];
|
||||
}
|
||||
return str.split(",");
|
||||
};
|
||||
|
||||
/**
|
||||
* Clamp the given number between the given range.
|
||||
*
|
||||
* @param {number} number The number to clamp.
|
||||
* @param {number} min The minimum value.
|
||||
* @param {number} max The maximum value.
|
||||
* @returns {number} The clamped number.
|
||||
*/
|
||||
const clampValue = (number, min, max) => {
|
||||
// @ts-ignore
|
||||
if (Number.isNaN(parseInt(number, 10))) {
|
||||
return min;
|
||||
}
|
||||
return Math.max(min, Math.min(number, max));
|
||||
};
|
||||
|
||||
/**
|
||||
* Lowercase and trim string.
|
||||
*
|
||||
* @param {string} name String to lowercase and trim.
|
||||
* @returns {string} Lowercased and trimmed string.
|
||||
*/
|
||||
const lowercaseTrim = (name) => name.toLowerCase().trim();
|
||||
|
||||
/**
|
||||
* Split array of languages in two columns.
|
||||
*
|
||||
* @template T Language object.
|
||||
* @param {Array<T>} arr Array of languages.
|
||||
* @param {number} perChunk Number of languages per column.
|
||||
* @returns {Array<T>} Array of languages split in two columns.
|
||||
*/
|
||||
const chunkArray = (arr, perChunk) => {
|
||||
return arr.reduce((resultArray, item, index) => {
|
||||
const chunkIndex = Math.floor(index / perChunk);
|
||||
|
||||
if (!resultArray[chunkIndex]) {
|
||||
// @ts-ignore
|
||||
resultArray[chunkIndex] = []; // start a new chunk
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
resultArray[chunkIndex].push(item);
|
||||
|
||||
return resultArray;
|
||||
}, []);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse emoji from string.
|
||||
*
|
||||
* @param {string} str String to parse emoji from.
|
||||
* @returns {string} String with emoji parsed.
|
||||
*/
|
||||
const parseEmojis = (str) => {
|
||||
if (!str) {
|
||||
throw new Error("[parseEmoji]: str argument not provided");
|
||||
}
|
||||
return str.replace(/:\w+:/gm, (emoji) => {
|
||||
return toEmoji.get(emoji) || "";
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get diff in minutes between two dates.
|
||||
*
|
||||
* @param {Date} d1 First date.
|
||||
* @param {Date} d2 Second date.
|
||||
* @returns {number} Number of minutes between the two dates.
|
||||
*/
|
||||
const dateDiff = (d1, d2) => {
|
||||
const date1 = new Date(d1);
|
||||
const date2 = new Date(d2);
|
||||
const diff = date1.getTime() - date2.getTime();
|
||||
return Math.round(diff / (1000 * 60));
|
||||
};
|
||||
|
||||
export {
|
||||
parseBoolean,
|
||||
parseArray,
|
||||
clampValue,
|
||||
lowercaseTrim,
|
||||
chunkArray,
|
||||
parseEmojis,
|
||||
dateDiff,
|
||||
};
|
||||
@@ -0,0 +1,239 @@
|
||||
// @ts-check
|
||||
|
||||
import { SECONDARY_ERROR_MESSAGES, TRY_AGAIN_LATER } from "./error.js";
|
||||
import { getCardColors } from "./color.js";
|
||||
import { encodeHTML } from "./html.js";
|
||||
import { clampValue } from "./ops.js";
|
||||
|
||||
/**
|
||||
* Auto layout utility, allows us to layout things vertically or horizontally with
|
||||
* proper gaping.
|
||||
*
|
||||
* @param {object} props Function properties.
|
||||
* @param {string[]} props.items Array of items to layout.
|
||||
* @param {number} props.gap Gap between items.
|
||||
* @param {"column" | "row"=} props.direction Direction to layout items.
|
||||
* @param {number[]=} props.sizes Array of sizes for each item.
|
||||
* @returns {string[]} Array of items with proper layout.
|
||||
*/
|
||||
const flexLayout = ({ items, gap, direction, sizes = [] }) => {
|
||||
let lastSize = 0;
|
||||
// filter() for filtering out empty strings
|
||||
return items.filter(Boolean).map((item, i) => {
|
||||
const size = sizes[i] || 0;
|
||||
let transform = `translate(${lastSize}, 0)`;
|
||||
if (direction === "column") {
|
||||
transform = `translate(0, ${lastSize})`;
|
||||
}
|
||||
lastSize += size + gap;
|
||||
return `<g transform="${transform}">${item}</g>`;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a node to display the primary programming language of the repository/gist.
|
||||
*
|
||||
* @param {string} langName Language name.
|
||||
* @param {string} langColor Language color.
|
||||
* @returns {string} Language display SVG object.
|
||||
*/
|
||||
const createLanguageNode = (langName, langColor) => {
|
||||
return `
|
||||
<g data-testid="primary-lang">
|
||||
<circle data-testid="lang-color" cx="0" cy="-5" r="6" fill="${langColor}" />
|
||||
<text data-testid="lang-name" class="gray" x="15">${langName}</text>
|
||||
</g>
|
||||
`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Create a node to indicate progress in percentage along a horizontal line.
|
||||
*
|
||||
* @param {Object} params Object that contains the createProgressNode parameters.
|
||||
* @param {number} params.x X-axis position.
|
||||
* @param {number} params.y Y-axis position.
|
||||
* @param {number} params.width Width of progress bar.
|
||||
* @param {string} params.color Progress color.
|
||||
* @param {number} params.progress Progress value.
|
||||
* @param {string} params.progressBarBackgroundColor Progress bar bg color.
|
||||
* @param {number} params.delay Delay before animation starts.
|
||||
* @returns {string} Progress node.
|
||||
*/
|
||||
const createProgressNode = ({
|
||||
x,
|
||||
y,
|
||||
width,
|
||||
color,
|
||||
progress,
|
||||
progressBarBackgroundColor,
|
||||
delay,
|
||||
}) => {
|
||||
const progressPercentage = clampValue(progress, 2, 100);
|
||||
|
||||
return `
|
||||
<svg width="${width}" x="${x}" y="${y}">
|
||||
<rect rx="5" ry="5" x="0" y="0" width="${width}" height="8" fill="${progressBarBackgroundColor}"></rect>
|
||||
<svg data-testid="lang-progress" width="${progressPercentage}%">
|
||||
<rect
|
||||
height="8"
|
||||
fill="${color}"
|
||||
rx="5" ry="5" x="0" y="0"
|
||||
class="lang-progress"
|
||||
style="animation-delay: ${delay}ms;"
|
||||
/>
|
||||
</svg>
|
||||
</svg>
|
||||
`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an icon with label to display repository/gist stats like forks, stars, etc.
|
||||
*
|
||||
* @param {string} icon The icon to display.
|
||||
* @param {number|string} label The label to display.
|
||||
* @param {string} testid The testid to assign to the label.
|
||||
* @param {number} iconSize The size of the icon.
|
||||
* @returns {string} Icon with label SVG object.
|
||||
*/
|
||||
const iconWithLabel = (icon, label, testid, iconSize) => {
|
||||
if (typeof label === "number" && label <= 0) {
|
||||
return "";
|
||||
}
|
||||
const iconSvg = `
|
||||
<svg
|
||||
class="icon"
|
||||
y="-12"
|
||||
viewBox="0 0 16 16"
|
||||
version="1.1"
|
||||
width="${iconSize}"
|
||||
height="${iconSize}"
|
||||
>
|
||||
${icon}
|
||||
</svg>
|
||||
`;
|
||||
const text = `<text data-testid="${testid}" class="gray">${label}</text>`;
|
||||
return flexLayout({ items: [iconSvg, text], gap: 20 }).join("");
|
||||
};
|
||||
|
||||
// Script parameters.
|
||||
const ERROR_CARD_LENGTH = 576.5;
|
||||
|
||||
const UPSTREAM_API_ERRORS = [
|
||||
TRY_AGAIN_LATER,
|
||||
SECONDARY_ERROR_MESSAGES.MAX_RETRY,
|
||||
];
|
||||
|
||||
/**
|
||||
* Renders error message on the card.
|
||||
*
|
||||
* @param {object} args Function arguments.
|
||||
* @param {string} args.message Main error message.
|
||||
* @param {string} [args.secondaryMessage=""] The secondary error message.
|
||||
* @param {object} [args.renderOptions={}] Render options.
|
||||
* @param {string=} args.renderOptions.title_color Card title color.
|
||||
* @param {string=} args.renderOptions.text_color Card text color.
|
||||
* @param {string=} args.renderOptions.bg_color Card background color.
|
||||
* @param {string=} args.renderOptions.border_color Card border color.
|
||||
* @param {Parameters<typeof getCardColors>[0]["theme"]=} args.renderOptions.theme Card theme.
|
||||
* @param {boolean=} args.renderOptions.show_repo_link Whether to show repo link or not.
|
||||
* @returns {string} The SVG markup.
|
||||
*/
|
||||
const renderError = ({
|
||||
message,
|
||||
secondaryMessage = "",
|
||||
renderOptions = {},
|
||||
}) => {
|
||||
const {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme = "default",
|
||||
show_repo_link = true,
|
||||
} = renderOptions;
|
||||
|
||||
// returns theme based colors with proper overrides and defaults
|
||||
const { titleColor, textColor, bgColor, borderColor } = getCardColors({
|
||||
title_color,
|
||||
text_color,
|
||||
icon_color: "",
|
||||
bg_color,
|
||||
border_color,
|
||||
ring_color: "",
|
||||
theme,
|
||||
});
|
||||
|
||||
return `
|
||||
<svg width="${ERROR_CARD_LENGTH}" height="120" viewBox="0 0 ${ERROR_CARD_LENGTH} 120" fill="${bgColor}" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.text { font: 600 16px 'Segoe UI', Ubuntu, Sans-Serif; fill: ${titleColor} }
|
||||
.small { font: 600 12px 'Segoe UI', Ubuntu, Sans-Serif; fill: ${textColor} }
|
||||
.gray { fill: #858585 }
|
||||
</style>
|
||||
<rect x="0.5" y="0.5" width="${
|
||||
ERROR_CARD_LENGTH - 1
|
||||
}" height="99%" rx="4.5" fill="${bgColor}" stroke="${borderColor}"/>
|
||||
<text x="25" y="45" class="text">Something went wrong!${
|
||||
UPSTREAM_API_ERRORS.includes(secondaryMessage) || !show_repo_link
|
||||
? ""
|
||||
: " file an issue at https://tiny.one/readme-stats"
|
||||
}</text>
|
||||
<text data-testid="message" x="25" y="55" class="text small">
|
||||
<tspan x="25" dy="18">${encodeHTML(message)}</tspan>
|
||||
<tspan x="25" dy="18" class="gray">${secondaryMessage}</tspan>
|
||||
</text>
|
||||
</svg>
|
||||
`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieve text length.
|
||||
*
|
||||
* @see https://stackoverflow.com/a/48172630/10629172
|
||||
* @param {string} str String to measure.
|
||||
* @param {number} fontSize Font size.
|
||||
* @returns {number} Text length.
|
||||
*/
|
||||
const measureText = (str, fontSize = 10) => {
|
||||
// prettier-ignore
|
||||
const widths = [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0.2796875, 0.2765625,
|
||||
0.3546875, 0.5546875, 0.5546875, 0.8890625, 0.665625, 0.190625,
|
||||
0.3328125, 0.3328125, 0.3890625, 0.5828125, 0.2765625, 0.3328125,
|
||||
0.2765625, 0.3015625, 0.5546875, 0.5546875, 0.5546875, 0.5546875,
|
||||
0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875,
|
||||
0.2765625, 0.2765625, 0.584375, 0.5828125, 0.584375, 0.5546875,
|
||||
1.0140625, 0.665625, 0.665625, 0.721875, 0.721875, 0.665625,
|
||||
0.609375, 0.7765625, 0.721875, 0.2765625, 0.5, 0.665625,
|
||||
0.5546875, 0.8328125, 0.721875, 0.7765625, 0.665625, 0.7765625,
|
||||
0.721875, 0.665625, 0.609375, 0.721875, 0.665625, 0.94375,
|
||||
0.665625, 0.665625, 0.609375, 0.2765625, 0.3546875, 0.2765625,
|
||||
0.4765625, 0.5546875, 0.3328125, 0.5546875, 0.5546875, 0.5,
|
||||
0.5546875, 0.5546875, 0.2765625, 0.5546875, 0.5546875, 0.221875,
|
||||
0.240625, 0.5, 0.221875, 0.8328125, 0.5546875, 0.5546875,
|
||||
0.5546875, 0.5546875, 0.3328125, 0.5, 0.2765625, 0.5546875,
|
||||
0.5, 0.721875, 0.5, 0.5, 0.5, 0.3546875, 0.259375, 0.353125, 0.5890625,
|
||||
];
|
||||
|
||||
const avg = 0.5279276315789471;
|
||||
return (
|
||||
str
|
||||
.split("")
|
||||
.map((c) =>
|
||||
c.charCodeAt(0) < widths.length ? widths[c.charCodeAt(0)] : avg,
|
||||
)
|
||||
.reduce((cur, acc) => acc + cur) * fontSize
|
||||
);
|
||||
};
|
||||
|
||||
export {
|
||||
ERROR_CARD_LENGTH,
|
||||
renderError,
|
||||
createLanguageNode,
|
||||
createProgressNode,
|
||||
iconWithLabel,
|
||||
flexLayout,
|
||||
measureText,
|
||||
};
|
||||
+33
-12
@@ -1,4 +1,7 @@
|
||||
import { CustomError, logger } from "./utils.js";
|
||||
// @ts-check
|
||||
|
||||
import { CustomError } from "./error.js";
|
||||
import { logger } from "./log.js";
|
||||
|
||||
// Script variables.
|
||||
|
||||
@@ -10,41 +13,50 @@ const RETRIES = process.env.NODE_ENV === "test" ? 7 : PATs;
|
||||
|
||||
/**
|
||||
* @typedef {import("axios").AxiosResponse} AxiosResponse Axios response.
|
||||
* @typedef {(variables: object, token: string) => Promise<AxiosResponse>} FetcherFunction Fetcher function.
|
||||
* @typedef {(variables: any, token: string, retriesForTests?: number) => Promise<AxiosResponse>} FetcherFunction Fetcher function.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Try to execute the fetcher function until it succeeds or the max number of retries is reached.
|
||||
*
|
||||
* @param {FetcherFunction} fetcher The fetcher function.
|
||||
* @param {object} variables Object with arguments to pass to the fetcher function.
|
||||
* @param {any} variables Object with arguments to pass to the fetcher function.
|
||||
* @param {number} retries How many times to retry.
|
||||
* @returns {Promise<T>} The response from the fetcher function.
|
||||
* @returns {Promise<any>} The response from the fetcher function.
|
||||
*/
|
||||
const retryer = async (fetcher, variables, retries = 0) => {
|
||||
if (!RETRIES) {
|
||||
throw new CustomError("No GitHub API tokens found", CustomError.NO_TOKENS);
|
||||
}
|
||||
|
||||
if (retries > RETRIES) {
|
||||
throw new CustomError(
|
||||
"Downtime due to GitHub API rate limiting",
|
||||
CustomError.MAX_RETRY,
|
||||
);
|
||||
}
|
||||
|
||||
try {
|
||||
// try to fetch with the first token since RETRIES is 0 index i'm adding +1
|
||||
let response = await fetcher(
|
||||
variables,
|
||||
// @ts-ignore
|
||||
process.env[`PAT_${retries + 1}`],
|
||||
// used in tests for faking rate limit
|
||||
retries,
|
||||
);
|
||||
|
||||
// prettier-ignore
|
||||
const isRateExceeded = response.data.errors && response.data.errors[0].type === "RATE_LIMITED";
|
||||
// react on both type and message-based rate-limit signals.
|
||||
// https://github.com/anuraghazra/github-readme-stats/issues/4425
|
||||
const errors = response?.data?.errors;
|
||||
const errorType = errors?.[0]?.type;
|
||||
const errorMsg = errors?.[0]?.message || "";
|
||||
const isRateLimited =
|
||||
(errors && errorType === "RATE_LIMITED") || /rate limit/i.test(errorMsg);
|
||||
|
||||
// if rate limit is hit increase the RETRIES and recursively call the retryer
|
||||
// with username, and current RETRIES
|
||||
if (isRateExceeded) {
|
||||
if (isRateLimited) {
|
||||
logger.log(`PAT_${retries + 1} Failed`);
|
||||
retries++;
|
||||
// directly return from the function
|
||||
@@ -54,21 +66,30 @@ const retryer = async (fetcher, variables, retries = 0) => {
|
||||
// finally return the response
|
||||
return response;
|
||||
} catch (err) {
|
||||
/** @type {any} */
|
||||
const e = err;
|
||||
|
||||
// network/unexpected error → let caller treat as failure
|
||||
if (!e?.response) {
|
||||
throw e;
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
// also checking for bad credentials if any tokens gets invalidated
|
||||
const isBadCredential = err.response.data && err.response.data.message === "Bad credentials";
|
||||
const isBadCredential =
|
||||
e?.response?.data?.message === "Bad credentials";
|
||||
const isAccountSuspended =
|
||||
err.response.data &&
|
||||
err.response.data.message === "Sorry. Your account was suspended.";
|
||||
e?.response?.data?.message === "Sorry. Your account was suspended.";
|
||||
|
||||
if (isBadCredential || isAccountSuspended) {
|
||||
logger.log(`PAT_${retries + 1} Failed`);
|
||||
retries++;
|
||||
// directly return from the function
|
||||
return retryer(fetcher, variables, retries);
|
||||
} else {
|
||||
return err.response;
|
||||
}
|
||||
|
||||
// HTTP error with a response → return it for caller-side handling
|
||||
return e.response;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -1,618 +0,0 @@
|
||||
// @ts-check
|
||||
import axios from "axios";
|
||||
import toEmoji from "emoji-name-map";
|
||||
import wrap from "word-wrap";
|
||||
import { themes } from "../../themes/index.js";
|
||||
|
||||
const TRY_AGAIN_LATER = "Please try again later";
|
||||
|
||||
const SECONDARY_ERROR_MESSAGES = {
|
||||
MAX_RETRY:
|
||||
"You can deploy own instance or wait until public will be no longer limited",
|
||||
NO_TOKENS:
|
||||
"Please add an env variable called PAT_1 with your GitHub API token in vercel",
|
||||
USER_NOT_FOUND: "Make sure the provided username is not an organization",
|
||||
GRAPHQL_ERROR: TRY_AGAIN_LATER,
|
||||
GITHUB_REST_API_ERROR: TRY_AGAIN_LATER,
|
||||
WAKATIME_USER_NOT_FOUND: "Make sure you have a public WakaTime profile",
|
||||
};
|
||||
|
||||
/**
|
||||
* Custom error class to handle custom GRS errors.
|
||||
*/
|
||||
class CustomError extends Error {
|
||||
/**
|
||||
* @param {string} message Error message.
|
||||
* @param {string} type Error type.
|
||||
*/
|
||||
constructor(message, type) {
|
||||
super(message);
|
||||
this.type = type;
|
||||
this.secondaryMessage = SECONDARY_ERROR_MESSAGES[type] || type;
|
||||
}
|
||||
|
||||
static MAX_RETRY = "MAX_RETRY";
|
||||
static NO_TOKENS = "NO_TOKENS";
|
||||
static USER_NOT_FOUND = "USER_NOT_FOUND";
|
||||
static GRAPHQL_ERROR = "GRAPHQL_ERROR";
|
||||
static GITHUB_REST_API_ERROR = "GITHUB_REST_API_ERROR";
|
||||
static WAKATIME_ERROR = "WAKATIME_ERROR";
|
||||
}
|
||||
|
||||
/**
|
||||
* Auto layout utility, allows us to layout things vertically or horizontally with
|
||||
* proper gaping.
|
||||
*
|
||||
* @param {object} props Function properties.
|
||||
* @param {string[]} props.items Array of items to layout.
|
||||
* @param {number} props.gap Gap between items.
|
||||
* @param {"column" | "row"=} props.direction Direction to layout items.
|
||||
* @param {number[]=} props.sizes Array of sizes for each item.
|
||||
* @returns {string[]} Array of items with proper layout.
|
||||
*/
|
||||
const flexLayout = ({ items, gap, direction, sizes = [] }) => {
|
||||
let lastSize = 0;
|
||||
// filter() for filtering out empty strings
|
||||
return items.filter(Boolean).map((item, i) => {
|
||||
const size = sizes[i] || 0;
|
||||
let transform = `translate(${lastSize}, 0)`;
|
||||
if (direction === "column") {
|
||||
transform = `translate(0, ${lastSize})`;
|
||||
}
|
||||
lastSize += size + gap;
|
||||
return `<g transform="${transform}">${item}</g>`;
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a node to display the primary programming language of the repository/gist.
|
||||
*
|
||||
* @param {string} langName Language name.
|
||||
* @param {string} langColor Language color.
|
||||
* @returns {string} Language display SVG object.
|
||||
*/
|
||||
const createLanguageNode = (langName, langColor) => {
|
||||
return `
|
||||
<g data-testid="primary-lang">
|
||||
<circle data-testid="lang-color" cx="0" cy="-5" r="6" fill="${langColor}" />
|
||||
<text data-testid="lang-name" class="gray" x="15">${langName}</text>
|
||||
</g>
|
||||
`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates an icon with label to display repository/gist stats like forks, stars, etc.
|
||||
*
|
||||
* @param {string} icon The icon to display.
|
||||
* @param {number|string} label The label to display.
|
||||
* @param {string} testid The testid to assign to the label.
|
||||
* @param {number} iconSize The size of the icon.
|
||||
* @returns {string} Icon with label SVG object.
|
||||
*/
|
||||
const iconWithLabel = (icon, label, testid, iconSize) => {
|
||||
if (typeof label === "number" && label <= 0) {
|
||||
return "";
|
||||
}
|
||||
const iconSvg = `
|
||||
<svg
|
||||
class="icon"
|
||||
y="-12"
|
||||
viewBox="0 0 16 16"
|
||||
version="1.1"
|
||||
width="${iconSize}"
|
||||
height="${iconSize}"
|
||||
>
|
||||
${icon}
|
||||
</svg>
|
||||
`;
|
||||
const text = `<text data-testid="${testid}" class="gray">${label}</text>`;
|
||||
return flexLayout({ items: [iconSvg, text], gap: 20 }).join("");
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves num with suffix k(thousands) precise to 1 decimal if greater than 999.
|
||||
*
|
||||
* @param {number} num The number to format.
|
||||
* @returns {string|number} The formatted number.
|
||||
*/
|
||||
const kFormatter = (num) => {
|
||||
return Math.abs(num) > 999
|
||||
? Math.sign(num) * parseFloat((Math.abs(num) / 1000).toFixed(1)) + "k"
|
||||
: Math.sign(num) * Math.abs(num);
|
||||
};
|
||||
|
||||
/**
|
||||
* Checks if a string is a valid hex color.
|
||||
*
|
||||
* @param {string} hexColor String to check.
|
||||
* @returns {boolean} True if the given string is a valid hex color.
|
||||
*/
|
||||
const isValidHexColor = (hexColor) => {
|
||||
return new RegExp(
|
||||
/^([A-Fa-f0-9]{8}|[A-Fa-f0-9]{6}|[A-Fa-f0-9]{3}|[A-Fa-f0-9]{4})$/,
|
||||
).test(hexColor);
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns boolean if value is either "true" or "false" else the value as it is.
|
||||
*
|
||||
* @param {string | boolean} value The value to parse.
|
||||
* @returns {boolean | undefined } The parsed value.
|
||||
*/
|
||||
const parseBoolean = (value) => {
|
||||
if (typeof value === "boolean") {
|
||||
return value;
|
||||
}
|
||||
|
||||
if (typeof value === "string") {
|
||||
if (value.toLowerCase() === "true") {
|
||||
return true;
|
||||
} else if (value.toLowerCase() === "false") {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse string to array of strings.
|
||||
*
|
||||
* @param {string} str The string to parse.
|
||||
* @returns {string[]} The array of strings.
|
||||
*/
|
||||
const parseArray = (str) => {
|
||||
if (!str) {
|
||||
return [];
|
||||
}
|
||||
return str.split(",");
|
||||
};
|
||||
|
||||
/**
|
||||
* Clamp the given number between the given range.
|
||||
*
|
||||
* @param {number} number The number to clamp.
|
||||
* @param {number} min The minimum value.
|
||||
* @param {number} max The maximum value.
|
||||
* @returns {number} The clamped number.
|
||||
*/
|
||||
const clampValue = (number, min, max) => {
|
||||
// @ts-ignore
|
||||
if (Number.isNaN(parseInt(number, 10))) {
|
||||
return min;
|
||||
}
|
||||
return Math.max(min, Math.min(number, max));
|
||||
};
|
||||
|
||||
/**
|
||||
* Check if the given string is a valid gradient.
|
||||
*
|
||||
* @param {string[]} colors Array of colors.
|
||||
* @returns {boolean} True if the given string is a valid gradient.
|
||||
*/
|
||||
const isValidGradient = (colors) => {
|
||||
return (
|
||||
colors.length > 2 &&
|
||||
colors.slice(1).every((color) => isValidHexColor(color))
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves a gradient if color has more than one valid hex codes else a single color.
|
||||
*
|
||||
* @param {string} color The color to parse.
|
||||
* @param {string | string[]} fallbackColor The fallback color.
|
||||
* @returns {string | string[]} The gradient or color.
|
||||
*/
|
||||
const fallbackColor = (color, fallbackColor) => {
|
||||
let gradient = null;
|
||||
|
||||
let colors = color ? color.split(",") : [];
|
||||
if (colors.length > 1 && isValidGradient(colors)) {
|
||||
gradient = colors;
|
||||
}
|
||||
|
||||
return (
|
||||
(gradient ? gradient : isValidHexColor(color) && `#${color}`) ||
|
||||
fallbackColor
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {import('axios').AxiosRequestConfig['data']} AxiosRequestConfigData Axios request data.
|
||||
* @typedef {import('axios').AxiosRequestConfig['headers']} AxiosRequestConfigHeaders Axios request headers.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Send GraphQL request to GitHub API.
|
||||
*
|
||||
* @param {AxiosRequestConfigData} data Request data.
|
||||
* @param {AxiosRequestConfigHeaders} headers Request headers.
|
||||
* @returns {Promise<any>} Request response.
|
||||
*/
|
||||
const request = (data, headers) => {
|
||||
return axios({
|
||||
url: "https://api.github.com/graphql",
|
||||
method: "post",
|
||||
headers,
|
||||
data,
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Object containing card colors.
|
||||
* @typedef {{
|
||||
* titleColor: string;
|
||||
* iconColor: string;
|
||||
* textColor: string;
|
||||
* bgColor: string | string[];
|
||||
* borderColor: string;
|
||||
* ringColor: string;
|
||||
* }} CardColors
|
||||
*/
|
||||
|
||||
/**
|
||||
* Returns theme based colors with proper overrides and defaults.
|
||||
*
|
||||
* @param {Object} args Function arguments.
|
||||
* @param {string=} args.title_color Card title color.
|
||||
* @param {string=} args.text_color Card text color.
|
||||
* @param {string=} args.icon_color Card icon color.
|
||||
* @param {string=} args.bg_color Card background color.
|
||||
* @param {string=} args.border_color Card border color.
|
||||
* @param {string=} args.ring_color Card ring color.
|
||||
* @param {string=} args.theme Card theme.
|
||||
* @param {string=} args.fallbackTheme Fallback theme.
|
||||
* @returns {CardColors} Card colors.
|
||||
*/
|
||||
const getCardColors = ({
|
||||
title_color,
|
||||
text_color,
|
||||
icon_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
ring_color,
|
||||
theme,
|
||||
fallbackTheme = "default",
|
||||
}) => {
|
||||
const defaultTheme = themes[fallbackTheme];
|
||||
const selectedTheme = themes[theme] || defaultTheme;
|
||||
const defaultBorderColor =
|
||||
selectedTheme.border_color || defaultTheme.border_color;
|
||||
|
||||
// get the color provided by the user else the theme color
|
||||
// finally if both colors are invalid fallback to default theme
|
||||
const titleColor = fallbackColor(
|
||||
title_color || selectedTheme.title_color,
|
||||
"#" + defaultTheme.title_color,
|
||||
);
|
||||
|
||||
// get the color provided by the user else the theme color
|
||||
// finally if both colors are invalid we use the titleColor
|
||||
const ringColor = fallbackColor(
|
||||
ring_color || selectedTheme.ring_color,
|
||||
titleColor,
|
||||
);
|
||||
const iconColor = fallbackColor(
|
||||
icon_color || selectedTheme.icon_color,
|
||||
"#" + defaultTheme.icon_color,
|
||||
);
|
||||
const textColor = fallbackColor(
|
||||
text_color || selectedTheme.text_color,
|
||||
"#" + defaultTheme.text_color,
|
||||
);
|
||||
const bgColor = fallbackColor(
|
||||
bg_color || selectedTheme.bg_color,
|
||||
"#" + defaultTheme.bg_color,
|
||||
);
|
||||
|
||||
const borderColor = fallbackColor(
|
||||
border_color || defaultBorderColor,
|
||||
"#" + defaultBorderColor,
|
||||
);
|
||||
|
||||
if (
|
||||
typeof titleColor !== "string" ||
|
||||
typeof textColor !== "string" ||
|
||||
typeof ringColor !== "string" ||
|
||||
typeof iconColor !== "string" ||
|
||||
typeof borderColor !== "string"
|
||||
) {
|
||||
throw new Error(
|
||||
"Unexpected behavior, all colors except background should be string.",
|
||||
);
|
||||
}
|
||||
|
||||
return { titleColor, iconColor, textColor, bgColor, borderColor, ringColor };
|
||||
};
|
||||
|
||||
// Script parameters.
|
||||
const ERROR_CARD_LENGTH = 576.5;
|
||||
|
||||
/**
|
||||
* Encode string as HTML.
|
||||
*
|
||||
* @see https://stackoverflow.com/a/48073476/10629172
|
||||
*
|
||||
* @param {string} str String to encode.
|
||||
* @returns {string} Encoded string.
|
||||
*/
|
||||
const encodeHTML = (str) => {
|
||||
return str
|
||||
.replace(/[\u00A0-\u9999<>&](?!#)/gim, (i) => {
|
||||
return "&#" + i.charCodeAt(0) + ";";
|
||||
})
|
||||
.replace(/\u0008/gim, "");
|
||||
};
|
||||
|
||||
const UPSTREAM_API_ERRORS = [
|
||||
TRY_AGAIN_LATER,
|
||||
SECONDARY_ERROR_MESSAGES.MAX_RETRY,
|
||||
];
|
||||
|
||||
/**
|
||||
* Renders error message on the card.
|
||||
*
|
||||
* @param {string} message Main error message.
|
||||
* @param {string} secondaryMessage The secondary error message.
|
||||
* @param {object} options Function options.
|
||||
* @returns {string} The SVG markup.
|
||||
*/
|
||||
const renderError = (message, secondaryMessage = "", options = {}) => {
|
||||
const {
|
||||
title_color,
|
||||
text_color,
|
||||
bg_color,
|
||||
border_color,
|
||||
theme = "default",
|
||||
} = options;
|
||||
|
||||
// returns theme based colors with proper overrides and defaults
|
||||
const { titleColor, textColor, bgColor, borderColor } = getCardColors({
|
||||
title_color,
|
||||
text_color,
|
||||
icon_color: "",
|
||||
bg_color,
|
||||
border_color,
|
||||
ring_color: "",
|
||||
theme,
|
||||
});
|
||||
|
||||
return `
|
||||
<svg width="${ERROR_CARD_LENGTH}" height="120" viewBox="0 0 ${ERROR_CARD_LENGTH} 120" fill="${bgColor}" xmlns="http://www.w3.org/2000/svg">
|
||||
<style>
|
||||
.text { font: 600 16px 'Segoe UI', Ubuntu, Sans-Serif; fill: ${titleColor} }
|
||||
.small { font: 600 12px 'Segoe UI', Ubuntu, Sans-Serif; fill: ${textColor} }
|
||||
.gray { fill: #858585 }
|
||||
</style>
|
||||
<rect x="0.5" y="0.5" width="${
|
||||
ERROR_CARD_LENGTH - 1
|
||||
}" height="99%" rx="4.5" fill="${bgColor}" stroke="${borderColor}"/>
|
||||
<text x="25" y="45" class="text">Something went wrong!${
|
||||
UPSTREAM_API_ERRORS.includes(secondaryMessage)
|
||||
? ""
|
||||
: " file an issue at https://tiny.one/readme-stats"
|
||||
}</text>
|
||||
<text data-testid="message" x="25" y="55" class="text small">
|
||||
<tspan x="25" dy="18">${encodeHTML(message)}</tspan>
|
||||
<tspan x="25" dy="18" class="gray">${secondaryMessage}</tspan>
|
||||
</text>
|
||||
</svg>
|
||||
`;
|
||||
};
|
||||
|
||||
/**
|
||||
* Split text over multiple lines based on the card width.
|
||||
*
|
||||
* @param {string} text Text to split.
|
||||
* @param {number} width Line width in number of characters.
|
||||
* @param {number} maxLines Maximum number of lines.
|
||||
* @returns {string[]} Array of lines.
|
||||
*/
|
||||
const wrapTextMultiline = (text, width = 59, maxLines = 3) => {
|
||||
const fullWidthComma = ",";
|
||||
const encoded = encodeHTML(text);
|
||||
const isChinese = encoded.includes(fullWidthComma);
|
||||
|
||||
let wrapped = [];
|
||||
|
||||
if (isChinese) {
|
||||
wrapped = encoded.split(fullWidthComma); // Chinese full punctuation
|
||||
} else {
|
||||
wrapped = wrap(encoded, {
|
||||
width,
|
||||
}).split("\n"); // Split wrapped lines to get an array of lines
|
||||
}
|
||||
|
||||
const lines = wrapped.map((line) => line.trim()).slice(0, maxLines); // Only consider maxLines lines
|
||||
|
||||
// Add "..." to the last line if the text exceeds maxLines
|
||||
if (wrapped.length > maxLines) {
|
||||
lines[maxLines - 1] += "...";
|
||||
}
|
||||
|
||||
// Remove empty lines if text fits in less than maxLines lines
|
||||
const multiLineText = lines.filter(Boolean);
|
||||
return multiLineText;
|
||||
};
|
||||
|
||||
const noop = () => {};
|
||||
// return console instance based on the environment
|
||||
const logger =
|
||||
process.env.NODE_ENV === "test" ? { log: noop, error: noop } : console;
|
||||
|
||||
const ONE_MINUTE = 60;
|
||||
const FIVE_MINUTES = 300;
|
||||
const TEN_MINUTES = 600;
|
||||
const FIFTEEN_MINUTES = 900;
|
||||
const THIRTY_MINUTES = 1800;
|
||||
const TWO_HOURS = 7200;
|
||||
const FOUR_HOURS = 14400;
|
||||
const SIX_HOURS = 21600;
|
||||
const EIGHT_HOURS = 28800;
|
||||
const ONE_DAY = 86400;
|
||||
|
||||
const CONSTANTS = {
|
||||
ONE_MINUTE,
|
||||
FIVE_MINUTES,
|
||||
TEN_MINUTES,
|
||||
FIFTEEN_MINUTES,
|
||||
THIRTY_MINUTES,
|
||||
TWO_HOURS,
|
||||
FOUR_HOURS,
|
||||
SIX_HOURS,
|
||||
EIGHT_HOURS,
|
||||
ONE_DAY,
|
||||
CARD_CACHE_SECONDS: SIX_HOURS,
|
||||
ERROR_CACHE_SECONDS: TEN_MINUTES,
|
||||
};
|
||||
|
||||
/**
|
||||
* Missing query parameter class.
|
||||
*/
|
||||
class MissingParamError extends Error {
|
||||
/**
|
||||
* Missing query parameter error constructor.
|
||||
*
|
||||
* @param {string[]} missedParams An array of missing parameters names.
|
||||
* @param {string=} secondaryMessage Optional secondary message to display.
|
||||
*/
|
||||
constructor(missedParams, secondaryMessage) {
|
||||
const msg = `Missing params ${missedParams
|
||||
.map((p) => `"${p}"`)
|
||||
.join(", ")} make sure you pass the parameters in URL`;
|
||||
super(msg);
|
||||
this.missedParams = missedParams;
|
||||
this.secondaryMessage = secondaryMessage;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve text length.
|
||||
*
|
||||
* @see https://stackoverflow.com/a/48172630/10629172
|
||||
* @param {string} str String to measure.
|
||||
* @param {number} fontSize Font size.
|
||||
* @returns {number} Text length.
|
||||
*/
|
||||
const measureText = (str, fontSize = 10) => {
|
||||
// prettier-ignore
|
||||
const widths = [
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0.2796875, 0.2765625,
|
||||
0.3546875, 0.5546875, 0.5546875, 0.8890625, 0.665625, 0.190625,
|
||||
0.3328125, 0.3328125, 0.3890625, 0.5828125, 0.2765625, 0.3328125,
|
||||
0.2765625, 0.3015625, 0.5546875, 0.5546875, 0.5546875, 0.5546875,
|
||||
0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875, 0.5546875,
|
||||
0.2765625, 0.2765625, 0.584375, 0.5828125, 0.584375, 0.5546875,
|
||||
1.0140625, 0.665625, 0.665625, 0.721875, 0.721875, 0.665625,
|
||||
0.609375, 0.7765625, 0.721875, 0.2765625, 0.5, 0.665625,
|
||||
0.5546875, 0.8328125, 0.721875, 0.7765625, 0.665625, 0.7765625,
|
||||
0.721875, 0.665625, 0.609375, 0.721875, 0.665625, 0.94375,
|
||||
0.665625, 0.665625, 0.609375, 0.2765625, 0.3546875, 0.2765625,
|
||||
0.4765625, 0.5546875, 0.3328125, 0.5546875, 0.5546875, 0.5,
|
||||
0.5546875, 0.5546875, 0.2765625, 0.5546875, 0.5546875, 0.221875,
|
||||
0.240625, 0.5, 0.221875, 0.8328125, 0.5546875, 0.5546875,
|
||||
0.5546875, 0.5546875, 0.3328125, 0.5, 0.2765625, 0.5546875,
|
||||
0.5, 0.721875, 0.5, 0.5, 0.5, 0.3546875, 0.259375, 0.353125, 0.5890625,
|
||||
];
|
||||
|
||||
const avg = 0.5279276315789471;
|
||||
return (
|
||||
str
|
||||
.split("")
|
||||
.map((c) =>
|
||||
c.charCodeAt(0) < widths.length ? widths[c.charCodeAt(0)] : avg,
|
||||
)
|
||||
.reduce((cur, acc) => acc + cur) * fontSize
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Lowercase and trim string.
|
||||
*
|
||||
* @param {string} name String to lowercase and trim.
|
||||
* @returns {string} Lowercased and trimmed string.
|
||||
*/
|
||||
const lowercaseTrim = (name) => name.toLowerCase().trim();
|
||||
|
||||
/**
|
||||
* Split array of languages in two columns.
|
||||
*
|
||||
* @template T Language object.
|
||||
* @param {Array<T>} arr Array of languages.
|
||||
* @param {number} perChunk Number of languages per column.
|
||||
* @returns {Array<T>} Array of languages split in two columns.
|
||||
*/
|
||||
const chunkArray = (arr, perChunk) => {
|
||||
return arr.reduce((resultArray, item, index) => {
|
||||
const chunkIndex = Math.floor(index / perChunk);
|
||||
|
||||
if (!resultArray[chunkIndex]) {
|
||||
// @ts-ignore
|
||||
resultArray[chunkIndex] = []; // start a new chunk
|
||||
}
|
||||
|
||||
// @ts-ignore
|
||||
resultArray[chunkIndex].push(item);
|
||||
|
||||
return resultArray;
|
||||
}, []);
|
||||
};
|
||||
|
||||
/**
|
||||
* Parse emoji from string.
|
||||
*
|
||||
* @param {string} str String to parse emoji from.
|
||||
* @returns {string} String with emoji parsed.
|
||||
*/
|
||||
const parseEmojis = (str) => {
|
||||
if (!str) {
|
||||
throw new Error("[parseEmoji]: str argument not provided");
|
||||
}
|
||||
return str.replace(/:\w+:/gm, (emoji) => {
|
||||
return toEmoji.get(emoji) || "";
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Get diff in minutes between two dates.
|
||||
*
|
||||
* @param {Date} d1 First date.
|
||||
* @param {Date} d2 Second date.
|
||||
* @returns {number} Number of minutes between the two dates.
|
||||
*/
|
||||
const dateDiff = (d1, d2) => {
|
||||
const date1 = new Date(d1);
|
||||
const date2 = new Date(d2);
|
||||
const diff = date1.getTime() - date2.getTime();
|
||||
return Math.round(diff / (1000 * 60));
|
||||
};
|
||||
|
||||
export {
|
||||
ERROR_CARD_LENGTH,
|
||||
renderError,
|
||||
createLanguageNode,
|
||||
iconWithLabel,
|
||||
encodeHTML,
|
||||
kFormatter,
|
||||
isValidHexColor,
|
||||
parseBoolean,
|
||||
parseArray,
|
||||
clampValue,
|
||||
isValidGradient,
|
||||
fallbackColor,
|
||||
request,
|
||||
flexLayout,
|
||||
getCardColors,
|
||||
wrapTextMultiline,
|
||||
logger,
|
||||
CONSTANTS,
|
||||
CustomError,
|
||||
MissingParamError,
|
||||
measureText,
|
||||
lowercaseTrim,
|
||||
chunkArray,
|
||||
parseEmojis,
|
||||
dateDiff,
|
||||
};
|
||||
@@ -1,12 +1,8 @@
|
||||
// @ts-check
|
||||
|
||||
import { request, MissingParamError } from "../common/utils.js";
|
||||
import { retryer } from "../common/retryer.js";
|
||||
|
||||
/**
|
||||
* @typedef {import('axios').AxiosRequestHeaders} AxiosRequestHeaders Axios request headers.
|
||||
* @typedef {import('axios').AxiosResponse} AxiosResponse Axios response.
|
||||
*/
|
||||
import { MissingParamError } from "../common/error.js";
|
||||
import { request } from "../common/http.js";
|
||||
|
||||
const QUERY = `
|
||||
query gistInfo($gistName: String!) {
|
||||
@@ -35,9 +31,9 @@ query gistInfo($gistName: String!) {
|
||||
/**
|
||||
* Gist data fetcher.
|
||||
*
|
||||
* @param {AxiosRequestHeaders} variables Fetcher variables.
|
||||
* @param {object} variables Fetcher variables.
|
||||
* @param {string} token GitHub token.
|
||||
* @returns {Promise<AxiosResponse>} The response.
|
||||
* @returns {Promise<import('axios').AxiosResponse>} The response.
|
||||
*/
|
||||
const fetcher = async (variables, token) => {
|
||||
return await request(
|
||||
@@ -57,7 +53,9 @@ const fetcher = async (variables, token) => {
|
||||
* @returns {string} Primary language.
|
||||
*/
|
||||
const calculatePrimaryLanguage = (files) => {
|
||||
/** @type {Record<string, number>} */
|
||||
const languages = {};
|
||||
|
||||
for (const file of files) {
|
||||
if (file.language) {
|
||||
if (languages[file.language.name]) {
|
||||
@@ -67,12 +65,14 @@ const calculatePrimaryLanguage = (files) => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let primaryLanguage = Object.keys(languages)[0];
|
||||
for (const language in languages) {
|
||||
if (languages[language] > languages[primaryLanguage]) {
|
||||
primaryLanguage = language;
|
||||
}
|
||||
}
|
||||
|
||||
return primaryLanguage;
|
||||
};
|
||||
|
||||
@@ -83,7 +83,7 @@ const calculatePrimaryLanguage = (files) => {
|
||||
/**
|
||||
* Fetch GitHub gist information by given username and ID.
|
||||
*
|
||||
* @param {string} id Github gist ID.
|
||||
* @param {string} id GitHub gist ID.
|
||||
* @returns {Promise<GistData>} Gist data.
|
||||
*/
|
||||
const fetchGist = async (id) => {
|
||||
@@ -1,18 +1,15 @@
|
||||
// @ts-check
|
||||
import { retryer } from "../common/retryer.js";
|
||||
import { MissingParamError, request } from "../common/utils.js";
|
||||
|
||||
/**
|
||||
* @typedef {import('axios').AxiosRequestHeaders} AxiosRequestHeaders Axios request headers.
|
||||
* @typedef {import('axios').AxiosResponse} AxiosResponse Axios response.
|
||||
*/
|
||||
import { MissingParamError } from "../common/error.js";
|
||||
import { request } from "../common/http.js";
|
||||
import { retryer } from "../common/retryer.js";
|
||||
|
||||
/**
|
||||
* Repo data fetcher.
|
||||
*
|
||||
* @param {AxiosRequestHeaders} variables Fetcher variables.
|
||||
* @param {object} variables Fetcher variables.
|
||||
* @param {string} token GitHub token.
|
||||
* @returns {Promise<AxiosResponse>} The response.
|
||||
* @returns {Promise<import('axios').AxiosResponse>} The response.
|
||||
*/
|
||||
const fetcher = (variables, token) => {
|
||||
return request(
|
||||
@@ -1,16 +1,15 @@
|
||||
// @ts-check
|
||||
|
||||
import axios from "axios";
|
||||
import * as dotenv from "dotenv";
|
||||
import githubUsernameRegex from "github-username-regex";
|
||||
import { calculateRank } from "../calculateRank.js";
|
||||
import { retryer } from "../common/retryer.js";
|
||||
import {
|
||||
CustomError,
|
||||
logger,
|
||||
MissingParamError,
|
||||
request,
|
||||
wrapTextMultiline,
|
||||
} from "../common/utils.js";
|
||||
import { logger } from "../common/log.js";
|
||||
import { excludeRepositories } from "../common/envs.js";
|
||||
import { CustomError, MissingParamError } from "../common/error.js";
|
||||
import { wrapTextMultiline } from "../common/fmt.js";
|
||||
import { request } from "../common/http.js";
|
||||
|
||||
dotenv.config();
|
||||
|
||||
@@ -40,12 +39,14 @@ const GRAPHQL_REPOS_QUERY = `
|
||||
`;
|
||||
|
||||
const GRAPHQL_STATS_QUERY = `
|
||||
query userInfo($login: String!, $after: String, $includeMergedPullRequests: Boolean!, $includeDiscussions: Boolean!, $includeDiscussionsAnswers: Boolean!) {
|
||||
query userInfo($login: String!, $after: String, $includeMergedPullRequests: Boolean!, $includeDiscussions: Boolean!, $includeDiscussionsAnswers: Boolean!, $startTime: DateTime = null) {
|
||||
user(login: $login) {
|
||||
name
|
||||
login
|
||||
contributionsCollection {
|
||||
commits: contributionsCollection (from: $startTime) {
|
||||
totalCommitContributions,
|
||||
}
|
||||
reviews: contributionsCollection {
|
||||
totalPullRequestReviewContributions
|
||||
}
|
||||
repositoriesContributedTo(first: 1, contributionTypes: [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]) {
|
||||
@@ -77,16 +78,12 @@ const GRAPHQL_STATS_QUERY = `
|
||||
}
|
||||
`;
|
||||
|
||||
/**
|
||||
* @typedef {import('axios').AxiosResponse} AxiosResponse Axios response.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Stats fetcher object.
|
||||
*
|
||||
* @param {object} variables Fetcher variables.
|
||||
* @param {object & { after: string | null }} variables Fetcher variables.
|
||||
* @param {string} token GitHub token.
|
||||
* @returns {Promise<AxiosResponse>} Axios response.
|
||||
* @returns {Promise<import('axios').AxiosResponse>} Axios response.
|
||||
*/
|
||||
const fetcher = (variables, token) => {
|
||||
const query = variables.after ? GRAPHQL_REPOS_QUERY : GRAPHQL_STATS_QUERY;
|
||||
@@ -105,11 +102,12 @@ const fetcher = (variables, token) => {
|
||||
* Fetch stats information for a given username.
|
||||
*
|
||||
* @param {object} variables Fetcher variables.
|
||||
* @param {string} variables.username Github username.
|
||||
* @param {string} variables.username GitHub username.
|
||||
* @param {boolean} variables.includeMergedPullRequests Include merged pull requests.
|
||||
* @param {boolean} variables.includeDiscussions Include discussions.
|
||||
* @param {boolean} variables.includeDiscussionsAnswers Include discussions answers.
|
||||
* @returns {Promise<AxiosResponse>} Axios response.
|
||||
* @param {string|undefined} variables.startTime Time to start the count of total commits.
|
||||
* @returns {Promise<import('axios').AxiosResponse>} Axios response.
|
||||
*
|
||||
* @description This function supports multi-page fetching if the 'FETCH_MULTI_PAGE_STARS' environment variable is set to true.
|
||||
*/
|
||||
@@ -118,6 +116,7 @@ const statsFetcher = async ({
|
||||
includeMergedPullRequests,
|
||||
includeDiscussions,
|
||||
includeDiscussionsAnswers,
|
||||
startTime,
|
||||
}) => {
|
||||
let stats;
|
||||
let hasNextPage = true;
|
||||
@@ -130,6 +129,7 @@ const statsFetcher = async ({
|
||||
includeMergedPullRequests,
|
||||
includeDiscussions,
|
||||
includeDiscussionsAnswers,
|
||||
startTime,
|
||||
};
|
||||
let res = await retryer(fetcher, variables);
|
||||
if (res.data.errors) {
|
||||
@@ -158,6 +158,27 @@ const statsFetcher = async ({
|
||||
return stats;
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetch total commits using the REST API.
|
||||
*
|
||||
* @param {object} variables Fetcher variables.
|
||||
* @param {string} token GitHub token.
|
||||
* @returns {Promise<import('axios').AxiosResponse>} Axios response.
|
||||
*
|
||||
* @see https://developer.github.com/v3/search/#search-commits
|
||||
*/
|
||||
const fetchTotalCommits = (variables, token) => {
|
||||
return axios({
|
||||
method: "get",
|
||||
url: `https://api.github.com/search/commits?q=author:${variables.login}`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/vnd.github.cloak-preview",
|
||||
Authorization: `token ${token}`,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetch all the commits for all the repositories of a given username.
|
||||
*
|
||||
@@ -173,19 +194,6 @@ const totalCommitsFetcher = async (username) => {
|
||||
throw new Error("Invalid username provided.");
|
||||
}
|
||||
|
||||
// https://developer.github.com/v3/search/#search-commits
|
||||
const fetchTotalCommits = (variables, token) => {
|
||||
return axios({
|
||||
method: "get",
|
||||
url: `https://api.github.com/search/commits?q=author:${variables.login}`,
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
Accept: "application/vnd.github.cloak-preview",
|
||||
Authorization: `token ${token}`,
|
||||
},
|
||||
});
|
||||
};
|
||||
|
||||
let res;
|
||||
try {
|
||||
res = await retryer(fetchTotalCommits, { login: username });
|
||||
@@ -204,10 +212,6 @@ const totalCommitsFetcher = async (username) => {
|
||||
return totalCount;
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {import("./types").StatsData} StatsData Stats data.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fetch stats for a given username.
|
||||
*
|
||||
@@ -217,7 +221,8 @@ const totalCommitsFetcher = async (username) => {
|
||||
* @param {boolean} include_merged_pull_requests Include merged pull requests.
|
||||
* @param {boolean} include_discussions Include discussions.
|
||||
* @param {boolean} include_discussions_answers Include discussions answers.
|
||||
* @returns {Promise<StatsData>} Stats data.
|
||||
* @param {number|undefined} commits_year Year to count total commits
|
||||
* @returns {Promise<import("./types").StatsData>} Stats data.
|
||||
*/
|
||||
const fetchStats = async (
|
||||
username,
|
||||
@@ -226,6 +231,7 @@ const fetchStats = async (
|
||||
include_merged_pull_requests = false,
|
||||
include_discussions = false,
|
||||
include_discussions_answers = false,
|
||||
commits_year,
|
||||
) => {
|
||||
if (!username) {
|
||||
throw new MissingParamError(["username"]);
|
||||
@@ -251,6 +257,7 @@ const fetchStats = async (
|
||||
includeMergedPullRequests: include_merged_pull_requests,
|
||||
includeDiscussions: include_discussions,
|
||||
includeDiscussionsAnswers: include_discussions_answers,
|
||||
startTime: commits_year ? `${commits_year}-01-01T00:00:00Z` : undefined,
|
||||
});
|
||||
|
||||
// Catch GraphQL errors.
|
||||
@@ -282,17 +289,17 @@ const fetchStats = async (
|
||||
if (include_all_commits) {
|
||||
stats.totalCommits = await totalCommitsFetcher(username);
|
||||
} else {
|
||||
stats.totalCommits = user.contributionsCollection.totalCommitContributions;
|
||||
stats.totalCommits = user.commits.totalCommitContributions;
|
||||
}
|
||||
|
||||
stats.totalPRs = user.pullRequests.totalCount;
|
||||
if (include_merged_pull_requests) {
|
||||
stats.totalPRsMerged = user.mergedPullRequests.totalCount;
|
||||
stats.mergedPRsPercentage =
|
||||
(user.mergedPullRequests.totalCount / user.pullRequests.totalCount) * 100;
|
||||
(user.mergedPullRequests.totalCount / user.pullRequests.totalCount) *
|
||||
100 || 0;
|
||||
}
|
||||
stats.totalReviews =
|
||||
user.contributionsCollection.totalPullRequestReviewContributions;
|
||||
stats.totalReviews = user.reviews.totalPullRequestReviewContributions;
|
||||
stats.totalIssues = user.openIssues.totalCount + user.closedIssues.totalCount;
|
||||
if (include_discussions) {
|
||||
stats.totalDiscussionsStarted = user.repositoryDiscussions.totalCount;
|
||||
@@ -304,7 +311,8 @@ const fetchStats = async (
|
||||
stats.contributedTo = user.repositoriesContributedTo.totalCount;
|
||||
|
||||
// Retrieve stars while filtering out repositories to be hidden.
|
||||
let repoToHide = new Set(exclude_repo);
|
||||
const allExcludedRepos = [...exclude_repo, ...excludeRepositories];
|
||||
let repoToHide = new Set(allExcludedRepos);
|
||||
|
||||
stats.totalStars = user.repositories.nodes
|
||||
.filter((data) => {
|
||||
@@ -1,24 +1,18 @@
|
||||
// @ts-check
|
||||
import { retryer } from "../common/retryer.js";
|
||||
import {
|
||||
CustomError,
|
||||
logger,
|
||||
MissingParamError,
|
||||
request,
|
||||
wrapTextMultiline,
|
||||
} from "../common/utils.js";
|
||||
|
||||
/**
|
||||
* @typedef {import("axios").AxiosRequestHeaders} AxiosRequestHeaders Axios request headers.
|
||||
* @typedef {import("axios").AxiosResponse} AxiosResponse Axios response.
|
||||
*/
|
||||
import { retryer } from "../common/retryer.js";
|
||||
import { logger } from "../common/log.js";
|
||||
import { excludeRepositories } from "../common/envs.js";
|
||||
import { CustomError, MissingParamError } from "../common/error.js";
|
||||
import { wrapTextMultiline } from "../common/fmt.js";
|
||||
import { request } from "../common/http.js";
|
||||
|
||||
/**
|
||||
* Top languages fetcher object.
|
||||
*
|
||||
* @param {AxiosRequestHeaders} variables Fetcher variables.
|
||||
* @param {any} variables Fetcher variables.
|
||||
* @param {string} token GitHub token.
|
||||
* @returns {Promise<AxiosResponse>} Languages fetcher response.
|
||||
* @returns {Promise<import("axios").AxiosResponse>} Languages fetcher response.
|
||||
*/
|
||||
const fetcher = (variables, token) => {
|
||||
return request(
|
||||
@@ -98,12 +92,14 @@ const fetchTopLanguages = async (
|
||||
}
|
||||
|
||||
let repoNodes = res.data.data.user.repositories.nodes;
|
||||
/** @type {Record<string, boolean>} */
|
||||
let repoToHide = {};
|
||||
const allExcludedRepos = [...exclude_repo, ...excludeRepositories];
|
||||
|
||||
// populate repoToHide map for quick lookup
|
||||
// while filtering out
|
||||
if (exclude_repo) {
|
||||
exclude_repo.forEach((repoName) => {
|
||||
if (allExcludedRepos) {
|
||||
allExcludedRepos.forEach((repoName) => {
|
||||
repoToHide[repoName] = true;
|
||||
});
|
||||
}
|
||||
@@ -1,11 +1,13 @@
|
||||
// @ts-check
|
||||
|
||||
import axios from "axios";
|
||||
import { CustomError, MissingParamError } from "../common/utils.js";
|
||||
import { CustomError, MissingParamError } from "../common/error.js";
|
||||
|
||||
/**
|
||||
* WakaTime data fetcher.
|
||||
*
|
||||
* @param {{username: string, api_domain: string }} props Fetcher props.
|
||||
* @returns {Promise<WakaTimeData>} WakaTime data response.
|
||||
* @returns {Promise<import("./types").WakaTimeData>} WakaTime data response.
|
||||
*/
|
||||
const fetchWakatimeStats = async ({ username, api_domain }) => {
|
||||
if (!username) {
|
||||
+487
-113
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,162 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
|
||||
|
||||
exports[`Test Render WakaTime Card should render correctly 1`] = `[Function]`;
|
||||
exports[`Test Render WakaTime Card should render correctly 1`] = `
|
||||
"
|
||||
<svg
|
||||
width="495"
|
||||
height="150"
|
||||
viewBox="0 0 495 150"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
role="img"
|
||||
aria-labelledby="descId"
|
||||
>
|
||||
<title id="titleId"></title>
|
||||
<desc id="descId"></desc>
|
||||
<style>
|
||||
.header {
|
||||
font: 600 18px 'Segoe UI', Ubuntu, Sans-Serif;
|
||||
fill: #2f80ed;
|
||||
animation: fadeInAnimation 0.8s ease-in-out forwards;
|
||||
}
|
||||
@supports(-moz-appearance: auto) {
|
||||
/* Selector detects Firefox */
|
||||
.header { font-size: 15.5px; }
|
||||
}
|
||||
|
||||
|
||||
.stat {
|
||||
font: 600 14px 'Segoe UI', Ubuntu, "Helvetica Neue", Sans-Serif; fill: #434d58;
|
||||
}
|
||||
@supports(-moz-appearance: auto) {
|
||||
/* Selector detects Firefox */
|
||||
.stat { font-size:12px; }
|
||||
}
|
||||
.stagger {
|
||||
opacity: 0;
|
||||
animation: fadeInAnimation 0.3s ease-in-out forwards;
|
||||
}
|
||||
.not_bold { font-weight: 400 }
|
||||
.bold { font-weight: 700 }
|
||||
|
||||
@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 }
|
||||
#rect-mask rect{
|
||||
animation: slideInAnimation 1s ease-in-out forwards;
|
||||
}
|
||||
.lang-progress{
|
||||
animation: growWidthAnimation 0.6s ease-in-out forwards;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<rect
|
||||
data-testid="card-bg"
|
||||
x="0.5"
|
||||
y="0.5"
|
||||
rx="4.5"
|
||||
height="99%"
|
||||
stroke="#e4e2e2"
|
||||
width="494"
|
||||
fill="#fffefe"
|
||||
stroke-opacity="1"
|
||||
/>
|
||||
|
||||
|
||||
<g
|
||||
data-testid="card-title"
|
||||
transform="translate(25, 35)"
|
||||
>
|
||||
<g transform="translate(0, 0)">
|
||||
<text
|
||||
x="0"
|
||||
y="0"
|
||||
class="header"
|
||||
data-testid="header"
|
||||
>WakaTime Stats (last 7 days)</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
||||
<g
|
||||
data-testid="main-card-body"
|
||||
transform="translate(0, 55)"
|
||||
>
|
||||
|
||||
<svg x="0" y="0" width="100%">
|
||||
<g transform="translate(0, 0)">
|
||||
<g class="stagger" style="animation-delay: 450ms" transform="translate(25, 0)">
|
||||
<text class="stat bold" y="12.5" data-testid="Other">Other:</text>
|
||||
<text
|
||||
class="stat"
|
||||
x="350"
|
||||
y="12.5"
|
||||
>19 mins</text>
|
||||
|
||||
<svg width="220" x="110" y="4">
|
||||
<rect rx="5" ry="5" x="0" y="0" width="220" height="8" fill="#434d58"></rect>
|
||||
<svg data-testid="lang-progress" width="89.38%">
|
||||
<rect
|
||||
height="8"
|
||||
fill="#2f80ed"
|
||||
rx="5" ry="5" x="0" y="0"
|
||||
class="lang-progress"
|
||||
style="animation-delay: 750ms;"
|
||||
/>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
</g>
|
||||
</g><g transform="translate(0, 25)">
|
||||
<g class="stagger" style="animation-delay: 600ms" transform="translate(25, 0)">
|
||||
<text class="stat bold" y="12.5" data-testid="TypeScript">TypeScript:</text>
|
||||
<text
|
||||
class="stat"
|
||||
x="350"
|
||||
y="12.5"
|
||||
>1 min</text>
|
||||
|
||||
<svg width="220" x="110" y="4">
|
||||
<rect rx="5" ry="5" x="0" y="0" width="220" height="8" fill="#434d58"></rect>
|
||||
<svg data-testid="lang-progress" width="6.25%">
|
||||
<rect
|
||||
height="8"
|
||||
fill="#2f80ed"
|
||||
rx="5" ry="5" x="0" y="0"
|
||||
class="lang-progress"
|
||||
style="animation-delay: 900ms;"
|
||||
/>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
</g>
|
||||
</svg>
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`Test Render WakaTime Card should render correctly with compact layout 1`] = `
|
||||
"
|
||||
@@ -305,3 +461,161 @@ exports[`Test Render WakaTime Card should render correctly with compact layout w
|
||||
</svg>
|
||||
"
|
||||
`;
|
||||
|
||||
exports[`Test Render WakaTime Card should render correctly with percent display format 1`] = `
|
||||
"
|
||||
<svg
|
||||
width="495"
|
||||
height="150"
|
||||
viewBox="0 0 495 150"
|
||||
fill="none"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
role="img"
|
||||
aria-labelledby="descId"
|
||||
>
|
||||
<title id="titleId"></title>
|
||||
<desc id="descId"></desc>
|
||||
<style>
|
||||
.header {
|
||||
font: 600 18px 'Segoe UI', Ubuntu, Sans-Serif;
|
||||
fill: #2f80ed;
|
||||
animation: fadeInAnimation 0.8s ease-in-out forwards;
|
||||
}
|
||||
@supports(-moz-appearance: auto) {
|
||||
/* Selector detects Firefox */
|
||||
.header { font-size: 15.5px; }
|
||||
}
|
||||
|
||||
|
||||
.stat {
|
||||
font: 600 14px 'Segoe UI', Ubuntu, "Helvetica Neue", Sans-Serif; fill: #434d58;
|
||||
}
|
||||
@supports(-moz-appearance: auto) {
|
||||
/* Selector detects Firefox */
|
||||
.stat { font-size:12px; }
|
||||
}
|
||||
.stagger {
|
||||
opacity: 0;
|
||||
animation: fadeInAnimation 0.3s ease-in-out forwards;
|
||||
}
|
||||
.not_bold { font-weight: 400 }
|
||||
.bold { font-weight: 700 }
|
||||
|
||||
@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 }
|
||||
#rect-mask rect{
|
||||
animation: slideInAnimation 1s ease-in-out forwards;
|
||||
}
|
||||
.lang-progress{
|
||||
animation: growWidthAnimation 0.6s ease-in-out forwards;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
<rect
|
||||
data-testid="card-bg"
|
||||
x="0.5"
|
||||
y="0.5"
|
||||
rx="4.5"
|
||||
height="99%"
|
||||
stroke="#e4e2e2"
|
||||
width="494"
|
||||
fill="#fffefe"
|
||||
stroke-opacity="1"
|
||||
/>
|
||||
|
||||
|
||||
<g
|
||||
data-testid="card-title"
|
||||
transform="translate(25, 35)"
|
||||
>
|
||||
<g transform="translate(0, 0)">
|
||||
<text
|
||||
x="0"
|
||||
y="0"
|
||||
class="header"
|
||||
data-testid="header"
|
||||
>WakaTime Stats (last 7 days)</text>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
|
||||
<g
|
||||
data-testid="main-card-body"
|
||||
transform="translate(0, 55)"
|
||||
>
|
||||
|
||||
<svg x="0" y="0" width="100%">
|
||||
<g transform="translate(0, 0)">
|
||||
<g class="stagger" style="animation-delay: 450ms" transform="translate(25, 0)">
|
||||
<text class="stat bold" y="12.5" data-testid="Other">Other:</text>
|
||||
<text
|
||||
class="stat"
|
||||
x="350"
|
||||
y="12.5"
|
||||
>47.39 %</text>
|
||||
|
||||
<svg width="220" x="110" y="4">
|
||||
<rect rx="5" ry="5" x="0" y="0" width="220" height="8" fill="#434d58"></rect>
|
||||
<svg data-testid="lang-progress" width="47.39%">
|
||||
<rect
|
||||
height="8"
|
||||
fill="#2f80ed"
|
||||
rx="5" ry="5" x="0" y="0"
|
||||
class="lang-progress"
|
||||
style="animation-delay: 750ms;"
|
||||
/>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
</g>
|
||||
</g><g transform="translate(0, 25)">
|
||||
<g class="stagger" style="animation-delay: 600ms" transform="translate(25, 0)">
|
||||
<text class="stat bold" y="12.5" data-testid="TypeScript">TypeScript:</text>
|
||||
<text
|
||||
class="stat"
|
||||
x="350"
|
||||
y="12.5"
|
||||
>50.48 %</text>
|
||||
|
||||
<svg width="220" x="110" y="4">
|
||||
<rect rx="5" ry="5" x="0" y="0" width="220" height="8" fill="#434d58"></rect>
|
||||
<svg data-testid="lang-progress" width="50.48%">
|
||||
<rect
|
||||
height="8"
|
||||
fill="#2f80ed"
|
||||
rx="5" ry="5" x="0" y="0"
|
||||
class="lang-progress"
|
||||
style="animation-delay: 900ms;"
|
||||
/>
|
||||
</svg>
|
||||
</svg>
|
||||
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
||||
</g>
|
||||
</svg>
|
||||
"
|
||||
`;
|
||||
|
||||
+123
-57
@@ -1,12 +1,24 @@
|
||||
import { jest } from "@jest/globals";
|
||||
// @ts-check
|
||||
|
||||
import {
|
||||
afterEach,
|
||||
beforeEach,
|
||||
describe,
|
||||
expect,
|
||||
it,
|
||||
jest,
|
||||
} from "@jest/globals";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import api from "../api/index.js";
|
||||
import { calculateRank } from "../src/calculateRank.js";
|
||||
import { renderStatsCard } from "../src/cards/stats-card.js";
|
||||
import { CONSTANTS, renderError } from "../src/common/utils.js";
|
||||
import { expect, it, describe, afterEach } from "@jest/globals";
|
||||
import { renderStatsCard } from "../src/cards/stats.js";
|
||||
import { renderError } from "../src/common/render.js";
|
||||
import { CACHE_TTL, DURATIONS } from "../src/common/cache.js";
|
||||
|
||||
/**
|
||||
* @type {import("../src/fetchers/stats").StatsData}
|
||||
*/
|
||||
const stats = {
|
||||
name: "Anurag Hazra",
|
||||
totalStars: 100,
|
||||
@@ -19,7 +31,7 @@ const stats = {
|
||||
totalDiscussionsStarted: 10,
|
||||
totalDiscussionsAnswered: 40,
|
||||
contributedTo: 50,
|
||||
rank: null,
|
||||
rank: { level: "DEV", percentile: 0 },
|
||||
};
|
||||
|
||||
stats.rank = calculateRank({
|
||||
@@ -38,8 +50,10 @@ const data_stats = {
|
||||
user: {
|
||||
name: stats.name,
|
||||
repositoriesContributedTo: { totalCount: stats.contributedTo },
|
||||
contributionsCollection: {
|
||||
commits: {
|
||||
totalCommitContributions: stats.totalCommits,
|
||||
},
|
||||
reviews: {
|
||||
totalPullRequestReviewContributions: stats.totalReviews,
|
||||
},
|
||||
pullRequests: { totalCount: stats.totalPRs },
|
||||
@@ -76,6 +90,7 @@ const error = {
|
||||
|
||||
const mock = new MockAdapter(axios);
|
||||
|
||||
// @ts-ignore
|
||||
const faker = (query, data) => {
|
||||
const req = {
|
||||
query: {
|
||||
@@ -92,6 +107,10 @@ const faker = (query, data) => {
|
||||
return { req, res };
|
||||
};
|
||||
|
||||
beforeEach(() => {
|
||||
process.env.CACHE_SECONDS = undefined;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
mock.reset();
|
||||
});
|
||||
@@ -102,8 +121,10 @@ describe("Test /api/", () => {
|
||||
|
||||
await api(req, res);
|
||||
|
||||
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toBeCalledWith(renderStatsCard(stats, { ...req.query }));
|
||||
expect(res.setHeader).toHaveBeenCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toHaveBeenCalledWith(
|
||||
renderStatsCard(stats, { ...req.query }),
|
||||
);
|
||||
});
|
||||
|
||||
it("should render error card on error", async () => {
|
||||
@@ -111,12 +132,13 @@ describe("Test /api/", () => {
|
||||
|
||||
await api(req, res);
|
||||
|
||||
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toBeCalledWith(
|
||||
renderError(
|
||||
error.errors[0].message,
|
||||
"Make sure the provided username is not an organization",
|
||||
),
|
||||
expect(res.setHeader).toHaveBeenCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toHaveBeenCalledWith(
|
||||
renderError({
|
||||
message: error.errors[0].message,
|
||||
secondaryMessage:
|
||||
"Make sure the provided username is not an organization",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -125,13 +147,14 @@ describe("Test /api/", () => {
|
||||
|
||||
await api(req, res);
|
||||
|
||||
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toBeCalledWith(
|
||||
renderError(
|
||||
error.errors[0].message,
|
||||
"Make sure the provided username is not an organization",
|
||||
{ theme: "merko" },
|
||||
),
|
||||
expect(res.setHeader).toHaveBeenCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toHaveBeenCalledWith(
|
||||
renderError({
|
||||
message: error.errors[0].message,
|
||||
secondaryMessage:
|
||||
"Make sure the provided username is not an organization",
|
||||
renderOptions: { theme: "merko" },
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -153,8 +176,8 @@ describe("Test /api/", () => {
|
||||
|
||||
await api(req, res);
|
||||
|
||||
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toBeCalledWith(
|
||||
expect(res.setHeader).toHaveBeenCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toHaveBeenCalledWith(
|
||||
renderStatsCard(stats, {
|
||||
hide: ["issues", "prs", "contribs"],
|
||||
show_icons: true,
|
||||
@@ -177,15 +200,15 @@ describe("Test /api/", () => {
|
||||
["Content-Type", "image/svg+xml"],
|
||||
[
|
||||
"Cache-Control",
|
||||
`max-age=${CONSTANTS.SIX_HOURS / 2}, s-maxage=${
|
||||
CONSTANTS.SIX_HOURS
|
||||
}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
`max-age=${CACHE_TTL.STATS_CARD.DEFAULT}, ` +
|
||||
`s-maxage=${CACHE_TTL.STATS_CARD.DEFAULT}, ` +
|
||||
`stale-while-revalidate=${DURATIONS.ONE_DAY}`,
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
it("should set proper cache", async () => {
|
||||
const cache_seconds = 35000;
|
||||
const cache_seconds = DURATIONS.TWELVE_HOURS;
|
||||
const { req, res } = faker({ cache_seconds }, data_stats);
|
||||
await api(req, res);
|
||||
|
||||
@@ -193,11 +216,9 @@ describe("Test /api/", () => {
|
||||
["Content-Type", "image/svg+xml"],
|
||||
[
|
||||
"Cache-Control",
|
||||
`max-age=${
|
||||
cache_seconds / 2
|
||||
}, s-maxage=${cache_seconds}, stale-while-revalidate=${
|
||||
CONSTANTS.ONE_DAY
|
||||
}`,
|
||||
`max-age=${cache_seconds}, ` +
|
||||
`s-maxage=${cache_seconds}, ` +
|
||||
`stale-while-revalidate=${DURATIONS.ONE_DAY}`,
|
||||
],
|
||||
]);
|
||||
});
|
||||
@@ -210,25 +231,60 @@ describe("Test /api/", () => {
|
||||
["Content-Type", "image/svg+xml"],
|
||||
[
|
||||
"Cache-Control",
|
||||
`max-age=${CONSTANTS.ERROR_CACHE_SECONDS / 2}, s-maxage=${
|
||||
CONSTANTS.ERROR_CACHE_SECONDS
|
||||
}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
`max-age=${CACHE_TTL.ERROR}, ` +
|
||||
`s-maxage=${CACHE_TTL.ERROR}, ` +
|
||||
`stale-while-revalidate=${DURATIONS.ONE_DAY}`,
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
it("should properly set cache using CACHE_SECONDS env variable", async () => {
|
||||
const cacheSeconds = "10000";
|
||||
process.env.CACHE_SECONDS = cacheSeconds;
|
||||
|
||||
const { req, res } = faker({}, data_stats);
|
||||
await api(req, res);
|
||||
|
||||
expect(res.setHeader.mock.calls).toEqual([
|
||||
["Content-Type", "image/svg+xml"],
|
||||
[
|
||||
"Cache-Control",
|
||||
`max-age=${cacheSeconds}, ` +
|
||||
`s-maxage=${cacheSeconds}, ` +
|
||||
`stale-while-revalidate=${DURATIONS.ONE_DAY}`,
|
||||
],
|
||||
]);
|
||||
});
|
||||
|
||||
it("should disable cache when CACHE_SECONDS is set to 0", async () => {
|
||||
process.env.CACHE_SECONDS = "0";
|
||||
|
||||
const { req, res } = faker({}, data_stats);
|
||||
await api(req, res);
|
||||
|
||||
expect(res.setHeader.mock.calls).toEqual([
|
||||
["Content-Type", "image/svg+xml"],
|
||||
[
|
||||
"Cache-Control",
|
||||
"no-cache, no-store, must-revalidate, max-age=0, s-maxage=0",
|
||||
],
|
||||
["Pragma", "no-cache"],
|
||||
["Expires", "0"],
|
||||
]);
|
||||
});
|
||||
|
||||
it("should set proper cache with clamped values", async () => {
|
||||
{
|
||||
let { req, res } = faker({ cache_seconds: 200000 }, data_stats);
|
||||
let { req, res } = faker({ cache_seconds: 200_000 }, data_stats);
|
||||
await api(req, res);
|
||||
|
||||
expect(res.setHeader.mock.calls).toEqual([
|
||||
["Content-Type", "image/svg+xml"],
|
||||
[
|
||||
"Cache-Control",
|
||||
`max-age=${CONSTANTS.ONE_DAY / 2}, s-maxage=${
|
||||
CONSTANTS.ONE_DAY
|
||||
}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
`max-age=${CACHE_TTL.STATS_CARD.MAX}, ` +
|
||||
`s-maxage=${CACHE_TTL.STATS_CARD.MAX}, ` +
|
||||
`stale-while-revalidate=${DURATIONS.ONE_DAY}`,
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -242,24 +298,24 @@ describe("Test /api/", () => {
|
||||
["Content-Type", "image/svg+xml"],
|
||||
[
|
||||
"Cache-Control",
|
||||
`max-age=${CONSTANTS.SIX_HOURS / 2}, s-maxage=${
|
||||
CONSTANTS.SIX_HOURS
|
||||
}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
`max-age=${CACHE_TTL.STATS_CARD.MIN}, ` +
|
||||
`s-maxage=${CACHE_TTL.STATS_CARD.MIN}, ` +
|
||||
`stale-while-revalidate=${DURATIONS.ONE_DAY}`,
|
||||
],
|
||||
]);
|
||||
}
|
||||
|
||||
{
|
||||
let { req, res } = faker({ cache_seconds: -10000 }, data_stats);
|
||||
let { req, res } = faker({ cache_seconds: -10_000 }, data_stats);
|
||||
await api(req, res);
|
||||
|
||||
expect(res.setHeader.mock.calls).toEqual([
|
||||
["Content-Type", "image/svg+xml"],
|
||||
[
|
||||
"Cache-Control",
|
||||
`max-age=${CONSTANTS.SIX_HOURS / 2}, s-maxage=${
|
||||
CONSTANTS.SIX_HOURS
|
||||
}, stale-while-revalidate=${CONSTANTS.ONE_DAY}`,
|
||||
`max-age=${CACHE_TTL.STATS_CARD.MIN}, ` +
|
||||
`s-maxage=${CACHE_TTL.STATS_CARD.MIN}, ` +
|
||||
`stale-while-revalidate=${DURATIONS.ONE_DAY}`,
|
||||
],
|
||||
]);
|
||||
}
|
||||
@@ -284,8 +340,8 @@ describe("Test /api/", () => {
|
||||
|
||||
await api(req, res);
|
||||
|
||||
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toBeCalledWith(
|
||||
expect(res.setHeader).toHaveBeenCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toHaveBeenCalledWith(
|
||||
renderStatsCard(stats, {
|
||||
hide: ["issues", "prs", "contribs"],
|
||||
show_icons: true,
|
||||
@@ -305,9 +361,13 @@ describe("Test /api/", () => {
|
||||
|
||||
await api(req, res);
|
||||
|
||||
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toBeCalledWith(
|
||||
renderError("Something went wrong", "This username is blacklisted"),
|
||||
expect(res.setHeader).toHaveBeenCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toHaveBeenCalledWith(
|
||||
renderError({
|
||||
message: "This username is blacklisted",
|
||||
secondaryMessage: "Please deploy your own instance",
|
||||
renderOptions: { show_repo_link: false },
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -316,9 +376,12 @@ describe("Test /api/", () => {
|
||||
|
||||
await api(req, res);
|
||||
|
||||
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toBeCalledWith(
|
||||
renderError("Something went wrong", "Language not found"),
|
||||
expect(res.setHeader).toHaveBeenCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toHaveBeenCalledWith(
|
||||
renderError({
|
||||
message: "Something went wrong",
|
||||
secondaryMessage: "Language not found",
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
||||
@@ -334,9 +397,12 @@ describe("Test /api/", () => {
|
||||
|
||||
await api(req, res);
|
||||
|
||||
expect(res.setHeader).toBeCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toBeCalledWith(
|
||||
renderError("Could not fetch total commits.", "Please try again later"),
|
||||
expect(res.setHeader).toHaveBeenCalledWith("Content-Type", "image/svg+xml");
|
||||
expect(res.send).toHaveBeenCalledWith(
|
||||
renderError({
|
||||
message: "Could not fetch total commits.",
|
||||
secondaryMessage: "Please try again later",
|
||||
}),
|
||||
);
|
||||
// Received SVG output should not contain string "https://tiny.one/readme-stats"
|
||||
expect(res.send.mock.calls[0][0]).not.toContain(
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { benchmarkSuite } from "jest-bench";
|
||||
import api from "../../api/index.js";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import { jest } from "@jest/globals";
|
||||
import { it, jest } from "@jest/globals";
|
||||
import { runAndLogStats } from "./utils.js";
|
||||
|
||||
const stats = {
|
||||
name: "Anurag Hazra",
|
||||
@@ -24,8 +24,10 @@ const data_stats = {
|
||||
user: {
|
||||
name: stats.name,
|
||||
repositoriesContributedTo: { totalCount: stats.contributedTo },
|
||||
contributionsCollection: {
|
||||
commits: {
|
||||
totalCommitContributions: stats.totalCommits,
|
||||
},
|
||||
reviews: {
|
||||
totalPullRequestReviewContributions: stats.totalReviews,
|
||||
},
|
||||
pullRequests: { totalCount: stats.totalPRs },
|
||||
@@ -67,10 +69,10 @@ const faker = (query, data) => {
|
||||
return { req, res };
|
||||
};
|
||||
|
||||
benchmarkSuite("test /api", {
|
||||
["simple request"]: async () => {
|
||||
it("test /api", async () => {
|
||||
await runAndLogStats("test /api", async () => {
|
||||
const { req, res } = faker({}, data_stats);
|
||||
|
||||
await api(req, res);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import { benchmarkSuite } from "jest-bench";
|
||||
import { calculateRank } from "../../src/calculateRank.js";
|
||||
import { it } from "@jest/globals";
|
||||
import { runAndLogStats } from "./utils.js";
|
||||
|
||||
benchmarkSuite("calculateRank", {
|
||||
["calculateRank"]: () => {
|
||||
it("calculateRank", async () => {
|
||||
await runAndLogStats("calculateRank", () => {
|
||||
calculateRank({
|
||||
all_commits: false,
|
||||
commits: 1300,
|
||||
@@ -13,5 +14,5 @@ benchmarkSuite("calculateRank", {
|
||||
stars: 600000,
|
||||
followers: 50000,
|
||||
});
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { benchmarkSuite } from "jest-bench";
|
||||
import gist from "../../api/gist.js";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import { jest } from "@jest/globals";
|
||||
import { it, jest } from "@jest/globals";
|
||||
import { runAndLogStats } from "./utils.js";
|
||||
|
||||
const gist_data = {
|
||||
data: {
|
||||
@@ -34,8 +34,8 @@ const gist_data = {
|
||||
const mock = new MockAdapter(axios);
|
||||
mock.onPost("https://api.github.com/graphql").reply(200, gist_data);
|
||||
|
||||
benchmarkSuite("test /api/gist", {
|
||||
["simple request"]: async () => {
|
||||
it("test /api/gist", async () => {
|
||||
await runAndLogStats("test /api/gist", async () => {
|
||||
const req = {
|
||||
query: {
|
||||
id: "bbfce31e0217a3689c8d961a356cb10d",
|
||||
@@ -47,5 +47,5 @@ benchmarkSuite("test /api/gist", {
|
||||
};
|
||||
|
||||
await gist(req, res);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { benchmarkSuite } from "jest-bench";
|
||||
import pin from "../../api/pin.js";
|
||||
import axios from "axios";
|
||||
import MockAdapter from "axios-mock-adapter";
|
||||
import { jest } from "@jest/globals";
|
||||
import { it, jest } from "@jest/globals";
|
||||
import { runAndLogStats } from "./utils.js";
|
||||
|
||||
const data_repo = {
|
||||
repository: {
|
||||
@@ -32,8 +32,8 @@ const data_user = {
|
||||
const mock = new MockAdapter(axios);
|
||||
mock.onPost("https://api.github.com/graphql").reply(200, data_user);
|
||||
|
||||
benchmarkSuite("test /api/pin", {
|
||||
["simple request"]: async () => {
|
||||
it("test /api/pin", async () => {
|
||||
await runAndLogStats("test /api/pin", async () => {
|
||||
const req = {
|
||||
query: {
|
||||
username: "anuraghazra",
|
||||
@@ -46,5 +46,5 @@ benchmarkSuite("test /api/pin", {
|
||||
};
|
||||
|
||||
await pin(req, res);
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user