Split SVG templates into partials and add config_order option (#53)
This commit is contained in:
@@ -50,112 +50,7 @@ WARRANTY, to the extent permitted by applicable law.
|
||||
|
||||
Last generated: <%= new Date().toGMTString() %>
|
||||
</div><% } -%>
|
||||
<%# ============================================================= -%>
|
||||
<% if (base.header) { %>
|
||||
<div class="stdin"><%- meta.$ %> whoami</div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
<b><%= user.name || user.login %></b> registered=<%= computed.registration.match(/^.+? [ym]/)[0].replace(/ /g, "") %>, uid=<%= `${user.databaseId}`.substr(-4) %>, gid=<%= user.organizations.totalCount %>
|
||||
contributed to <%= user.repositoriesContributedTo.totalCount %> repositor<%= s(user.repositoriesContributedTo.totalCount, "y") %> <b><% for (const [x, {color}] of Object.entries(computed.calendar)) { -%><span style="color:<%= color %>">#</span><% } %></b>
|
||||
followed by <b><%= user.followers.totalCount %></b> user<%= s(user.followers.totalCount) %>
|
||||
</div><% } -%>
|
||||
<%# ============================================================= -%>
|
||||
<% if ((base.activity)||(base.community)) { %>
|
||||
<div class="stdin"><%- meta.$ %> git status</div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
<% if (base.activity) { -%>
|
||||
<b>Recent activity</b>
|
||||
<b><%= `${computed.commits}`.padStart(5) %></b> commit<%= s(computed.commits) %>
|
||||
<b><%= `${user.contributionsCollection.totalPullRequestReviewContributions}`.padStart(5) %></b> pull request<%= s(user.contributionsCollection.totalPullRequestReviewContributions) %> reviewed
|
||||
<b><%= `${user.contributionsCollection.totalPullRequestContributions}`.padStart(5) %></b> pull request<%= s(user.contributionsCollection.totalPullRequestContributions) %> opened
|
||||
<b><%= `${user.contributionsCollection.totalIssueContributions}`.padStart(5) %></b> issue<%= s(user.contributionsCollection.totalIssueContributions) %> opened
|
||||
<b><%= `${user.issueComments.totalCount}`.padStart(5) %></b> issue comment<%= s(user.issueComments.totalCount) %>
|
||||
<% } -%>
|
||||
<% if ((base.activity)&&(base.community)) { -%>
|
||||
|
||||
<% } -%>
|
||||
<% if (base.community) { -%>
|
||||
<b>Tracked activity</b>
|
||||
<b><%= `${user.following.totalCount}`.padStart(5) %></b> user<%= s(user.followers.totalCount) %> followed
|
||||
<b><%= `${user.sponsorshipsAsSponsor.totalCount}`.padStart(5) %></b> repositor<%= s(user.sponsorshipsAsSponsor.totalCount, "y") %> sponsored
|
||||
<b><%= `${user.starredRepositories.totalCount}`.padStart(5) %></b> repositor<%= s(user.starredRepositories.totalCount, "y") %> starred
|
||||
<b><%= `${user.watching.totalCount}`.padStart(5) %></b> repositor<%= s(user.watching.totalCount, "y") %> watched
|
||||
<% } -%>
|
||||
</div><% } -%>
|
||||
<%# ============================================================= -%>
|
||||
<% if (base.repositories) { %>
|
||||
<div class="stdin"><%- meta.$ %> ls -lh github/repositories</div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
Total <%= user.repositories.totalCount %> repositor<%= s(user.repositories.totalCount, "y") %> - <%= computed.diskUsage %>
|
||||
<% if (plugins.traffic) { if (plugins.traffic.error) { -%>
|
||||
---- <b> </b> views <span class="error">(<%= plugins.traffic.error.message %>)</span>
|
||||
<% } else { -%>
|
||||
-r-- <b><%= `${plugins.traffic.views.count}`.padStart(5) %></b> views
|
||||
<% }} -%>
|
||||
-r-- <b><%= `${computed.repositories.stargazers}`.padStart(5) %></b> stargazer<%= s(computed.repositories.stargazers) %>
|
||||
-r-- <b><%= `${computed.repositories.forks}`.padStart(5) %></b> fork<%= s(computed.repositories.forks) %>
|
||||
-r-- <b><%= `${computed.repositories.watchers}`.padStart(5) %></b> watcher<%= s(computed.repositories.watchers) %>
|
||||
dr-x <b><%= `${user.packages.totalCount}`.padStart(5) %></b> package<%= s(user.packages.totalCount) %>
|
||||
<% if (plugins.followup) { if (plugins.followup.error) { -%>
|
||||
d--- <b> </b> ISSUES <span class="error">(<%= plugins.followup.error.message %>)</span>
|
||||
d--- <b> </b> PULL_REQUESTS <span class="error">(<%= plugins.followup.error.message %>)</span>
|
||||
<% } else { -%>
|
||||
dr-x <b><%= `${plugins.followup.issues.count}`.padStart(5) %></b> ISSUES
|
||||
-r-- <b><%= `${plugins.followup.issues.open}`.padStart(5) %></b> ├── open
|
||||
-r-- <b><%= `${plugins.followup.issues.closed}`.padStart(5) %></b> └── closed
|
||||
dr-x <b><%= `${plugins.followup.issues.count}`.padStart(5) %></b> PULL_REQUESTS
|
||||
-r-- <b><%= `${plugins.followup.pr.open}`.padStart(5) %></b> ├── open
|
||||
-r-- <b><%= `${plugins.followup.pr.merged}`.padStart(5) %></b> └── merged
|
||||
<% }} -%>
|
||||
<% if (computed.licenses.favorite.length) { -%>
|
||||
dr-x LICENSE
|
||||
-r-- └── <%= computed.licenses.favorite %>
|
||||
<% } -%>
|
||||
<% if (plugins.lines) { if (plugins.lines.error) { %>
|
||||
<span class="diff error">@@ <%= plugins.lines.error.message %> @@</span><% } else { %>
|
||||
<span class="diff">@@ -<%= plugins.lines.deleted %> +<%= plugins.lines.added %> @@</span>
|
||||
<% }} -%>
|
||||
</div><% } -%>
|
||||
<%# ============================================================= -%>
|
||||
<% if (plugins.gists) { %>
|
||||
<div class="stdin"><%- meta.$ %> ls -lh github/gists</div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
Total <%= plugins.gists.totalCount %> gist<%= s(plugins.gists.totalCount) %>
|
||||
-r-- <b><%= `${plugins.gists.stargazers}`.padStart(5) %></b> stargazer<%= s(plugins.gists.stargazers) %>
|
||||
-r-- <b><%= `${plugins.gists.forks}`.padStart(5) %></b> fork<%= s(plugins.gists.forks) %>
|
||||
</div><% } -%>
|
||||
<%# ============================================================= -%>
|
||||
<% if (plugins.languages) { %>
|
||||
<div class="stdin"><%- meta.$ %> locale</div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
<% if (plugins.languages.error) { -%>
|
||||
<span class="error"><%= plugins.languages.error.message %></span><%# -%>
|
||||
<% } else { for (const {name, value} of plugins.languages.favorites) { -%>
|
||||
<b><%= name.toLocaleUpperCase().padEnd(12) %></b> [<%= "#".repeat(Math.ceil(100*value/5)).padEnd(20) %>] <%= (100*value).toFixed(2).padEnd(5) %>%
|
||||
<% }} -%>
|
||||
</div><% } -%>
|
||||
<%# ============================================================= -%>
|
||||
<% if (plugins.pagespeed) { %>
|
||||
<div class="stdin"><%- meta.$ %> curl -<%= plugins.pagespeed.detailed ? "v" : "" %>I <%= plugins.pagespeed.url %></div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
<% if (plugins.pagespeed.error) { -%>
|
||||
<span class="error"><%= plugins.pagespeed.error.message %></span><% } else { -%>
|
||||
<b>User-Agent</b>: Google PageSpeed API
|
||||
<b>Location</b>: <%= plugins.pagespeed.url %>
|
||||
<% for (const {score, title} of plugins.pagespeed.scores) { -%>
|
||||
<b><%= `X-${title.replace(/ /g, "-")}` %></b>: <%= !Number.isNaN(score) ? Math.round(score*100) : "-" %>%
|
||||
<% } -%>
|
||||
<% if (plugins.pagespeed.detailed) { for (const {name, score, suffix = "", threshold} of [
|
||||
{name:"Time to interactive", score:plugins.pagespeed.metrics.interactive/1000, suffix:"s", threshold:[3.785, 7.3]},
|
||||
{name:"Speed Index", score:plugins.pagespeed.metrics.speedIndex/1000, suffix:"s", threshold:[3.387, 5.8]},
|
||||
{name:"Total Blocking Time", score:plugins.pagespeed.metrics.totalBlockingTime/1000, suffix:"s", threshold:[.287, .6]},
|
||||
{name:"First Contentful Paint", score:plugins.pagespeed.metrics.firstContentfulPaint/1000, suffix:"s", threshold:[2.336, 4]},
|
||||
{name:"Largest Contentful Paint", score:plugins.pagespeed.metrics.largestContentfulPaint/1000, suffix:"s", threshold:[2.5, 4]},
|
||||
{name:"Cumulative Layout Shift", score:+plugins.pagespeed.metrics.cumulativeLayoutShift, threshold:[.1, .25]}
|
||||
]) { -%>
|
||||
<b>> <%= name %></b>: <%= !Number.isNaN(score) ? score : "-" %><%= suffix %> <% if (Number.isNaN(score)) { %><% } else if (score <= threshold[0]) { %>(ok +)<% } else if (score <= threshold[1]) { %>(ok)<% } else { %>(bad)<% } %>
|
||||
<% }}} -%>
|
||||
</div><% } -%>
|
||||
<%# ============================================================= -%>
|
||||
<% for (const partial of [...partials]) { %><%- await include(`partials/${partial}.ejs`); %><% } -%>
|
||||
<% if (base.metadata) { -%>
|
||||
|
||||
<footer>Connection reset by <%= Math.floor(256*Math.random()) %>.<%= Math.floor(256*Math.random()) %>.<%= Math.floor(256*Math.random()) %>.<%= Math.floor(256*Math.random()) %></footer><%# -%>
|
||||
|
||||
|
Before Width: | Height: | Size: 9.3 KiB After Width: | Height: | Size: 2.2 KiB |
8
source/templates/terminal/partials/_.json
Normal file
8
source/templates/terminal/partials/_.json
Normal file
@@ -0,0 +1,8 @@
|
||||
[
|
||||
"base.header",
|
||||
"base.activity+community",
|
||||
"base.repositories",
|
||||
"gists",
|
||||
"languages",
|
||||
"pagespeed"
|
||||
]
|
||||
@@ -0,0 +1,22 @@
|
||||
<% if ((base.activity)||(base.community)) { %>
|
||||
<div class="stdin"><%- meta.$ %> git status</div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
<% if (base.activity) { -%>
|
||||
<b>Recent activity</b>
|
||||
<b><%= `${computed.commits}`.padStart(5) %></b> commit<%= s(computed.commits) %>
|
||||
<b><%= `${user.contributionsCollection.totalPullRequestReviewContributions}`.padStart(5) %></b> pull request<%= s(user.contributionsCollection.totalPullRequestReviewContributions) %> reviewed
|
||||
<b><%= `${user.contributionsCollection.totalPullRequestContributions}`.padStart(5) %></b> pull request<%= s(user.contributionsCollection.totalPullRequestContributions) %> opened
|
||||
<b><%= `${user.contributionsCollection.totalIssueContributions}`.padStart(5) %></b> issue<%= s(user.contributionsCollection.totalIssueContributions) %> opened
|
||||
<b><%= `${user.issueComments.totalCount}`.padStart(5) %></b> issue comment<%= s(user.issueComments.totalCount) %>
|
||||
<% } -%>
|
||||
<% if ((base.activity)&&(base.community)) { -%>
|
||||
|
||||
<% } -%>
|
||||
<% if (base.community) { -%>
|
||||
<b>Tracked activity</b>
|
||||
<b><%= `${user.following.totalCount}`.padStart(5) %></b> user<%= s(user.followers.totalCount) %> followed
|
||||
<b><%= `${user.sponsorshipsAsSponsor.totalCount}`.padStart(5) %></b> repositor<%= s(user.sponsorshipsAsSponsor.totalCount, "y") %> sponsored
|
||||
<b><%= `${user.starredRepositories.totalCount}`.padStart(5) %></b> repositor<%= s(user.starredRepositories.totalCount, "y") %> starred
|
||||
<b><%= `${user.watching.totalCount}`.padStart(5) %></b> repositor<%= s(user.watching.totalCount, "y") %> watched
|
||||
<% } -%>
|
||||
</div><% } -%>
|
||||
7
source/templates/terminal/partials/base.header.ejs
Normal file
7
source/templates/terminal/partials/base.header.ejs
Normal file
@@ -0,0 +1,7 @@
|
||||
<% if (base.header) { %>
|
||||
<div class="stdin"><%- meta.$ %> whoami</div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
<b><%= user.name || user.login %></b> registered=<%= computed.registration.match(/^.+? [ym]/)[0].replace(/ /g, "") %>, uid=<%= `${user.databaseId}`.substr(-4) %>, gid=<%= user.organizations.totalCount %>
|
||||
contributed to <%= user.repositoriesContributedTo.totalCount %> repositor<%= s(user.repositoriesContributedTo.totalCount, "y") %> <b><% for (const [x, {color}] of Object.entries(computed.calendar)) { -%><span style="color:<%= color %>">#</span><% } %></b>
|
||||
followed by <b><%= user.followers.totalCount %></b> user<%= s(user.followers.totalCount) %>
|
||||
</div><% } -%>
|
||||
33
source/templates/terminal/partials/base.repositories.ejs
Normal file
33
source/templates/terminal/partials/base.repositories.ejs
Normal file
@@ -0,0 +1,33 @@
|
||||
<% if (base.repositories) { %>
|
||||
<div class="stdin"><%- meta.$ %> ls -lh github/repositories</div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
Total <%= user.repositories.totalCount %> repositor<%= s(user.repositories.totalCount, "y") %> - <%= computed.diskUsage %>
|
||||
<% if (plugins.traffic) { if (plugins.traffic.error) { -%>
|
||||
---- <b> </b> views <span class="error">(<%= plugins.traffic.error.message %>)</span>
|
||||
<% } else { -%>
|
||||
-r-- <b><%= `${plugins.traffic.views.count}`.padStart(5) %></b> views
|
||||
<% }} -%>
|
||||
-r-- <b><%= `${computed.repositories.stargazers}`.padStart(5) %></b> stargazer<%= s(computed.repositories.stargazers) %>
|
||||
-r-- <b><%= `${computed.repositories.forks}`.padStart(5) %></b> fork<%= s(computed.repositories.forks) %>
|
||||
-r-- <b><%= `${computed.repositories.watchers}`.padStart(5) %></b> watcher<%= s(computed.repositories.watchers) %>
|
||||
dr-x <b><%= `${user.packages.totalCount}`.padStart(5) %></b> package<%= s(user.packages.totalCount) %>
|
||||
<% if (plugins.followup) { if (plugins.followup.error) { -%>
|
||||
d--- <b> </b> ISSUES <span class="error">(<%= plugins.followup.error.message %>)</span>
|
||||
d--- <b> </b> PULL_REQUESTS <span class="error">(<%= plugins.followup.error.message %>)</span>
|
||||
<% } else { -%>
|
||||
dr-x <b><%= `${plugins.followup.issues.count}`.padStart(5) %></b> ISSUES
|
||||
-r-- <b><%= `${plugins.followup.issues.open}`.padStart(5) %></b> ├── open
|
||||
-r-- <b><%= `${plugins.followup.issues.closed}`.padStart(5) %></b> └── closed
|
||||
dr-x <b><%= `${plugins.followup.issues.count}`.padStart(5) %></b> PULL_REQUESTS
|
||||
-r-- <b><%= `${plugins.followup.pr.open}`.padStart(5) %></b> ├── open
|
||||
-r-- <b><%= `${plugins.followup.pr.merged}`.padStart(5) %></b> └── merged
|
||||
<% }} -%>
|
||||
<% if (computed.licenses.favorite.length) { -%>
|
||||
dr-x LICENSE
|
||||
-r-- └── <%= computed.licenses.favorite %>
|
||||
<% } -%>
|
||||
<% if (plugins.lines) { if (plugins.lines.error) { %>
|
||||
<span class="diff error">@@ <%= plugins.lines.error.message %> @@</span><% } else { %>
|
||||
<span class="diff">@@ -<%= plugins.lines.deleted %> +<%= plugins.lines.added %> @@</span>
|
||||
<% }} -%>
|
||||
</div><% } -%>
|
||||
7
source/templates/terminal/partials/gists.ejs
Normal file
7
source/templates/terminal/partials/gists.ejs
Normal file
@@ -0,0 +1,7 @@
|
||||
<% if (plugins.gists) { %>
|
||||
<div class="stdin"><%- meta.$ %> ls -lh github/gists</div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
Total <%= plugins.gists.totalCount %> gist<%= s(plugins.gists.totalCount) %>
|
||||
-r-- <b><%= `${plugins.gists.stargazers}`.padStart(5) %></b> stargazer<%= s(plugins.gists.stargazers) %>
|
||||
-r-- <b><%= `${plugins.gists.forks}`.padStart(5) %></b> fork<%= s(plugins.gists.forks) %>
|
||||
</div><% } -%>
|
||||
9
source/templates/terminal/partials/languages.ejs
Normal file
9
source/templates/terminal/partials/languages.ejs
Normal file
@@ -0,0 +1,9 @@
|
||||
<% if (plugins.languages) { %>
|
||||
<div class="stdin"><%- meta.$ %> locale</div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
<% if (plugins.languages.error) { -%>
|
||||
<span class="error"><%= plugins.languages.error.message %></span><%# -%>
|
||||
<% } else { for (const {name, value} of plugins.languages.favorites) { -%>
|
||||
<b><%= name.toLocaleUpperCase().padEnd(12) %></b> [<%= "#".repeat(Math.ceil(100*value/5)).padEnd(20) %>] <%= (100*value).toFixed(2).padEnd(5) %>%
|
||||
<% }} -%>
|
||||
</div><% } -%>
|
||||
21
source/templates/terminal/partials/pagespeed.ejs
Normal file
21
source/templates/terminal/partials/pagespeed.ejs
Normal file
@@ -0,0 +1,21 @@
|
||||
<% if (plugins.pagespeed) { %>
|
||||
<div class="stdin"><%- meta.$ %> curl -<%= plugins.pagespeed.detailed ? "v" : "" %>I <%= plugins.pagespeed.url %></div><%# -%>
|
||||
<div class="stdout"><%# -%>
|
||||
<% if (plugins.pagespeed.error) { -%>
|
||||
<span class="error"><%= plugins.pagespeed.error.message %></span><% } else { -%>
|
||||
<b>User-Agent</b>: Google PageSpeed API
|
||||
<b>Location</b>: <%= plugins.pagespeed.url %>
|
||||
<% for (const {score, title} of plugins.pagespeed.scores) { -%>
|
||||
<b><%= `X-${title.replace(/ /g, "-")}` %></b>: <%= !Number.isNaN(score) ? Math.round(score*100) : "-" %>%
|
||||
<% } -%>
|
||||
<% if (plugins.pagespeed.detailed) { for (const {name, score, suffix = "", threshold} of [
|
||||
{name:"Time to interactive", score:plugins.pagespeed.metrics.interactive/1000, suffix:"s", threshold:[3.785, 7.3]},
|
||||
{name:"Speed Index", score:plugins.pagespeed.metrics.speedIndex/1000, suffix:"s", threshold:[3.387, 5.8]},
|
||||
{name:"Total Blocking Time", score:plugins.pagespeed.metrics.totalBlockingTime/1000, suffix:"s", threshold:[.287, .6]},
|
||||
{name:"First Contentful Paint", score:plugins.pagespeed.metrics.firstContentfulPaint/1000, suffix:"s", threshold:[2.336, 4]},
|
||||
{name:"Largest Contentful Paint", score:plugins.pagespeed.metrics.largestContentfulPaint/1000, suffix:"s", threshold:[2.5, 4]},
|
||||
{name:"Cumulative Layout Shift", score:+plugins.pagespeed.metrics.cumulativeLayoutShift, threshold:[.1, .25]}
|
||||
]) { -%>
|
||||
<b>> <%= name %></b>: <%= !Number.isNaN(score) ? score : "-" %><%= suffix %> <% if (Number.isNaN(score)) { %><% } else if (score <= threshold[0]) { %>(ok +)<% } else if (score <= threshold[1]) { %>(ok)<% } else { %>(bad)<% } %>
|
||||
<% }}} -%>
|
||||
</div><% } -%>
|
||||
Reference in New Issue
Block a user