|
1 | 1 | <div align="center"> |
2 | 2 |
|
3 | | -[<img src="public/favicon.png" alt="Code Statistic" width="64" height="64" style="transform: translateY(50px);">](https://stats.deeptrain.net) |
| 3 | +[<img src="docs/icon.png" alt="Code Statistic" width="64" height="64" style="transform: translateY(50px);">](https://stats.deeptrain.net) |
4 | 4 | # [Code Statistic](https://stats.deeptrain.net) |
5 | 5 |
|
6 | | -#### Dynamically analysis the code for each language in the repository/user and generate the results for your GitHub account and repo README. |
7 | | -#### 动态生成GitHub用户/仓库中的语言统计,可以作为图片装饰在个人首页和仓库README中 |
| 6 | +#### ⚡ Dynamically generate your github statistic card! |
8 | 7 |
|
9 | | -### [| 👀 |](https://stats.deeptrain.net) |
| 8 | + |
| 9 | + |
| 10 | + |
10 | 11 | <br> |
11 | 12 | </div> |
12 | 13 |
|
13 | | -## 🍏 Quickstart | 快速开始 |
| 14 | +## 🍊 User Card |
| 15 | +Hey, want to generate quickly? Have a look at our [website](https://stats.deeptrain.net/)! |
14 | 16 |
|
15 | | -### 🍊 Repo | 仓库 |
16 | | -*/repo/**username**/**repo**/* |
17 | | -```markdown |
18 | | -[](https://github.com/zmh-program/code-statistic) |
19 | | -``` |
20 | | -[](https://github.com/zmh-program/code-statistic) |
21 | | - |
22 | | -### 🍉 User | 用户 |
23 | | -*/user/**username**/* |
| 17 | +Use in your Github homepage! use it in your website! use it anywhere you want! |
24 | 18 | ```markdown |
25 | 19 | [](https://github.com/zmh-program/code-statistic) |
26 | 20 | ``` |
27 | 21 | [](https://github.com/zmh-program/code-statistic) |
28 | 22 |
|
29 | | -### 🥝 Dark Theme | 暗系主题 |
30 | | -*.../**?theme=dark*** |
31 | | -```markdown |
32 | | -[](https://github.com/zmh-program/code-statistic) |
33 | | -``` |
34 | | -[](https://github.com/zmh-program/code-statistic) |
| 23 | +> **Note** |
| 24 | +> currently only your own repositories as statistics, do not support the repositories **contributed** to others, do not support **private** repositories, excluding **fork** repositories. |
| 25 | +> |
| 26 | +> We will count all repository data such as stars, forks, open issues and output the statistic. |
35 | 27 |
|
36 | | -### Ref as HTML | 作为HTML引用 |
37 | | -```html |
38 | | -<a href="https://github.com/zmh-program/code-statistic"> |
39 | | - <img src="https://stats.deeptrain.net/repo/zmh-program/Zh-Website/?theme=dark" alt="zmh-program's Github Stats"> |
40 | | -</a> |
41 | | -``` |
42 | 28 |
|
43 | | -### API |
44 | | -/api/user/*username*/ |
45 | | -/api/repo/*username*/*repo*/ |
| 29 | +## 🍉 Repository Card |
| 30 | +Use in repository introduction! use in pull request! use in issue! use it anywhere you want to introduce the project! |
46 | 31 |
|
47 | | -### 🍎 Build Your Own Server | 搭建自己的服务器 |
48 | | -#### 🍒 Initialization | 初始化 |
49 | | -```shell |
50 | | -pnpm install |
| 32 | +```markdown |
| 33 | +[](https://github.com/zmh-program/code-statistic) |
51 | 34 | ``` |
| 35 | +[](https://github.com/zmh-program/code-statistic) |
52 | 36 |
|
53 | | -#### 🍬 Configuration | 配置 |
54 | | -https://github.com/zmh-program/code-statistic/blob/a3841c2eefcda8484f94f56724d8d6c2c015cd7c/config.ts#L1-L4 |
| 37 | +> **Warning** |
| 38 | +> by default, we can't get the data of private repo, please use your own [token](https://github.com/settings/tokens/new) to deploy. Don't forget to check the box to access your private repositories! |
55 | 39 |
|
56 | | -#### 🎄 Environment Variable | 环境变量 |
| 40 | +## 🥝 Dark Theme |
| 41 | +Very easy, just add `?theme=dark` after it in any kind of card! |
| 42 | +```markdown |
| 43 | +[](https://github.com/zmh-program/code-statistic) |
| 44 | +``` |
| 45 | +[](https://github.com/zmh-program/code-statistic) |
57 | 46 |
|
58 | | -| `TOKEN` | GitHub Access Token | |
59 | | -|---------|---------------------| |
60 | 47 |
|
| 48 | +## 👨💻 API |
| 49 | +1. `GET` `https://stats.deeptrain.net/api/user/{user}` |
61 | 50 |
|
62 | | -#### 🍇 Deployment | 部署 |
63 | | -```shell |
64 | | -ts-node index |
65 | | -``` |
| 51 | + > Example response: |
| 52 | + > ```json |
| 53 | + > { |
| 54 | + > "username": "zmh-program", |
| 55 | + > "org": false, |
| 56 | + > "location": "Shandong, China", |
| 57 | + > "repos": 24, |
| 58 | + > "stars": "0.3k", |
| 59 | + > "watchers": "0.3k", |
| 60 | + > "followers": "45", |
| 61 | + > "forks": "10", |
| 62 | + > "issues": "2", |
| 63 | + > "languages": [ |
| 64 | + > { |
| 65 | + > "color": "#3572A5", |
| 66 | + > "lang": "Python", |
| 67 | + > "percent": 35.30345154490841, |
| 68 | + > "text": "Python 35% (525.1k)", |
| 69 | + > "value": 525070 |
| 70 | + > }, |
| 71 | + > ... |
| 72 | + > ] |
| 73 | + > } |
| 74 | + > ``` |
| 75 | + > Error response: |
| 76 | + > ```json |
| 77 | + > { |
| 78 | + > "message": "user not found" |
| 79 | + > } |
| 80 | + > ``` |
| 81 | + <br> |
| 82 | +
|
| 83 | +2. `GET` `https://stats.deeptrain.net/api/repo/{user}/{repo}` |
| 84 | + |
| 85 | + > Example response: |
| 86 | + > ```json |
| 87 | + > { |
| 88 | + > "username": "zmh-program", |
| 89 | + > "license": "MIT", |
| 90 | + > "repo": "code-statistic", |
| 91 | + > "stars": "26", |
| 92 | + > "watchers": "26", |
| 93 | + > "color": "#a91e50", |
| 94 | + > "forks": "1", |
| 95 | + > "issues": "0", |
| 96 | + > "size": "1.0 MiB", |
| 97 | + > "languages": [ |
| 98 | + > { |
| 99 | + > "color": "#3178c6", |
| 100 | + > "lang": "TypeScript", |
| 101 | + > "percent": 42.76333789329686, |
| 102 | + > "text": "TypeScript 43% (21.9k)", |
| 103 | + > "value": 21882 |
| 104 | + > }, |
| 105 | + > ... |
| 106 | + > ] |
| 107 | + > } |
| 108 | + > ``` |
| 109 | + > Error response: |
| 110 | + > ```json |
| 111 | + > { |
| 112 | + > "message": "repo not found" |
| 113 | + > } |
| 114 | + > ``` |
0 commit comments