@pkgjs/statusboard 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/config.js CHANGED
@@ -17,6 +17,7 @@ const DEFAULTS = {
17
17
  port: 5005,
18
18
  template: builder,
19
19
  indicies,
20
+ bots: true,
20
21
  title: 'StatusBoard',
21
22
  description: 'Project StatusBoard',
22
23
  issueLabels: ['top priority', 'good first issue', 'help wanted', 'discussion', 'meeting']
@@ -40,6 +41,9 @@ class Config {
40
41
  this.title = opts.title || DEFAULTS.title
41
42
  this.description = opts.description || DEFAULTS.description
42
43
 
44
+ // Include bots in stats
45
+ this.bots = opts.bots === undefined ? DEFAULTS.bots : opts.bots
46
+
43
47
  // Orgs
44
48
  this.orgs = (opts.orgs || [])
45
49
  .map((org) => new Organization(org))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pkgjs/statusboard",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "A dashboard for project status",
5
5
  "author": "Wes Todd <wes@wesleytodd.com>",
6
6
  "keywords": [
@@ -46,7 +46,7 @@
46
46
  "dotenv": "^17.2.0",
47
47
  "es5-lit-element": "^2.2.1",
48
48
  "es5-lit-html": "^1.1.1",
49
- "express": "^4.17.1",
49
+ "express": "^5.2.1",
50
50
  "fs-extra": "^8.1.0",
51
51
  "inquirer": "^12.4.2",
52
52
  "install": "^0.13.0",
@@ -17,6 +17,7 @@
17
17
  title: "<%= title %>",
18
18
  description: "<%= description %>",
19
19
  baseUrl: "<%= baseUrl %>",
20
+ bots: <%= bots %>,
20
21
  issueLabels: <%- JSON.stringify(issueLabels) %>,
21
22
  projects: <%- JSON.stringify(projects) %>,
22
23
  files: <%- JSON.stringify(files) %>
@@ -46,11 +46,25 @@ require('nighthawk')({
46
46
  next()
47
47
  })
48
48
  .get('/', fetchIssues({ limit: 3 }), async (req, res) => {
49
- // Turn user activity into a orderd list of 20
49
+ // Turn user activity into an ordered list of 20
50
50
  const userActivity = await (await fetch(`${config.baseUrl}/data/userActivity.json`)).json()
51
- const u = Object.values(userActivity).sort((v1, v2) => {
52
- return v1.activityCount < v2.activityCount ? 1 : v1.activityCount === v2.activityCount ? 0 : -1
53
- }).slice(0, 20)
51
+ const u = Object.values(userActivity)
52
+ .filter(user => {
53
+ if (!config.bots && user?.type) {
54
+ return user.type !== 'Bot'
55
+ }
56
+
57
+ // Because the GitHub API doesn’t return a type for the Dependabot account
58
+ else if (!config.bots && user.login && user.login.endsWith('[bot]')) {
59
+ return false
60
+ }
61
+
62
+ return true
63
+ })
64
+ .sort((v1, v2) => {
65
+ return v1.activityCount < v2.activityCount ? 1 : v1.activityCount === v2.activityCount ? 0 : -1
66
+ })
67
+ .slice(0, 20)
54
68
 
55
69
  render(html`
56
70
  <statusboard-page .config="${config}">