-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
/
template.mjs
53 lines (53 loc) · 2.12 KB
/
template.mjs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/**Template processor */
export default async function(_, {data}, {imports}) {
//Core
await imports.plugins.core(...arguments)
//Aliases
const {user, computed, plugins} = data
Object.assign(data, {
//Base
NAME: user.name,
LOGIN: user.login,
REGISTRATION_DATE: user.createdAt,
REGISTERED_YEARS: computed.registered.years,
LOCATION: user.location,
WEBSITE: user.websiteUrl,
REPOSITORIES: user.repositories.totalCount,
REPOSITORIES_DISK_USAGE: user.repositories.totalDiskUsage,
PACKAGES: user.packages.totalCount,
STARRED: user.starredRepositories.totalCount,
WATCHING: user.watching.totalCount,
SPONSORING: user.sponsorshipsAsSponsor.totalCount,
SPONSORS: user.sponsorshipsAsMaintainer.totalCount,
REPOSITORIES_CONTRIBUTED_TO: user.repositoriesContributedTo.totalCount,
COMMITS: computed.commits,
COMMITS_PUBLIC: user.contributionsCollection.totalCommitContributions,
COMMITS_PRIVATE: user.contributionsCollection.restrictedContributionsCount,
ISSUES: user.contributionsCollection.totalIssueContributions,
PULL_REQUESTS: user.contributionsCollection.totalPullRequestContributions,
PULL_REQUESTS_REVIEWS: user.contributionsCollection.totalPullRequestReviewContributions,
FOLLOWERS: user.followers.totalCount,
FOLLOWING: user.following.totalCount,
ISSUE_COMMENTS: user.issueComments.totalCount,
ORGANIZATIONS: user.organizations.totalCount,
WATCHERS: computed.repositories.watchers,
STARGAZERS: computed.repositories.stargazers,
FORKS: computed.repositories.forks,
RELEASES: computed.repositories.releases,
VERSION: data.meta.version,
//Lines
LINES_ADDED: plugins.lines?.added ?? 0,
LINES_DELETED: plugins.lines?.deleted ?? 0,
//Gists
GISTS: plugins.gists?.totalCount ?? 0,
GISTS_STARGAZERS: plugins.gists?.stargazers ?? 0,
//Languages
LANGUAGES: plugins.languages?.favorites?.map(({name, value, size, color}) => ({name, value, size, color})) ?? [],
//Posts
POSTS: plugins.posts?.list ?? [],
//Tweets
TWEETS: plugins.tweets?.list ?? [],
//Topics
TOPICS: plugins.topics?.list ?? [],
})
}