-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathexample.js
More file actions
20 lines (18 loc) · 777 Bytes
/
example.js
File metadata and controls
20 lines (18 loc) · 777 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const repos = require('.')
const packages = require('all-the-package-names')
const urls = Object.values(repos)
const github = urls.filter(url => (/github\.com/i).test(url))
const bitbucket = urls.filter(url => (/bitbucket\.org/i).test(url))
const gitlab = urls.filter(url => (/gitlab\.com/i).test(url))
function percentage (collection) {
return (collection.length / packages.length * 100).toFixed(2) + '%'
}
console.log(`
Packages | Count | Percentage of Total Packages
---- | ----- | ----------
All | ${packages.length} | 100%
With repository in package.json | ${urls.length} | ${percentage(urls)}
On GitHub | ${github.length} | ${percentage(github)}
On BitBucket | ${bitbucket.length} | ${percentage(bitbucket)}
On GitLab | ${gitlab.length} | ${percentage(gitlab)}
`)