@stats-organization/github-readme-stats-core 2.1.4 → 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 +28 -26
- package/build/api/index.d.ts +3 -8
- package/build/api/index.d.ts.map +1 -1
- package/build/api/index.js +32 -36
- package/build/api/pin.d.ts +2 -7
- package/build/api/pin.d.ts.map +1 -1
- package/build/api/pin.js +18 -33
- 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 +32 -44
- package/build/api/wakatime.d.ts +2 -7
- package/build/api/wakatime.d.ts.map +1 -1
- package/build/api/wakatime.js +28 -26
- package/build/calculateRank.d.ts +12 -11
- package/build/calculateRank.d.ts.map +1 -1
- package/build/calculateRank.js +18 -18
- 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 +79 -72
- package/build/cards/stats.d.ts +29 -44
- package/build/cards/stats.d.ts.map +1 -1
- package/build/cards/stats.js +118 -173
- 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 +186 -184
- package/build/cards/wakatime.d.ts +21 -11
- package/build/cards/wakatime.d.ts.map +1 -1
- package/build/cards/wakatime.js +92 -109
- package/build/common/Card.d.ts +41 -14
- package/build/common/Card.d.ts.map +1 -1
- package/build/common/Card.js +92 -31
- package/build/common/I18n.d.ts +4 -2
- package/build/common/I18n.d.ts.map +1 -1
- package/build/common/color.d.ts +91 -15
- package/build/common/color.d.ts.map +1 -1
- package/build/common/color.js +163 -17
- 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/html.js +1 -1
- package/build/common/http.d.ts +37 -5
- package/build/common/http.d.ts.map +1 -1
- package/build/common/http.js +29 -6
- 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 +10 -1
- package/build/common/ops.d.ts +27 -33
- package/build/common/ops.d.ts.map +1 -1
- package/build/common/ops.js +31 -48
- package/build/common/render.d.ts +154 -113
- package/build/common/render.d.ts.map +1 -1
- package/build/common/render.js +209 -92
- package/build/common/retryer.d.ts +15 -6
- package/build/common/retryer.d.ts.map +1 -1
- package/build/common/retryer.js +2 -0
- package/build/fetchers/gist.d.ts +6 -21
- package/build/fetchers/gist.d.ts.map +1 -1
- package/build/fetchers/gist.js +28 -64
- package/build/fetchers/repo.d.ts +12 -11
- package/build/fetchers/repo.d.ts.map +1 -1
- package/build/fetchers/repo.js +27 -68
- package/build/fetchers/stats.d.ts +24 -17
- package/build/fetchers/stats.d.ts.map +1 -1
- package/build/fetchers/stats.js +302 -184
- 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 +130 -0
- package/build/fetchers/types.d.ts.map +1 -0
- package/build/fetchers/types.js +1 -0
- 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 +14 -8
- package/src/_emoji-name-map.d.ts +10 -0
- package/src/_github-username-regex.d.ts +4 -0
- package/src/api/gist.js +31 -31
- package/src/api/index.js +40 -42
- package/src/api/pin.js +20 -38
- package/src/api/top-langs.js +36 -49
- package/src/api/wakatime.js +31 -31
- package/src/{calculateRank.js → calculateRank.ts} +29 -19
- package/src/cards/common-options.ts +13 -0
- package/src/cards/{gist.js → gist.ts} +37 -37
- package/src/cards/{repo.js → repo.ts} +107 -79
- package/src/cards/{stats.js → stats.ts} +173 -210
- package/src/cards/{top-languages.js → top-languages.ts} +325 -243
- package/src/cards/{wakatime.js → wakatime.ts} +158 -127
- package/src/common/Card.ts +123 -43
- package/src/common/I18n.ts +6 -2
- package/src/common/color.ts +240 -28
- package/src/common/config.ts +22 -29
- package/src/common/constants.ts +3 -1
- package/src/common/date.ts +45 -0
- package/src/common/html.ts +1 -1
- package/src/common/http.ts +71 -0
- package/src/common/icons.ts +1 -0
- package/src/common/languageColors.json +10 -1
- package/src/common/languageColors.ts +19 -0
- package/src/common/ops.ts +158 -0
- package/src/common/render.ts +652 -0
- package/src/common/retryer.ts +21 -12
- package/src/fetchers/gist.ts +79 -0
- 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.d.ts → 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/common/http.js +0 -19
- package/src/common/ops.js +0 -170
- package/src/common/render.js +0 -440
- package/src/fetchers/gist.js +0 -112
- package/src/fetchers/repo.js +0 -161
- package/src/fetchers/stats.js +0 -474
- package/src/fetchers/top-languages.js +0 -175
- package/src/themes/README.md +0 -229
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
// Generated file — see .github/CONTRIBUTING.md
|
|
2
|
+
|
|
3
|
+
/** Internal type. DO NOT USE DIRECTLY. */
|
|
4
|
+
type Exact<T extends { [key: string]: unknown }> = { [K in keyof T]: T[K] };
|
|
5
|
+
import type * as Types from "./common.js";
|
|
6
|
+
|
|
7
|
+
import { graphqlDocument } from "../graphqlDocument.js";
|
|
8
|
+
export type TopLanguageFragment = {
|
|
9
|
+
size: number;
|
|
10
|
+
node: { color: string | null; name: string };
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export type TopLanguagesRepositoryFragment = {
|
|
14
|
+
name: string;
|
|
15
|
+
languages: {
|
|
16
|
+
edges: Array<{
|
|
17
|
+
size: number;
|
|
18
|
+
node: { color: string | null; name: string };
|
|
19
|
+
} | null> | null;
|
|
20
|
+
} | null;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export type TopLanguagesQueryVariables = Exact<{
|
|
24
|
+
login: string;
|
|
25
|
+
ownerAffiliations?:
|
|
26
|
+
| Array<Types.RepositoryAffiliation | null | undefined>
|
|
27
|
+
| Types.RepositoryAffiliation
|
|
28
|
+
| null
|
|
29
|
+
| undefined;
|
|
30
|
+
}>;
|
|
31
|
+
|
|
32
|
+
export type TopLanguagesQuery = {
|
|
33
|
+
user: {
|
|
34
|
+
repositories: {
|
|
35
|
+
nodes: Array<{
|
|
36
|
+
name: string;
|
|
37
|
+
languages: {
|
|
38
|
+
edges: Array<{
|
|
39
|
+
size: number;
|
|
40
|
+
node: { color: string | null; name: string };
|
|
41
|
+
} | null> | null;
|
|
42
|
+
} | null;
|
|
43
|
+
} | null> | null;
|
|
44
|
+
};
|
|
45
|
+
} | null;
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
export const TopLanguagesDocument = graphqlDocument<
|
|
49
|
+
TopLanguagesQuery,
|
|
50
|
+
TopLanguagesQueryVariables
|
|
51
|
+
>(`
|
|
52
|
+
query topLanguages($login: String!, $ownerAffiliations: [RepositoryAffiliation]) {
|
|
53
|
+
user(login: $login) {
|
|
54
|
+
repositories(ownerAffiliations: $ownerAffiliations, isFork: false, first: 100) {
|
|
55
|
+
nodes {
|
|
56
|
+
...TopLanguagesRepository
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
fragment TopLanguagesRepository on Repository {
|
|
62
|
+
name
|
|
63
|
+
languages(first: 10, orderBy: {field: SIZE, direction: DESC}) {
|
|
64
|
+
edges {
|
|
65
|
+
...TopLanguage
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
fragment TopLanguage on LanguageEdge {
|
|
70
|
+
size
|
|
71
|
+
node {
|
|
72
|
+
color
|
|
73
|
+
name
|
|
74
|
+
}
|
|
75
|
+
}`);
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A GraphQL query paired with the types of its result and variables.
|
|
3
|
+
*
|
|
4
|
+
* `text` is what goes over the wire; the other two members only carry types and are never assigned.
|
|
5
|
+
* Documents are generated from `queries/*.graphql`
|
|
6
|
+
* See `scripts/generate-graphql-types.js`.
|
|
7
|
+
*/
|
|
8
|
+
interface GraphQLDocument<TResult, TVariables> {
|
|
9
|
+
readonly text: string;
|
|
10
|
+
readonly __result?: TResult;
|
|
11
|
+
readonly __variables?: TVariables;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Build a typed document.
|
|
16
|
+
*
|
|
17
|
+
* @param text The query text, including every fragment it spreads.
|
|
18
|
+
* @returns The document to pass to the function created by `createGraphQLFetcher`.
|
|
19
|
+
*/
|
|
20
|
+
const graphqlDocument = <TResult, TVariables>(
|
|
21
|
+
text: string,
|
|
22
|
+
): GraphQLDocument<TResult, TVariables> => ({ text });
|
|
23
|
+
|
|
24
|
+
export { graphqlDocument };
|
|
25
|
+
export type { GraphQLDocument };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
fragment GistFileInfo on GistFile {
|
|
2
|
+
name
|
|
3
|
+
language {
|
|
4
|
+
name
|
|
5
|
+
}
|
|
6
|
+
size
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
query gistInfo($gistName: String!) {
|
|
10
|
+
viewer {
|
|
11
|
+
gist(name: $gistName) {
|
|
12
|
+
description
|
|
13
|
+
owner {
|
|
14
|
+
login
|
|
15
|
+
}
|
|
16
|
+
stargazerCount
|
|
17
|
+
forks {
|
|
18
|
+
totalCount
|
|
19
|
+
}
|
|
20
|
+
files {
|
|
21
|
+
...GistFileInfo
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
fragment RepoInfo on Repository {
|
|
2
|
+
name
|
|
3
|
+
nameWithOwner
|
|
4
|
+
isPrivate
|
|
5
|
+
isArchived
|
|
6
|
+
isTemplate
|
|
7
|
+
stargazerCount
|
|
8
|
+
description
|
|
9
|
+
primaryLanguage {
|
|
10
|
+
color
|
|
11
|
+
id
|
|
12
|
+
name
|
|
13
|
+
}
|
|
14
|
+
forkCount
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
query getRepo($login: String!, $repo: String!) {
|
|
18
|
+
user(login: $login) {
|
|
19
|
+
repository(name: $repo) {
|
|
20
|
+
...RepoInfo
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
organization(login: $login) {
|
|
24
|
+
repository(name: $repo) {
|
|
25
|
+
...RepoInfo
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
fragment RepoNode on Repository {
|
|
2
|
+
name
|
|
3
|
+
stargazerCount
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
fragment RepoStars on User {
|
|
7
|
+
repositories(
|
|
8
|
+
first: 100
|
|
9
|
+
after: $after
|
|
10
|
+
ownerAffiliations: $ownerAffiliations
|
|
11
|
+
orderBy: { direction: DESC, field: STARGAZERS }
|
|
12
|
+
) {
|
|
13
|
+
totalCount
|
|
14
|
+
nodes {
|
|
15
|
+
...RepoNode
|
|
16
|
+
}
|
|
17
|
+
pageInfo {
|
|
18
|
+
hasNextPage
|
|
19
|
+
endCursor
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
query userRepos(
|
|
25
|
+
$login: String!
|
|
26
|
+
$after: String
|
|
27
|
+
$ownerAffiliations: [RepositoryAffiliation]
|
|
28
|
+
) {
|
|
29
|
+
user(login: $login) {
|
|
30
|
+
...RepoStars
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
query userInfo(
|
|
35
|
+
$login: String!
|
|
36
|
+
$after: String
|
|
37
|
+
$includeMergedPullRequests: Boolean!
|
|
38
|
+
$includeDiscussions: Boolean!
|
|
39
|
+
$includeDiscussionsAnswers: Boolean!
|
|
40
|
+
$startTime: DateTime = null
|
|
41
|
+
$ownerAffiliations: [RepositoryAffiliation]
|
|
42
|
+
$includeUserRepositories: Boolean!
|
|
43
|
+
) {
|
|
44
|
+
user(login: $login) {
|
|
45
|
+
name
|
|
46
|
+
login
|
|
47
|
+
commits: contributionsCollection(from: $startTime) {
|
|
48
|
+
totalCommitContributions
|
|
49
|
+
}
|
|
50
|
+
reviews: contributionsCollection {
|
|
51
|
+
totalPullRequestReviewContributions
|
|
52
|
+
}
|
|
53
|
+
repositoriesContributedTo(
|
|
54
|
+
first: 1
|
|
55
|
+
contributionTypes: [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]
|
|
56
|
+
includeUserRepositories: $includeUserRepositories
|
|
57
|
+
) {
|
|
58
|
+
totalCount
|
|
59
|
+
}
|
|
60
|
+
pullRequests(first: 1) {
|
|
61
|
+
totalCount
|
|
62
|
+
}
|
|
63
|
+
mergedPullRequests: pullRequests(states: MERGED)
|
|
64
|
+
@include(if: $includeMergedPullRequests) {
|
|
65
|
+
totalCount
|
|
66
|
+
}
|
|
67
|
+
openIssues: issues(states: OPEN) {
|
|
68
|
+
totalCount
|
|
69
|
+
}
|
|
70
|
+
closedIssues: issues(states: CLOSED) {
|
|
71
|
+
totalCount
|
|
72
|
+
}
|
|
73
|
+
followers {
|
|
74
|
+
totalCount
|
|
75
|
+
}
|
|
76
|
+
repositoryDiscussions @include(if: $includeDiscussions) {
|
|
77
|
+
totalCount
|
|
78
|
+
}
|
|
79
|
+
repositoryDiscussionComments(onlyAnswers: true)
|
|
80
|
+
@include(if: $includeDiscussionsAnswers) {
|
|
81
|
+
totalCount
|
|
82
|
+
}
|
|
83
|
+
contributionsCollection {
|
|
84
|
+
contributionYears
|
|
85
|
+
}
|
|
86
|
+
...RepoStars
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
fragment YearContributions on ContributionsCollection {
|
|
91
|
+
contributionCalendar {
|
|
92
|
+
totalContributions
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
fragment RangeContributionsByRepo on ContributionsCollection {
|
|
97
|
+
commitContributionsByRepository(maxRepositories: $maxRepositories) {
|
|
98
|
+
repository {
|
|
99
|
+
nameWithOwner
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
issueContributionsByRepository(maxRepositories: $maxRepositories) {
|
|
103
|
+
repository {
|
|
104
|
+
nameWithOwner
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
pullRequestContributionsByRepository(maxRepositories: $maxRepositories) {
|
|
108
|
+
repository {
|
|
109
|
+
nameWithOwner
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
repositoryContributions(first: $maxRepositories)
|
|
113
|
+
@include(if: $includeOwnRepos) {
|
|
114
|
+
nodes {
|
|
115
|
+
repository {
|
|
116
|
+
nameWithOwner
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
fragment TopLanguage on LanguageEdge {
|
|
2
|
+
size
|
|
3
|
+
node {
|
|
4
|
+
color
|
|
5
|
+
name
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
fragment TopLanguagesRepository on Repository {
|
|
10
|
+
name
|
|
11
|
+
languages(first: 10, orderBy: { field: SIZE, direction: DESC }) {
|
|
12
|
+
edges {
|
|
13
|
+
...TopLanguage
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
query topLanguages(
|
|
19
|
+
$login: String!
|
|
20
|
+
$ownerAffiliations: [RepositoryAffiliation]
|
|
21
|
+
) {
|
|
22
|
+
user(login: $login) {
|
|
23
|
+
# do not fetch forks
|
|
24
|
+
repositories(
|
|
25
|
+
ownerAffiliations: $ownerAffiliations
|
|
26
|
+
isFork: false
|
|
27
|
+
first: 100
|
|
28
|
+
) {
|
|
29
|
+
nodes {
|
|
30
|
+
...TopLanguagesRepository
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type { GitHubDateRange } from "../common/date.js";
|
|
2
|
+
import { toGitHubDateTime } from "../common/date.js";
|
|
3
|
+
|
|
4
|
+
import type { RangeContributionsByRepoFragment } from "./generated/stats.js";
|
|
5
|
+
import { graphqlDocument } from "./graphqlDocument.js";
|
|
6
|
+
|
|
7
|
+
/** max value GitHub allows for `first/maxRepositories` */
|
|
8
|
+
const MAX_REPOSITORIES_LIMIT = 100;
|
|
9
|
+
|
|
10
|
+
interface ReposContributedToQueryVariables {
|
|
11
|
+
login: string;
|
|
12
|
+
maxRepositories: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
interface ReposContributedToQuery {
|
|
16
|
+
user: Record<`range_${number}`, RangeContributionsByRepoFragment> | null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Build a query for the repositories a user contributed to within multiple time
|
|
21
|
+
* ranges. One aliased `contributionsCollection` field per range, so all ranges
|
|
22
|
+
* are fetched in a single request. The shape is only known at runtime.
|
|
23
|
+
*
|
|
24
|
+
* Mirrors the `contributionTypes: [COMMIT, ISSUE, PULL_REQUEST, REPOSITORY]`
|
|
25
|
+
* filter used by `repositoriesContributedTo` in `stats.graphql`.
|
|
26
|
+
*
|
|
27
|
+
* @param ranges Ranges to fetch, one `range_<index>` alias each.
|
|
28
|
+
* @param includeOwnRepos Whether to select `repositoryContributions`.
|
|
29
|
+
* @returns Document for `createGraphQLFetcher`.
|
|
30
|
+
*/
|
|
31
|
+
const buildReposContributedToDocument = (
|
|
32
|
+
ranges: Array<GitHubDateRange>,
|
|
33
|
+
includeOwnRepos: boolean,
|
|
34
|
+
) => {
|
|
35
|
+
const rangeFields = ranges
|
|
36
|
+
.map(
|
|
37
|
+
({ from, to }, index) =>
|
|
38
|
+
`range_${index}: contributionsCollection(from: "${toGitHubDateTime(from)}", to: "${toGitHubDateTime(to)}") { ...RangeContributionsByRepo }`,
|
|
39
|
+
)
|
|
40
|
+
.join("\n");
|
|
41
|
+
|
|
42
|
+
// `repositoryContributions` only ever returns repos the user owns,
|
|
43
|
+
// so it is left out rather than gated with @include: an excluded field still counts toward the query's node cost.
|
|
44
|
+
// stats.graphql carries the directive so the generated type marks the field optional.
|
|
45
|
+
const ownRepoField = includeOwnRepos
|
|
46
|
+
? `repositoryContributions(first: $maxRepositories) {
|
|
47
|
+
nodes {
|
|
48
|
+
repository {
|
|
49
|
+
nameWithOwner
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}`
|
|
53
|
+
: "";
|
|
54
|
+
|
|
55
|
+
// fragment must match queries/stats.graphql, which generates its type
|
|
56
|
+
return graphqlDocument<
|
|
57
|
+
ReposContributedToQuery,
|
|
58
|
+
ReposContributedToQueryVariables
|
|
59
|
+
>(`
|
|
60
|
+
query userReposContributedTo($login: String!, $maxRepositories: Int!) {
|
|
61
|
+
user(login: $login) {
|
|
62
|
+
${rangeFields}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
fragment RangeContributionsByRepo on ContributionsCollection {
|
|
66
|
+
commitContributionsByRepository(maxRepositories: $maxRepositories) {
|
|
67
|
+
repository {
|
|
68
|
+
nameWithOwner
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
issueContributionsByRepository(maxRepositories: $maxRepositories) {
|
|
72
|
+
repository {
|
|
73
|
+
nameWithOwner
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
pullRequestContributionsByRepository(maxRepositories: $maxRepositories) {
|
|
77
|
+
repository {
|
|
78
|
+
nameWithOwner
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
${ownRepoField}
|
|
82
|
+
}`);
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
export { buildReposContributedToDocument, MAX_REPOSITORIES_LIMIT };
|
|
86
|
+
export type { ReposContributedToQuery };
|
package/src/index.ts
CHANGED
|
@@ -9,7 +9,8 @@ export { retryer } from "./common/retryer.js";
|
|
|
9
9
|
|
|
10
10
|
export { renderError } from "./common/render.js";
|
|
11
11
|
|
|
12
|
-
export {
|
|
12
|
+
export { clampValue } from "./common/ops.js";
|
|
13
|
+
export { dateDiff } from "./common/date.js";
|
|
13
14
|
|
|
14
15
|
export { logger } from "./common/log.js";
|
|
15
16
|
export { request } from "./common/http.js";
|
|
@@ -23,3 +24,4 @@ export { default as wakatime } from "./api/wakatime.js";
|
|
|
23
24
|
export { getConfig, loadConfigFromEnv } from "./common/config.js";
|
|
24
25
|
|
|
25
26
|
export { themes } from "./themes/index.js";
|
|
27
|
+
export type { ThemeName } from "./themes/index.js";
|
package/src/themes/index.ts
CHANGED
|
@@ -23,6 +23,34 @@ export const themes = {
|
|
|
23
23
|
text_color: "434d58",
|
|
24
24
|
bg_color: "fffefe",
|
|
25
25
|
},
|
|
26
|
+
light_github: {
|
|
27
|
+
title_color: "0969da",
|
|
28
|
+
icon_color: "0969da",
|
|
29
|
+
text_color: "59636e",
|
|
30
|
+
bg_color: "ffffff",
|
|
31
|
+
border_color: "d1d9e0",
|
|
32
|
+
},
|
|
33
|
+
dark_github: {
|
|
34
|
+
title_color: "4493f8",
|
|
35
|
+
icon_color: "4493f8",
|
|
36
|
+
text_color: "9198a1",
|
|
37
|
+
bg_color: "0d1117",
|
|
38
|
+
border_color: "3d444d",
|
|
39
|
+
},
|
|
40
|
+
light_github_repocard: {
|
|
41
|
+
title_color: "0969da",
|
|
42
|
+
icon_color: "59636e",
|
|
43
|
+
text_color: "59636e",
|
|
44
|
+
bg_color: "ffffff",
|
|
45
|
+
border_color: "d1d9e0",
|
|
46
|
+
},
|
|
47
|
+
dark_github_repocard: {
|
|
48
|
+
title_color: "4493f8",
|
|
49
|
+
icon_color: "9198a1",
|
|
50
|
+
text_color: "9198a1",
|
|
51
|
+
bg_color: "0d1117",
|
|
52
|
+
border_color: "3d444d",
|
|
53
|
+
},
|
|
26
54
|
transparent: {
|
|
27
55
|
title_color: "006AFF",
|
|
28
56
|
icon_color: "0579C3",
|
|
@@ -474,3 +502,8 @@ export const themes = {
|
|
|
474
502
|
bg_color: "35,4158d0,c850c0,ffcc70",
|
|
475
503
|
},
|
|
476
504
|
} as const satisfies Record<string, Theme>;
|
|
505
|
+
|
|
506
|
+
/**
|
|
507
|
+
* Name of one of the {@link themes}.
|
|
508
|
+
*/
|
|
509
|
+
export type ThemeName = keyof typeof themes;
|
package/src/translations.ts
CHANGED
|
@@ -362,6 +362,9 @@ const statCardLocales = ({
|
|
|
362
362
|
no: "Bidro til (i fjor)",
|
|
363
363
|
be: "Уклад (за мінулы год)",
|
|
364
364
|
},
|
|
365
|
+
"statcard.all-time-contribs": {
|
|
366
|
+
en: "Contributed to (all time)",
|
|
367
|
+
},
|
|
365
368
|
"statcard.reviews": {
|
|
366
369
|
en: "Total PRs Reviewed",
|
|
367
370
|
ar: "طلبات السحب التي تم مراجعتها",
|
|
@@ -511,18 +514,27 @@ const statCardLocales = ({
|
|
|
511
514
|
},
|
|
512
515
|
"statcard.prs-authored": {
|
|
513
516
|
en: "PRs Created",
|
|
517
|
+
"zh-tw": "建立的拉取請求",
|
|
514
518
|
},
|
|
515
519
|
"statcard.prs-commented": {
|
|
516
520
|
en: "PRs Commented",
|
|
521
|
+
"zh-tw": "參與討論的拉取請求",
|
|
517
522
|
},
|
|
518
523
|
"statcard.prs-reviewed": {
|
|
519
524
|
en: "PRs Reviewed",
|
|
525
|
+
"zh-tw": "審核的拉取請求",
|
|
520
526
|
},
|
|
521
527
|
"statcard.issues-authored": {
|
|
522
528
|
en: "Issues Created",
|
|
529
|
+
"zh-tw": "建立的議題",
|
|
523
530
|
},
|
|
524
531
|
"statcard.issues-commented": {
|
|
525
532
|
en: "Issues Commented",
|
|
533
|
+
"zh-tw": "參與討論的議題",
|
|
534
|
+
},
|
|
535
|
+
"statcard.contributions": {
|
|
536
|
+
en: "Total Contributions",
|
|
537
|
+
"zh-tw": "總貢獻數量",
|
|
526
538
|
},
|
|
527
539
|
"statcard.prs-merged": {
|
|
528
540
|
en: "Total PRs Merged",
|
|
@@ -724,18 +736,23 @@ const repoCardLocales = {
|
|
|
724
736
|
},
|
|
725
737
|
"repocard.prs-authored": {
|
|
726
738
|
en: "my created PRs",
|
|
739
|
+
"zh-tw": "我所創建的拉取請求",
|
|
727
740
|
},
|
|
728
741
|
"repocard.prs-commented": {
|
|
729
742
|
en: "my commented PRs",
|
|
743
|
+
"zh-tw": "我所參與的拉取請求",
|
|
730
744
|
},
|
|
731
745
|
"repocard.prs-reviewed": {
|
|
732
746
|
en: "my reviewed PRs",
|
|
747
|
+
"zh-tw": "我所審核的拉取請求",
|
|
733
748
|
},
|
|
734
749
|
"repocard.issues-authored": {
|
|
735
750
|
en: "my created issues",
|
|
751
|
+
"zh-tw": "我所創建的議題",
|
|
736
752
|
},
|
|
737
753
|
"repocard.issues-commented": {
|
|
738
754
|
en: "my commented issues",
|
|
755
|
+
"zh-tw": "我所參與的議題",
|
|
739
756
|
},
|
|
740
757
|
};
|
|
741
758
|
|
package/src/cards/types.d.ts
DELETED
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
type ThemeNames = keyof typeof import("../themes/index.ts");
|
|
2
|
-
type RankIcon = "default" | "github" | "percentile";
|
|
3
|
-
|
|
4
|
-
interface CommonOptions {
|
|
5
|
-
title_color: string;
|
|
6
|
-
icon_color: string;
|
|
7
|
-
text_color: string;
|
|
8
|
-
bg_color: string;
|
|
9
|
-
theme: ThemeNames;
|
|
10
|
-
border_radius: number;
|
|
11
|
-
border_color: string;
|
|
12
|
-
locale: string;
|
|
13
|
-
hide_border: boolean;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export type StatCardOptions = CommonOptions & {
|
|
17
|
-
hide: Array<string>;
|
|
18
|
-
show_icons: boolean;
|
|
19
|
-
hide_title: boolean;
|
|
20
|
-
card_width: number;
|
|
21
|
-
hide_rank: boolean;
|
|
22
|
-
include_all_commits: boolean;
|
|
23
|
-
commits_year: number;
|
|
24
|
-
line_height: number | string;
|
|
25
|
-
custom_title: string;
|
|
26
|
-
disable_animations: boolean;
|
|
27
|
-
number_format: string;
|
|
28
|
-
number_precision: number;
|
|
29
|
-
ring_color: string;
|
|
30
|
-
text_bold: boolean;
|
|
31
|
-
rank_icon: RankIcon;
|
|
32
|
-
show: Array<string>;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
export type RepoCardOptions = CommonOptions & {
|
|
36
|
-
show_owner: boolean;
|
|
37
|
-
browser_rendering: boolean;
|
|
38
|
-
description_lines_count: number;
|
|
39
|
-
card_width_input;
|
|
40
|
-
show: Array<string>;
|
|
41
|
-
show_icons: boolean;
|
|
42
|
-
number_format: string;
|
|
43
|
-
text_bold: boolean;
|
|
44
|
-
line_height: number | string;
|
|
45
|
-
username;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
export type TopLangOptions = CommonOptions & {
|
|
49
|
-
hide_title: boolean;
|
|
50
|
-
card_width: number;
|
|
51
|
-
hide: Array<string>;
|
|
52
|
-
layout: "compact" | "normal" | "donut" | "donut-vertical" | "pie";
|
|
53
|
-
custom_title: string;
|
|
54
|
-
langs_count: number;
|
|
55
|
-
disable_animations: boolean;
|
|
56
|
-
hide_progress: boolean;
|
|
57
|
-
hide_values: boolean;
|
|
58
|
-
prog_bar_bg_color: string;
|
|
59
|
-
stats_format: "percentages" | "bytes";
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
export type WakaTimeOptions = CommonOptions & {
|
|
63
|
-
hide_title: boolean;
|
|
64
|
-
hide: Array<string>;
|
|
65
|
-
card_width: number;
|
|
66
|
-
line_height: string;
|
|
67
|
-
hide_progress: boolean;
|
|
68
|
-
custom_title: string;
|
|
69
|
-
layout: "compact" | "normal";
|
|
70
|
-
langs_count: number;
|
|
71
|
-
display_format: "time" | "percent";
|
|
72
|
-
disable_animations: boolean;
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export type GistCardOptions = CommonOptions & {
|
|
76
|
-
show_owner: boolean;
|
|
77
|
-
browser_rendering: boolean;
|
|
78
|
-
};
|
package/src/common/http.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import axios from "axios";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Send GraphQL request to GitHub API.
|
|
5
|
-
*
|
|
6
|
-
* @param {import('axios').AxiosRequestConfig['data']} data Request data.
|
|
7
|
-
* @param {import('axios').AxiosRequestConfig['headers']} headers Request headers.
|
|
8
|
-
* @returns {Promise<any>} Request response.
|
|
9
|
-
*/
|
|
10
|
-
const request = (data, headers) => {
|
|
11
|
-
return axios({
|
|
12
|
-
url: "https://api.github.com/graphql",
|
|
13
|
-
method: "post",
|
|
14
|
-
headers,
|
|
15
|
-
data,
|
|
16
|
-
});
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export { request };
|