github-stats-box
Advanced tools
Comparing version 0.1.2 to 0.2.0
@@ -7,2 +7,3 @@ #!/usr/bin/env node | ||
const { userInfoFetcher, totalCommitsFetcher } = require('./fetch'); | ||
const numeral = require('numeral'); | ||
@@ -12,2 +13,3 @@ const gistId = process.env.GIST_ID; | ||
const countAllCommits = process.env.ALL_COMMITS.toString() === 'true'; | ||
const kFormat = process.env.K_FORMAT.toString() === 'true'; | ||
@@ -60,3 +62,3 @@ async function main() { | ||
async function updateGist(stats) { | ||
const humanize = (n) => (n > 999 ? (n / 1000).toFixed(1) + 'k' : n); | ||
const humanize = (n) => (n >= 1000 ? numeral(n).format(kFormat ? '0.0a' : '0,0') : n); | ||
@@ -66,3 +68,3 @@ const gistContent = | ||
['⭐', `Total Stars`, humanize(stats.totalStars)], | ||
['➕', countAllCommits ? 'Total Commits' : 'Past Year Commits', humanize(stats.totalCommits)], | ||
['✔️', countAllCommits ? 'Total Commits' : 'Past Year Commits', humanize(stats.totalCommits)], | ||
['🔀', `Total PRs`, humanize(stats.totalPRs)], | ||
@@ -69,0 +71,0 @@ ['🚩', `Total Issues`, humanize(stats.totalIssues)], |
{ | ||
"name": "github-stats-box", | ||
"version": "0.1.2", | ||
"version": "0.2.0", | ||
"description": "Update a gist to contain your GitHub stats", | ||
@@ -26,3 +26,4 @@ "author": "bokub", | ||
"axios": "^0.19.2", | ||
"dotenv": "8.2.0" | ||
"dotenv": "8.2.0", | ||
"numeral": "^2.0.6" | ||
}, | ||
@@ -29,0 +30,0 @@ "devDependencies": { |
@@ -29,3 +29,4 @@ <p align="center"> | ||
- **ALL_COMMITS:** Boolean value, If `true` it will count all commits instead of last year commits | ||
- **K_FORMAT:** Boolean value, If `true`, large numbers values will be formatted with a "k", for example `1.5k` | ||
That's it! You gist will be updated immediately, and every hour after that |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
9226
147
32
4
5
+ Addednumeral@^2.0.6
+ Addednumeral@2.0.6(transitive)