Permalink
Browse files

fix stats table to not rely on all-the-package-names

  • Loading branch information...
zeke committed Dec 24, 2018
1 parent 7aa867e commit 4076959fbdd971ab5d4ccd9d8ea6a50039f55074
Showing with 6 additions and 8 deletions.
  1. +6 −8 scripts/stats.js
@@ -1,19 +1,17 @@
const fs = require('fs')
const path = require('path')
const allNames = require('all-the-package-names').length
const repos = Object.values(require('..'))
const onGitHub = repos.filter(repo => repo.match('://github.com')).length
const onBitBucket = repos.filter(repo => repo.match('://bitbucket.org')).length
const onGitLab = repos.filter(repo => repo.match('://gitlab.com')).length

const output = `<!-- stats -->
Packages | Count | Percentage of Total Packages
-------- | ----- | ----------------------------
Total in npm registry | ${allNames} | 100%
With repository in package.json | ${repos.length} | ${(repos.length / allNames * 100).toFixed(2)}%
On GitHub | ${onGitHub} | ${(onGitHub / allNames * 100).toFixed(2)}%
On BitBucket | ${onBitBucket} | ${(onBitBucket / allNames * 100).toFixed(2)}%
On GitLab | ${onGitLab} | ${(onGitLab / allNames * 100).toFixed(2)}%
Packages | Count | Percentage
-------- | ----- | ----------
With repository in package.json | ${repos.length} | 100%
On GitHub | ${onGitHub} | ${(onGitHub / repos.length * 100).toFixed(2)}%
On BitBucket | ${onBitBucket} | ${(onBitBucket / repos.length * 100).toFixed(2)}%
On GitLab | ${onGitLab} | ${(onGitLab / repos.length * 100).toFixed(2)}%
<!-- /stats -->`

const readmeFile = path.join(__dirname, '../readme.md')

0 comments on commit 4076959

Please sign in to comment.