@stats-organization/github-readme-stats-core 2.1.5 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/api/gist.d.ts +2 -7
- package/build/api/gist.d.ts.map +1 -1
- package/build/api/gist.js +9 -41
- package/build/api/index.d.ts +3 -8
- package/build/api/index.d.ts.map +1 -1
- package/build/api/index.js +23 -45
- package/build/api/pin.d.ts +2 -7
- package/build/api/pin.d.ts.map +1 -1
- package/build/api/pin.js +9 -41
- package/build/api/top-langs.d.ts +2 -7
- package/build/api/top-langs.d.ts.map +1 -1
- package/build/api/top-langs.js +11 -55
- package/build/api/wakatime.d.ts +2 -7
- package/build/api/wakatime.d.ts.map +1 -1
- package/build/api/wakatime.js +9 -41
- package/build/cards/common-options.d.ts +13 -0
- package/build/cards/common-options.d.ts.map +1 -0
- package/build/cards/common-options.js +1 -0
- package/build/cards/gist.d.ts +11 -16
- package/build/cards/gist.d.ts.map +1 -1
- package/build/cards/gist.js +26 -31
- package/build/cards/repo.d.ts +19 -16
- package/build/cards/repo.d.ts.map +1 -1
- package/build/cards/repo.js +58 -60
- package/build/cards/stats.d.ts +29 -46
- package/build/cards/stats.d.ts.map +1 -1
- package/build/cards/stats.js +113 -181
- package/build/cards/top-languages.d.ts +81 -77
- package/build/cards/top-languages.d.ts.map +1 -1
- package/build/cards/top-languages.js +174 -200
- package/build/cards/wakatime.d.ts +21 -11
- package/build/cards/wakatime.d.ts.map +1 -1
- package/build/cards/wakatime.js +73 -111
- package/build/common/Card.d.ts +34 -13
- package/build/common/Card.d.ts.map +1 -1
- package/build/common/Card.js +73 -40
- package/build/common/I18n.d.ts +4 -2
- package/build/common/I18n.d.ts.map +1 -1
- package/build/common/color.d.ts +60 -18
- package/build/common/color.d.ts.map +1 -1
- package/build/common/color.js +102 -5
- package/build/common/config.d.ts +2 -1
- package/build/common/config.d.ts.map +1 -1
- package/build/common/config.js +16 -26
- package/build/common/constants.d.ts +2 -1
- package/build/common/constants.d.ts.map +1 -1
- package/build/common/date.d.ts +37 -0
- package/build/common/date.d.ts.map +1 -0
- package/build/common/date.js +31 -0
- package/build/common/http.d.ts +25 -2
- package/build/common/http.d.ts.map +1 -1
- package/build/common/http.js +26 -3
- package/build/common/icons.d.ts +1 -0
- package/build/common/icons.d.ts.map +1 -1
- package/build/common/icons.js +1 -0
- package/build/common/languageColors.d.ts +11 -0
- package/build/common/languageColors.d.ts.map +1 -0
- package/build/common/languageColors.js +15 -0
- package/build/common/languageColors.json +1 -0
- package/build/common/ops.d.ts +3 -10
- package/build/common/ops.d.ts.map +1 -1
- package/build/common/ops.js +3 -15
- package/build/common/render.d.ts +43 -6
- package/build/common/render.d.ts.map +1 -1
- package/build/common/render.js +77 -11
- package/build/common/retryer.d.ts +3 -2
- package/build/common/retryer.d.ts.map +1 -1
- package/build/common/retryer.js +1 -0
- package/build/fetchers/gist.d.ts.map +1 -1
- package/build/fetchers/gist.js +8 -39
- package/build/fetchers/repo.d.ts +12 -11
- package/build/fetchers/repo.d.ts.map +1 -1
- package/build/fetchers/repo.js +26 -67
- package/build/fetchers/stats.d.ts +24 -17
- package/build/fetchers/stats.d.ts.map +1 -1
- package/build/fetchers/stats.js +302 -183
- package/build/fetchers/top-languages.d.ts +10 -15
- package/build/fetchers/top-languages.d.ts.map +1 -1
- package/build/fetchers/top-languages.js +52 -103
- package/build/fetchers/types.d.ts +24 -20
- package/build/fetchers/types.d.ts.map +1 -1
- package/build/fetchers/wakatime.d.ts +9 -5
- package/build/fetchers/wakatime.d.ts.map +1 -1
- package/build/fetchers/wakatime.js +8 -4
- package/build/graphql/contributionsDocument.d.ts +18 -0
- package/build/graphql/contributionsDocument.d.ts.map +1 -0
- package/build/graphql/contributionsDocument.js +30 -0
- package/build/graphql/generated/common.d.ts +42 -0
- package/build/graphql/generated/common.d.ts.map +1 -0
- package/build/graphql/generated/common.js +2 -0
- package/build/graphql/generated/gist.d.ts +44 -0
- package/build/graphql/generated/gist.d.ts.map +1 -0
- package/build/graphql/generated/gist.js +27 -0
- package/build/graphql/generated/repo.d.ts +67 -0
- package/build/graphql/generated/repo.d.ts.map +1 -0
- package/build/graphql/generated/repo.js +30 -0
- package/build/graphql/generated/stats.d.ts +150 -0
- package/build/graphql/generated/stats.d.ts.map +1 -0
- package/build/graphql/generated/stats.js +95 -0
- package/build/graphql/generated/top-languages.d.ts +54 -0
- package/build/graphql/generated/top-languages.d.ts.map +1 -0
- package/build/graphql/generated/top-languages.js +27 -0
- package/build/graphql/graphqlDocument.d.ts +22 -0
- package/build/graphql/graphqlDocument.d.ts.map +1 -0
- package/build/graphql/graphqlDocument.js +8 -0
- package/build/graphql/reposContributedToDocument.d.ts +27 -0
- package/build/graphql/reposContributedToDocument.d.ts.map +1 -0
- package/build/graphql/reposContributedToDocument.js +59 -0
- package/build/index.d.ts +3 -1
- package/build/index.d.ts.map +1 -1
- package/build/index.js +2 -1
- package/build/themes/index.d.ts +32 -0
- package/build/themes/index.d.ts.map +1 -1
- package/build/themes/index.js +28 -0
- package/build/translations.d.ts +17 -0
- package/build/translations.d.ts.map +1 -1
- package/build/translations.js +17 -0
- package/package.json +13 -7
- package/src/_github-username-regex.d.ts +4 -0
- package/src/api/gist.js +10 -46
- package/src/api/index.js +30 -51
- package/src/api/pin.js +10 -46
- package/src/api/top-langs.js +13 -60
- package/src/api/wakatime.js +10 -46
- package/src/cards/common-options.ts +13 -0
- package/src/cards/{gist.js → gist.ts} +37 -37
- package/src/cards/{repo.js → repo.ts} +86 -68
- package/src/cards/{stats.js → stats.ts} +168 -219
- package/src/cards/{top-languages.js → top-languages.ts} +309 -265
- package/src/cards/{wakatime.js → wakatime.ts} +136 -130
- package/src/common/Card.ts +94 -49
- package/src/common/I18n.ts +6 -2
- package/src/common/color.ts +163 -14
- package/src/common/config.ts +22 -29
- package/src/common/constants.ts +3 -1
- package/src/common/date.ts +45 -0
- package/src/common/http.ts +43 -3
- package/src/common/icons.ts +1 -0
- package/src/common/languageColors.json +1 -0
- package/src/common/languageColors.ts +19 -0
- package/src/common/ops.ts +8 -18
- package/src/common/render.ts +114 -14
- package/src/common/retryer.ts +6 -5
- package/src/fetchers/gist.ts +15 -72
- package/src/fetchers/repo.ts +114 -0
- package/src/fetchers/stats.ts +743 -0
- package/src/fetchers/top-languages.ts +135 -0
- package/src/fetchers/types.ts +28 -20
- package/src/fetchers/{wakatime.js → wakatime.ts} +19 -5
- package/src/graphql/contributionsDocument.ts +44 -0
- package/src/graphql/generated/common.ts +26 -0
- package/src/graphql/generated/gist.ts +59 -0
- package/src/graphql/generated/repo.ts +90 -0
- package/src/graphql/generated/stats.ts +194 -0
- package/src/graphql/generated/top-languages.ts +75 -0
- package/src/graphql/graphqlDocument.ts +25 -0
- package/src/graphql/queries/gist.graphql +25 -0
- package/src/graphql/queries/repo.graphql +28 -0
- package/src/graphql/queries/stats.graphql +120 -0
- package/src/graphql/queries/top-languages.graphql +34 -0
- package/src/graphql/reposContributedToDocument.ts +86 -0
- package/src/index.ts +3 -1
- package/src/themes/index.ts +33 -0
- package/src/translations.ts +17 -0
- package/src/cards/types.d.ts +0 -78
- package/src/fetchers/repo.js +0 -161
- package/src/fetchers/stats.js +0 -473
- package/src/fetchers/top-languages.js +0 -175
- package/src/themes/README.md +0 -229
package/build/fetchers/repo.js
CHANGED
|
@@ -1,67 +1,29 @@
|
|
|
1
1
|
import { MissingParamError } from "../common/error.js";
|
|
2
|
-
import {
|
|
2
|
+
import { createGraphQLFetcher } from "../common/http.js";
|
|
3
3
|
import { retryer } from "../common/retryer.js";
|
|
4
|
+
import { GetRepoDocument } from "../graphql/generated/repo.js";
|
|
4
5
|
import { fetchRepoUserStats } from "./stats.js";
|
|
5
|
-
|
|
6
|
-
* Repo data fetcher.
|
|
7
|
-
*
|
|
8
|
-
* @param {object} variables Fetcher variables.
|
|
9
|
-
* @param {string} token GitHub token.
|
|
10
|
-
* @returns {Promise<import('axios').AxiosResponse>} The response.
|
|
11
|
-
*/
|
|
12
|
-
const fetcher = (variables, token) => {
|
|
13
|
-
return request({
|
|
14
|
-
query: `
|
|
15
|
-
fragment RepoInfo on Repository {
|
|
16
|
-
name
|
|
17
|
-
nameWithOwner
|
|
18
|
-
isPrivate
|
|
19
|
-
isArchived
|
|
20
|
-
isTemplate
|
|
21
|
-
stargazerCount
|
|
22
|
-
description
|
|
23
|
-
primaryLanguage {
|
|
24
|
-
color
|
|
25
|
-
id
|
|
26
|
-
name
|
|
27
|
-
}
|
|
28
|
-
forkCount
|
|
29
|
-
}
|
|
30
|
-
query getRepo($login: String!, $repo: String!) {
|
|
31
|
-
user(login: $login) {
|
|
32
|
-
repository(name: $repo) {
|
|
33
|
-
...RepoInfo
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
organization(login: $login) {
|
|
37
|
-
repository(name: $repo) {
|
|
38
|
-
...RepoInfo
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
`,
|
|
43
|
-
variables,
|
|
44
|
-
}, {
|
|
45
|
-
Authorization: `token ${token}`,
|
|
46
|
-
});
|
|
47
|
-
};
|
|
6
|
+
const fetcher = createGraphQLFetcher(GetRepoDocument, "token");
|
|
48
7
|
const urlExample = "/api/pin?username=USERNAME&repo=REPO_NAME";
|
|
49
|
-
/**
|
|
50
|
-
* @typedef {import("./types").RepositoryData} RepositoryData Repository data.
|
|
51
|
-
*/
|
|
52
8
|
/**
|
|
53
9
|
* Fetch repository data.
|
|
54
10
|
*
|
|
55
|
-
* @param
|
|
56
|
-
* @param
|
|
57
|
-
* @
|
|
11
|
+
* @param username GitHub username.
|
|
12
|
+
* @param reponame GitHub repository name.
|
|
13
|
+
* @param include_prs_authored Include count of PRs authored.
|
|
14
|
+
* @param include_prs_commented Include count of PRs commented.
|
|
15
|
+
* @param include_prs_reviewed Include count of PRs reviewed.
|
|
16
|
+
* @param include_issues_authored Include count of issues authored.
|
|
17
|
+
* @param include_issues_commented Include count of issues commented.
|
|
18
|
+
* @param pat Optional PAT override.
|
|
19
|
+
* @returns Repository data.
|
|
58
20
|
*/
|
|
59
21
|
const fetchRepo = async (username, reponame, include_prs_authored = false, include_prs_commented = false, include_prs_reviewed = false, include_issues_authored = false, include_issues_commented = false, pat = null) => {
|
|
60
22
|
let owner = username;
|
|
61
23
|
if (reponame && reponame.includes("/")) {
|
|
62
|
-
const [
|
|
63
|
-
owner =
|
|
64
|
-
reponame =
|
|
24
|
+
const [parsedOwner, parsedRepo] = reponame.split("/");
|
|
25
|
+
owner = parsedOwner ?? "";
|
|
26
|
+
reponame = parsedRepo ?? "";
|
|
65
27
|
}
|
|
66
28
|
if (owner && !username) {
|
|
67
29
|
username = owner;
|
|
@@ -78,34 +40,31 @@ const fetchRepo = async (username, reponame, include_prs_authored = false, inclu
|
|
|
78
40
|
if (!reponame) {
|
|
79
41
|
throw new MissingParamError(["repo"], urlExample);
|
|
80
42
|
}
|
|
81
|
-
|
|
43
|
+
const res = await retryer(fetcher, { login: owner, repo: reponame }, pat);
|
|
82
44
|
const data = res.data.data;
|
|
83
45
|
if (!data.user && !data.organization) {
|
|
84
46
|
throw new Error("Not found");
|
|
85
47
|
}
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
if (!data.user.repository || data.user.repository.isPrivate) {
|
|
48
|
+
if (data.organization === null && data.user) {
|
|
49
|
+
const repository = data.user.repository;
|
|
50
|
+
if (!repository || repository.isPrivate) {
|
|
90
51
|
throw new Error("User Repository Not found");
|
|
91
52
|
}
|
|
92
|
-
|
|
53
|
+
const repoUserStats = await fetchRepoUserStats(username, [owner + "/" + reponame], [], include_prs_authored, include_prs_commented, include_prs_reviewed, include_issues_authored, include_issues_commented, pat);
|
|
93
54
|
return {
|
|
94
55
|
...repoUserStats,
|
|
95
|
-
...
|
|
96
|
-
starCount: data.user.repository.stargazerCount,
|
|
56
|
+
...repository,
|
|
97
57
|
};
|
|
98
58
|
}
|
|
99
|
-
if (
|
|
100
|
-
|
|
101
|
-
|
|
59
|
+
if (data.user === null && data.organization) {
|
|
60
|
+
const repository = data.organization.repository;
|
|
61
|
+
if (!repository || repository.isPrivate) {
|
|
102
62
|
throw new Error("Organization Repository Not found");
|
|
103
63
|
}
|
|
104
|
-
|
|
64
|
+
const repoUserStats = await fetchRepoUserStats(username, [owner + "/" + reponame], [], include_prs_authored, include_prs_commented, include_prs_reviewed, include_issues_authored, include_issues_commented, pat);
|
|
105
65
|
return {
|
|
106
66
|
...repoUserStats,
|
|
107
|
-
...
|
|
108
|
-
starCount: data.organization.repository.stargazerCount,
|
|
67
|
+
...repository,
|
|
109
68
|
};
|
|
110
69
|
}
|
|
111
70
|
throw new Error("Unexpected behavior");
|
|
@@ -1,22 +1,29 @@
|
|
|
1
|
+
import type { RepoUserStats, StatsData } from "./types.js";
|
|
2
|
+
declare const fetchRepoUserStats: (username: string, repo: Array<string>, owner: Array<string>, include_prs_authored: boolean, include_prs_commented: boolean, include_prs_reviewed: boolean, include_issues_authored: boolean, include_issues_commented: boolean, pat: string | null) => Promise<RepoUserStats>;
|
|
1
3
|
/**
|
|
2
4
|
* Fetch stats for a given username.
|
|
3
5
|
*
|
|
4
|
-
* @param
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
8
|
-
* @param
|
|
9
|
-
* @param
|
|
10
|
-
* @param
|
|
11
|
-
* @param
|
|
12
|
-
* @
|
|
6
|
+
* @param username GitHub username.
|
|
7
|
+
* @param include_all_commits Include all commits.
|
|
8
|
+
* @param exclude_repo Repositories to exclude.
|
|
9
|
+
* @param include_merged_pull_requests Include merged pull requests.
|
|
10
|
+
* @param include_discussions Include discussions.
|
|
11
|
+
* @param include_discussions_answers Include discussions answers.
|
|
12
|
+
* @param commits_year Year to count total commits.
|
|
13
|
+
* @param repo Repositories to scope the REST search to.
|
|
14
|
+
* @param owner Owners to scope the REST search to.
|
|
15
|
+
* @param include_prs_authored Include count of PRs authored.
|
|
16
|
+
* @param include_prs_commented Include count of PRs commented.
|
|
17
|
+
* @param include_prs_reviewed Include count of PRs reviewed.
|
|
18
|
+
* @param include_issues_authored Include count of issues authored.
|
|
19
|
+
* @param include_issues_commented Include count of issues commented.
|
|
20
|
+
* @param ownerAffiliations Owner affiliations. Default: OWNER.
|
|
21
|
+
* @param include_contributions Include all-time contributions.
|
|
22
|
+
* @param include_all_time_contribs Include all-time count of repos contributed to.
|
|
23
|
+
* @param contribs_include_own_repos Include user-owned repos in contributed-to counts.
|
|
24
|
+
* @param pat Optional PAT override.
|
|
25
|
+
* @returns Stats data.
|
|
13
26
|
*/
|
|
14
|
-
|
|
15
|
-
export
|
|
16
|
-
totalPRsAuthored: number;
|
|
17
|
-
totalPRsCommented: number;
|
|
18
|
-
totalPRsReviewed: number;
|
|
19
|
-
totalIssuesAuthored: number;
|
|
20
|
-
totalIssuesCommented: number;
|
|
21
|
-
}>;
|
|
27
|
+
declare const fetchStats: (username: string, include_all_commits?: boolean, exclude_repo?: Array<string>, include_merged_pull_requests?: boolean, include_discussions?: boolean, include_discussions_answers?: boolean, commits_year?: number, repo?: Array<string>, owner?: Array<string>, include_prs_authored?: boolean, include_prs_commented?: boolean, include_prs_reviewed?: boolean, include_issues_authored?: boolean, include_issues_commented?: boolean, ownerAffiliations?: Array<string>, include_contributions?: boolean, include_all_time_contribs?: boolean, contribs_include_own_repos?: boolean, pat?: string | null) => Promise<StatsData>;
|
|
28
|
+
export { fetchStats, fetchRepoUserStats };
|
|
22
29
|
//# sourceMappingURL=stats.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/fetchers/stats.
|
|
1
|
+
{"version":3,"file":"stats.d.ts","sourceRoot":"","sources":["../../src/fetchers/stats.ts"],"names":[],"mappings":"AA6BA,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAgM3D,QAAA,MAAM,kBAAkB,GACtB,UAAU,MAAM,EAChB,MAAM,KAAK,CAAC,MAAM,CAAC,EACnB,OAAO,KAAK,CAAC,MAAM,CAAC,EACpB,sBAAsB,OAAO,EAC7B,uBAAuB,OAAO,EAC9B,sBAAsB,OAAO,EAC7B,yBAAyB,OAAO,EAChC,0BAA0B,OAAO,EACjC,KAAK,MAAM,GAAG,IAAI,KACjB,OAAO,CAAC,aAAa,CAqDvB,CAAC;AAiQF;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,QAAA,MAAM,UAAU,GACd,UAAU,MAAM,EAChB,6BAA2B,EAC3B,eAAc,KAAK,CAAC,MAAM,CAAM,EAChC,sCAAoC,EACpC,6BAA2B,EAC3B,qCAAmC,EACnC,eAAe,MAAM,EACrB,OAAM,KAAK,CAAC,MAAM,CAAM,EACxB,QAAO,KAAK,CAAC,MAAM,CAAM,EACzB,8BAA4B,EAC5B,+BAA6B,EAC7B,8BAA4B,EAC5B,iCAA+B,EAC/B,kCAAgC,EAChC,oBAAmB,KAAK,CAAC,MAAM,CAAM,EACrC,+BAA6B,EAC7B,mCAAiC,EACjC,oCAAkC,EAClC,MAAK,MAAM,GAAG,IAAW,KACxB,OAAO,CAAC,SAAS,CA2JnB,CAAC;AAEF,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,CAAC"}
|