@pkgjs/statusboard 0.1.2 → 0.1.4

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/README.md CHANGED
@@ -10,22 +10,10 @@ This repository is managed by the [Package Maintenance Working Group](https://gi
10
10
 
11
11
  ## Example
12
12
 
13
- https://expressjs.github.io/statusboard/
13
+ Example statusboards using `@pkgjs/statusboard`:
14
14
 
15
- ## TODO
15
+ - <https://expressjs.github.io/statusboard/> - [Github](https://github.com/expressjs/statusboard)
16
16
 
17
- - Cli logger
18
- - ~~Pull commit activity~~
19
- - ~~Clean up template~~
20
- - `create` command to setup a new project
21
- - ~~GH actions for building/publishing ([see express](https://github.com/expressjs/statusboard/blob/1de8da96746deb1952ecc0c22427f81083e022c9/.github/workflows/build.yml))~~ https://github.com/pkgjs/gh-pages
22
- - Contribution graph like on github
23
- - Meetings page (pull tag "meeting")
24
- - ~~Orginizations (pull all repos from an org)~~
25
- - Typescript support (load typings or if authored in TS)
26
- - People/Teams (specify and display teams, for example the express TC)
27
- - GH CI status
28
- - Pinned projects
29
17
 
30
18
  ## Setup
31
19
 
@@ -65,3 +53,14 @@ $ npm run build
65
53
  # commit and push the branches now
66
54
  $ cd build && git add . && git commit -m "our new statuspage" && git push
67
55
  ```
56
+
57
+ ## TODO
58
+
59
+ - Cli logger
60
+ - `create` command to setup a new project
61
+ - Contribution graph like on github
62
+ - Meetings page (pull tag "meeting")
63
+ - Typescript support (load typings or if authored in TS)
64
+ - People/Teams (specify and display teams, for example the express TC)
65
+ - GH CI status
66
+ - Pinned projects
package/lib/config.js CHANGED
@@ -17,6 +17,8 @@ const DEFAULTS = {
17
17
  port: 5005,
18
18
  template: builder,
19
19
  indicies,
20
+ bots: true,
21
+ head: [],
20
22
  title: 'StatusBoard',
21
23
  description: 'Project StatusBoard',
22
24
  issueLabels: ['top priority', 'good first issue', 'help wanted', 'discussion', 'meeting']
@@ -39,6 +41,10 @@ class Config {
39
41
  // All the dynamic stuff for a project
40
42
  this.title = opts.title || DEFAULTS.title
41
43
  this.description = opts.description || DEFAULTS.description
44
+ this.head = opts.head || DEFAULTS.head
45
+
46
+ // Include bots in stats
47
+ this.bots = opts.bots === undefined ? DEFAULTS.bots : opts.bots
42
48
 
43
49
  // Orgs
44
50
  this.orgs = (opts.orgs || [])
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pkgjs/statusboard",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "A dashboard for project status",
5
5
  "author": "Wes Todd <wes@wesleytodd.com>",
6
6
  "keywords": [
@@ -9,6 +9,12 @@
9
9
  "badges",
10
10
  "express"
11
11
  ],
12
+ "files": [
13
+ "template",
14
+ "bin",
15
+ "index.js",
16
+ "lib"
17
+ ],
12
18
  "license": "MIT",
13
19
  "main": "index.js",
14
20
  "repository": {
@@ -46,7 +52,7 @@
46
52
  "dotenv": "^17.2.0",
47
53
  "es5-lit-element": "^2.2.1",
48
54
  "es5-lit-html": "^1.1.1",
49
- "express": "^4.17.1",
55
+ "express": "^5.2.1",
50
56
  "fs-extra": "^8.1.0",
51
57
  "inquirer": "^12.4.2",
52
58
  "install": "^0.13.0",
@@ -5,11 +5,18 @@
5
5
  <title><%= title %></title>
6
6
  <meta name="description" content="<%= description %>">
7
7
  <meta name="viewport" content="width=device-width, initial-scale=1">
8
-
9
- <!-- <link rel="manifest" href="site.webmanifest"> -->
10
- <!-- <link rel="apple-touch-icon" href="icon.png"> -->
8
+ <meta name="robots" content="index, follow" />
9
+ <meta name="googlebot" content="index, follow" />
11
10
  <meta name="theme-color" content="#fafafa">
12
- <!-- Place favicon.ico in the root directory -->
11
+
12
+ <meta property="og:type" content="website" />
13
+ <meta property="og:title" content="<%= title %>" />
14
+ <meta property="og:description" content="<%= description %>" />
15
+
16
+ <meta name="twitter:title" content="<%= title %>" />
17
+ <meta name="twitter:description" content="<%= description %>" />
18
+
19
+ <%- head.join('\n') %>
13
20
 
14
21
  <link href="<%= files.css.index %>" rel="stylesheet" />
15
22
  <script>
@@ -17,6 +24,7 @@
17
24
  title: "<%= title %>",
18
25
  description: "<%= description %>",
19
26
  baseUrl: "<%= baseUrl %>",
27
+ bots: <%= bots %>,
20
28
  issueLabels: <%- JSON.stringify(issueLabels) %>,
21
29
  projects: <%- JSON.stringify(projects) %>,
22
30
  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}">
@@ -1,53 +0,0 @@
1
- name: Generate Statusboard
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- workflow_dispatch:
8
-
9
- permissions:
10
- contents: read
11
- pages: write
12
- id-token: write
13
-
14
- concurrency:
15
- group: "pages"
16
- cancel-in-progress: false
17
-
18
- jobs:
19
- index:
20
- environment:
21
- name: github-pages
22
- url: ${{ steps.deployment.outputs.page_url }}
23
- runs-on: ubuntu-latest
24
- steps:
25
- - name: Checkout
26
- uses: actions/checkout@v4
27
- - name: Setup Pages
28
- uses: actions/configure-pages@v5
29
- - uses: actions/setup-node@v4
30
- with:
31
- node-version: 20
32
- - uses: actions/cache@v4
33
- id: cache
34
- with:
35
- path: |
36
- ~/.npm
37
- ~/.cache
38
- ./dist
39
- ./node_modules
40
- key: ${{ runner.os }}-build-${{ github.sha }}
41
- - if: steps.cache.outputs.cache-hit != 'true'
42
- run: npm install
43
- shell: bash
44
- - run: npm run build
45
- env:
46
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47
- - name: Upload artifact
48
- uses: actions/upload-pages-artifact@v3
49
- with:
50
- path: './gh-pages'
51
- - name: Deploy to GitHub Pages
52
- id: deployment
53
- uses: actions/deploy-pages@v4
@@ -1,51 +0,0 @@
1
- name: Run Tests
2
-
3
- on:
4
- push:
5
- branches:
6
- - main
7
- pull_request:
8
- branches:
9
- - main
10
-
11
- concurrency:
12
- group: "${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
13
- cancel-in-progress: false
14
-
15
- jobs:
16
- lint:
17
- name: Lint
18
- runs-on: ubuntu-latest
19
- steps:
20
- - uses: actions/checkout@v4
21
- - name: Setup Node.js
22
- uses: actions/setup-node@v4
23
- with:
24
- node-version: 'lts/*'
25
-
26
- - name: Install dependencies
27
- run: npm install --ignore-scripts --only=dev
28
-
29
- - name: Run lint
30
- run: npm run lint
31
-
32
- test:
33
- runs-on: ubuntu-latest
34
- strategy:
35
- matrix:
36
- node-version: [18, 19, 20, 21, 22, 23]
37
- steps:
38
- - uses: actions/checkout@v4
39
-
40
- - name: Use Node.js ${{ matrix.node-version }}
41
- uses: actions/setup-node@v4
42
- with:
43
- node-version: ${{ matrix.node-version }}
44
-
45
- - name: Install dependencies
46
- run: npm install
47
-
48
- - name: Run tests
49
- env:
50
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51
- run: npm test
package/.nojekyll DELETED
File without changes
@@ -1,4 +0,0 @@
1
- # Code of Conduct
2
-
3
- The Node.js Code of Conduct, which applies to this project, can be found at
4
- https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md.
package/CONTRIBUTING.md DELETED
@@ -1,36 +0,0 @@
1
- # Contributing
2
-
3
- ## Code of Conduct
4
-
5
- The Node.js project has a
6
- [Code of Conduct](https://github.com/nodejs/admin/blob/master/CODE_OF_CONDUCT.md)
7
- to which all contributors must adhere.
8
-
9
- See [details on our policy on Code of Conduct](https://github.com/nodejs/node/blob/master/doc/guides/contributing/code-of-conduct.md).
10
-
11
- <a id="developers-certificate-of-origin"></a>
12
- ## Developer's Certificate of Origin 1.1
13
-
14
- By making a contribution to this project, I certify that:
15
-
16
- * (a) The contribution was created in whole or in part by me and I
17
- have the right to submit it under the open source license
18
- indicated in the file; or
19
-
20
- * (b) The contribution is based upon previous work that, to the best
21
- of my knowledge, is covered under an appropriate open source
22
- license and I have the right under that license to submit that
23
- work with modifications, whether created in whole or in part
24
- by me, under the same open source license (unless I am
25
- permitted to submit under a different license), as indicated
26
- in the file; or
27
-
28
- * (c) The contribution was provided directly to me by some other
29
- person who certified (a), (b) or (c) and I have not modified
30
- it.
31
-
32
- * (d) I understand and agree that this project and the contribution
33
- are public and that a record of the contribution (including all
34
- personal information I submit with it, including my sign-off) is
35
- maintained indefinitely and may be redistributed consistent with
36
- this project or the open source license(s) involved.
@@ -1,37 +0,0 @@
1
- 'use strict'
2
- const path = require('path')
3
-
4
- module.exports = {
5
- db: path.join(__dirname, 'tmp', 'data.db'),
6
- baseUrl: '/statusboard',
7
- outputDirectory: path.join(__dirname, 'tmp'),
8
- github: {
9
- token: process.env.GITHUB_TOKEN
10
- },
11
-
12
- title: 'StatusBoard Test',
13
- description: 'A test for StatusBoard',
14
-
15
- orgs: [
16
- 'pkgjs'
17
- ],
18
-
19
- projects: [
20
- 'nodejs/package-maintenance',
21
- {
22
- name: 'Express StatusBoard',
23
- repo: 'expressjs/statusboard'
24
- }
25
- ],
26
-
27
- people: [
28
- {
29
- name: 'Wes Todd',
30
- email: 'wes@wesleytodd.com',
31
- website: 'http://www.github.com/wesleytodd',
32
- npmUsername: 'wesleytodd',
33
- githubUsername: 'wesleytodd',
34
- twitterUsername: 'wesleytodd'
35
- }
36
- ]
37
- }
package/test/index.js DELETED
@@ -1,68 +0,0 @@
1
- 'use strict'
2
- require('dotenv').config()
3
- const { suite, test, before } = require('mocha')
4
- const assert = require('assert')
5
- const fs = require('fs-extra')
6
- const pkg = require('../package.json')
7
- const statusboard = require('../')
8
-
9
- // These tests require a github token
10
- assert(process.env.GITHUB_TOKEN, `
11
- Tests require GITHUB_TOKEN to be a valid GitHub personal token.
12
- See: https://help.github.com/en/articles/creating-a-personal-access-token-for-the-command-line
13
-
14
- Then run:
15
-
16
- $ echo "GITHUB_TOKEN=<your token>" > .env
17
- `)
18
-
19
- const CONFIG = require('./fixtures/config')
20
- suite(pkg.name, () => {
21
- before(async () => {
22
- await fs.remove(CONFIG.outputDirectory)
23
- })
24
-
25
- test('Configure a statusboard instance', async () => {
26
- const board = await statusboard(CONFIG)
27
- assert.strictEqual(board.config.db, CONFIG.db)
28
- assert.strictEqual(board.config.outputDirectory, CONFIG.outputDirectory)
29
- assert.strictEqual(board.config.baseUrl, CONFIG.baseUrl)
30
- assert.strictEqual(board.config.title, CONFIG.title)
31
- assert.strictEqual(board.config.description, CONFIG.description)
32
-
33
- assert.strictEqual(board.config.orgs.length, CONFIG.orgs.length)
34
- assert.strictEqual(board.config.orgs[0].name, CONFIG.orgs[0])
35
-
36
- assert.strictEqual(board.config.projects.length, CONFIG.projects.length)
37
-
38
- assert.strictEqual(board.config.projects[0].name, CONFIG.projects[0])
39
- assert.strictEqual(board.config.projects[0].repo, CONFIG.projects[0])
40
- assert.strictEqual(board.config.projects[0].repoOwner, CONFIG.projects[0].split('/')[0])
41
- assert.strictEqual(board.config.projects[0].repoName, CONFIG.projects[0].split('/')[1])
42
-
43
- assert.strictEqual(board.config.projects[1].name, CONFIG.projects[1].name)
44
- assert.strictEqual(board.config.projects[1].repo, CONFIG.projects[1].repo)
45
- assert.strictEqual(board.config.projects[1].repoOwner, CONFIG.projects[1].repo.split('/')[0])
46
- assert.strictEqual(board.config.projects[1].repoName, CONFIG.projects[1].repo.split('/')[1])
47
-
48
- assert(board.config.issueLabels.length > 0)
49
- assert.strictEqual(board.config.people.length, CONFIG.people.length)
50
-
51
- // Check exposed interface a little
52
- assert.strictEqual(typeof board.buildIndex, 'function')
53
- assert.strictEqual(typeof board.buildSite, 'function')
54
- assert.strictEqual(typeof board.close, 'function')
55
- })
56
-
57
- test('Building the statusboard index', async function () {
58
- this.timeout(0)
59
- const board = await statusboard(CONFIG)
60
- await board.buildIndex()
61
- })
62
-
63
- test('should build a web page from a template', async function () {
64
- this.timeout(0)
65
- const board = await statusboard(CONFIG)
66
- await board.buildSite()
67
- })
68
- })