@pkgjs/statusboard 0.1.1 → 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))
@@ -112,26 +112,6 @@ async function * loadProject (octokit, graphQL, project, config, _repo) {
112
112
  }
113
113
  }
114
114
 
115
- try {
116
- yield projectDetail(
117
- 'README',
118
- project,
119
- await github.getReadme(graphQL, project.repoOwner, project.repoName, project.primaryBranch)
120
- )
121
- } catch (e) {
122
- yield projectDetail('ERROR', project, e)
123
- }
124
-
125
- try {
126
- yield projectDetail(
127
- 'TRAVIS',
128
- project,
129
- await files.getTravisConfig(project)
130
- )
131
- } catch (e) {
132
- yield projectDetail('ERROR', project, e)
133
- }
134
-
135
115
  try {
136
116
  for await (const issue of github.getRepoIssues(graphQL, project.repoOwner, project.repoName)) {
137
117
  yield projectDetail('ISSUE', project, issue)
package/lib/files.js CHANGED
@@ -1,5 +1,4 @@
1
1
  'use strict'
2
- const yaml = require('js-yaml')
3
2
  const GHRAW = 'https://raw.githubusercontent.com/'
4
3
 
5
4
  module.exports.getPackageJson = async function getPackageJson (project) {
@@ -12,15 +11,3 @@ module.exports.getPackageJson = async function getPackageJson (project) {
12
11
  }
13
12
  return resp.json()
14
13
  }
15
-
16
- module.exports.getTravisConfig = async function getTravisConfig (project) {
17
- const resp = await fetch(`${GHRAW}${project.repoOwner}/${project.repoName}/${project.repoBranch}${project.repoDirectory}.travis.yml`)
18
- if (resp.status !== 200) {
19
- const e = new Error(`Non-200 Response: ${resp.status}`)
20
- e.status = resp.status
21
- e.body = await resp.text()
22
- throw e
23
- }
24
- const travisTxt = await resp.text()
25
- return yaml.safeLoad(travisTxt)
26
- }
package/lib/github.js CHANGED
@@ -343,47 +343,6 @@ async function * getRepoActivity (octokit, owner, repo) {
343
343
  }
344
344
  }
345
345
 
346
- module.exports.getReadme =
347
- async function getReadme (graphQL, owner, repo) {
348
- try {
349
- const resp = await graphQL({
350
- query: ` query($org: String!, $repo: String!) {
351
- repository(name: $repo, owner: $org) {
352
- object(expression: "master:README.md") {
353
- ... on Blob {
354
- text
355
- }
356
- }
357
- altLower: object(expression: "master:readme.md") {
358
- ... on Blob {
359
- text
360
- }
361
- }
362
- altUpper: object(expression: "master:Readme.md") {
363
- ... on Blob {
364
- text
365
- }
366
- }
367
- }
368
- }
369
- `,
370
- org: owner,
371
- repo
372
- })
373
- let readmeText
374
- Object.values(resp.repository).forEach(element => {
375
- if (element !== null) {
376
- readmeText = element.text
377
- }
378
- })
379
- return readmeText
380
- } catch (error) {
381
- error.code = 'GET_README_FAILED'
382
- Error.captureStackTrace(error, module.exports.getReadme)
383
- throw error
384
- }
385
- }
386
-
387
346
  async function getRemainingRepos (graphQL, org, cursor) {
388
347
  try {
389
348
  const resp = await graphQL({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pkgjs/statusboard",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "A dashboard for project status",
5
5
  "author": "Wes Todd <wes@wesleytodd.com>",
6
6
  "keywords": [
@@ -43,14 +43,13 @@
43
43
  "@wesleytodd/buildjs": "0.0.8",
44
44
  "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
45
45
  "cptmpl": "0.0.4",
46
- "dotenv": "^16.4.7",
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",
53
- "js-yaml": "^3.13.1",
54
53
  "level": "^5.0.1",
55
54
  "lit-element": "^2.2.1",
56
55
  "nighthawk": "^2.3.0-1",
@@ -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) %>
@@ -2,7 +2,7 @@
2
2
 
3
3
  module.exports = {
4
4
  projects: async (data, config, key, { type, project, detail }) => {
5
- if (!['REPO', 'PACKAGE_JSON', 'PACKUMENT', 'TRAVIS'].includes(type)) {
5
+ if (!['REPO', 'PACKAGE_JSON', 'PACKUMENT'].includes(type)) {
6
6
  return data
7
7
  }
8
8
 
@@ -10,9 +10,6 @@ module.exports = {
10
10
  const existing = data.find((p) => p.repo === project.repo)
11
11
  const proj = existing || { ...project }
12
12
  switch (type) {
13
- case 'TRAVIS':
14
- proj.travis = detail
15
- break
16
13
  case 'PACKAGE_JSON':
17
14
  proj.packageJson = detail
18
15
  break
@@ -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}">
@@ -71,13 +71,6 @@ class ProjectList extends LitElement {
71
71
  </a>
72
72
  `)}
73
73
  </td>
74
- <td>
75
- ${project.travis && (html`
76
- <a href="https://travis-ci.org/${project.repo}">
77
- <img src="https://badgen.net/travis/${project.repo}" />
78
- </a>
79
- `)}
80
- </td>
81
74
  </tr>
82
75
  `)}
83
76
  </table>