@pkgjs/statusboard 0.0.13 → 0.1.0
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/.github/workflows/build.yml +47 -10
- package/.github/workflows/test.yml +51 -0
- package/CODE_OF_CONDUCT.md +4 -0
- package/CONTRIBUTING.md +36 -0
- package/LICENSE +10 -13
- package/README.md +3 -0
- package/lib/cli.js +1 -1
- package/lib/config.js +1 -1
- package/lib/db/build-index.js +17 -14
- package/lib/files.js +0 -1
- package/lib/github.js +439 -147
- package/lib/npm.js +3 -3
- package/lib/project.js +1 -1
- package/lib/template/index.js +1 -1
- package/package.json +20 -17
- package/template/indicies.js +3 -3
- package/template/js/index.js +2 -2
- package/template/js/page.js +1 -0
- package/template/js/project-list.js +1 -0
- package/test/fixtures/config.js +1 -0
- package/test/index.js +6 -7
|
@@ -1,16 +1,53 @@
|
|
|
1
|
-
name:
|
|
2
|
-
|
|
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
|
+
|
|
3
18
|
jobs:
|
|
4
|
-
|
|
19
|
+
index:
|
|
20
|
+
environment:
|
|
21
|
+
name: github-pages
|
|
22
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
5
23
|
runs-on: ubuntu-latest
|
|
6
24
|
steps:
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
25
|
+
- name: Checkout
|
|
26
|
+
uses: actions/checkout@v4
|
|
27
|
+
- name: Setup Pages
|
|
28
|
+
uses: actions/configure-pages@v5
|
|
29
|
+
- uses: actions/setup-node@v4
|
|
10
30
|
with:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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
|
|
15
45
|
env:
|
|
16
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
|
|
@@ -0,0 +1,51 @@
|
|
|
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/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
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.
|
package/LICENSE
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
MERCHANTABILITY AND
|
|
10
|
-
|
|
11
|
-
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
|
|
12
|
-
OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
|
|
13
|
-
CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 Contributors https://github.com/pkgjs/statusboard/graphs/contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
10
|
+
|
package/README.md
CHANGED
|
@@ -5,6 +5,9 @@ of GitHub projects. When you have work spread across multiple repos
|
|
|
5
5
|
and multiple orginizations, it is often hard to track things. This
|
|
6
6
|
is what `@pkgjs/statusboard` aims to solve.
|
|
7
7
|
|
|
8
|
+
This repository is managed by the [Package Maintenance Working Group](https://github.com/nodejs/package-maintenance), see [Governance](https://github.com/nodejs/package-maintenance/blob/master/Governance.md).
|
|
9
|
+
|
|
10
|
+
|
|
8
11
|
## Example
|
|
9
12
|
|
|
10
13
|
https://expressjs.github.io/statusboard/
|
package/lib/cli.js
CHANGED
|
@@ -137,7 +137,7 @@ module.exports = (create, builder, argv) => {
|
|
|
137
137
|
// Create the statusboard instance
|
|
138
138
|
const board = await createBoard(create, argv)
|
|
139
139
|
|
|
140
|
-
for await (const {key, value: item} of board.db.createReadStream()) {
|
|
140
|
+
for await (const { key, value: item } of board.db.createReadStream()) {
|
|
141
141
|
let present = false
|
|
142
142
|
board.config.projects.forEach((p) => {
|
|
143
143
|
present = present || item.project.repo === p.repo
|
package/lib/config.js
CHANGED
|
@@ -16,7 +16,7 @@ const DEFAULTS = {
|
|
|
16
16
|
baseUrl: '',
|
|
17
17
|
port: 5005,
|
|
18
18
|
template: builder,
|
|
19
|
-
indicies
|
|
19
|
+
indicies,
|
|
20
20
|
title: 'StatusBoard',
|
|
21
21
|
description: 'Project StatusBoard',
|
|
22
22
|
issueLabels: ['top priority', 'good first issue', 'help wanted', 'discussion', 'meeting']
|
package/lib/db/build-index.js
CHANGED
|
@@ -6,8 +6,8 @@ const { Project } = require('../project')
|
|
|
6
6
|
|
|
7
7
|
module.exports = async function buildIndex (config, db) {
|
|
8
8
|
// Loop projects
|
|
9
|
-
for await (
|
|
10
|
-
|
|
9
|
+
for await (const evt of iterateProjects(config)) {
|
|
10
|
+
const { type, project, detail } = evt
|
|
11
11
|
let key = `${project.repoOwner}:${project.repoName}:${type}`
|
|
12
12
|
switch (type) {
|
|
13
13
|
case 'ISSUE':
|
|
@@ -29,24 +29,24 @@ module.exports = async function buildIndex (config, db) {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
async function * iterateProjects (config) {
|
|
32
|
-
const octokit = await github(config.github)
|
|
32
|
+
const [octokit, graphQL] = await github(config.github)
|
|
33
33
|
|
|
34
34
|
// Load projects
|
|
35
|
-
for (
|
|
36
|
-
for await (
|
|
35
|
+
for (const proj of config.projects) {
|
|
36
|
+
for await (const evt of loadProject(octokit, graphQL, proj, config)) {
|
|
37
37
|
yield evt
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Load projects for org
|
|
42
|
-
for (
|
|
42
|
+
for (const org of config.orgs) {
|
|
43
43
|
try {
|
|
44
|
-
for await (
|
|
44
|
+
for await (const repo of github.getOrgRepos(graphQL, org.name)) {
|
|
45
45
|
const proj = new Project({
|
|
46
46
|
repoOwner: repo.owner,
|
|
47
47
|
repoName: repo.name
|
|
48
48
|
})
|
|
49
|
-
for await (
|
|
49
|
+
for await (const evt of loadProject(octokit, graphQL, proj, config, repo)) {
|
|
50
50
|
yield evt
|
|
51
51
|
}
|
|
52
52
|
}
|
|
@@ -56,17 +56,20 @@ async function * iterateProjects (config) {
|
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
-
async function * loadProject (octokit, project, config, _repo) {
|
|
59
|
+
async function * loadProject (octokit, graphQL, project, config, _repo) {
|
|
60
60
|
// If listed from org we already have the repo
|
|
61
61
|
let repo = _repo
|
|
62
62
|
if (!repo) {
|
|
63
63
|
try {
|
|
64
|
-
repo = await github.getRepo(
|
|
64
|
+
repo = await github.getRepo(graphQL, project.repoOwner, project.repoName)
|
|
65
65
|
} catch (e) {
|
|
66
66
|
yield projectDetail('ERROR', project, e)
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
+
// Check config for repoBranch
|
|
71
|
+
project.repoBranch = project.repoBranch ?? repo.branch
|
|
72
|
+
|
|
70
73
|
let pkg
|
|
71
74
|
try {
|
|
72
75
|
pkg = await files.getPackageJson(project)
|
|
@@ -113,7 +116,7 @@ async function * loadProject (octokit, project, config, _repo) {
|
|
|
113
116
|
yield projectDetail(
|
|
114
117
|
'README',
|
|
115
118
|
project,
|
|
116
|
-
await github.getReadme(
|
|
119
|
+
await github.getReadme(graphQL, project.repoOwner, project.repoName, project.primaryBranch)
|
|
117
120
|
)
|
|
118
121
|
} catch (e) {
|
|
119
122
|
yield projectDetail('ERROR', project, e)
|
|
@@ -130,7 +133,7 @@ async function * loadProject (octokit, project, config, _repo) {
|
|
|
130
133
|
}
|
|
131
134
|
|
|
132
135
|
try {
|
|
133
|
-
for await (
|
|
136
|
+
for await (const issue of github.getRepoIssues(graphQL, project.repoOwner, project.repoName)) {
|
|
134
137
|
yield projectDetail('ISSUE', project, issue)
|
|
135
138
|
}
|
|
136
139
|
} catch (e) {
|
|
@@ -138,7 +141,7 @@ async function * loadProject (octokit, project, config, _repo) {
|
|
|
138
141
|
}
|
|
139
142
|
|
|
140
143
|
try {
|
|
141
|
-
for await (
|
|
144
|
+
for await (const activity of github.getRepoActivity(octokit, project.repoOwner, project.repoName)) {
|
|
142
145
|
yield projectDetail('ACTIVITY', project, activity)
|
|
143
146
|
}
|
|
144
147
|
} catch (e) {
|
|
@@ -146,7 +149,7 @@ async function * loadProject (octokit, project, config, _repo) {
|
|
|
146
149
|
}
|
|
147
150
|
|
|
148
151
|
try {
|
|
149
|
-
for await (
|
|
152
|
+
for await (const commit of github.getRepoCommits(graphQL, project.repoOwner, project.repoName, project.repoBranch)) {
|
|
150
153
|
yield projectDetail('COMMIT', project, commit)
|
|
151
154
|
}
|
|
152
155
|
} catch (e) {
|
package/lib/files.js
CHANGED
package/lib/github.js
CHANGED
|
@@ -1,74 +1,109 @@
|
|
|
1
1
|
'use strict'
|
|
2
2
|
const inquirer = require('inquirer')
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
const { retry } = require('@octokit/plugin-retry')
|
|
4
|
+
const { throttling } = require('@octokit/plugin-throttling')
|
|
5
|
+
const { Octokit } = require('@octokit/rest')
|
|
6
|
+
|
|
7
|
+
const OctokitRest = Octokit
|
|
8
|
+
.plugin(retry, throttling)
|
|
9
|
+
|
|
10
|
+
const { graphql } = require('@octokit/graphql')
|
|
11
|
+
|
|
12
|
+
const repoQuerySnip = `{
|
|
13
|
+
name
|
|
14
|
+
url
|
|
15
|
+
description
|
|
16
|
+
createdAt
|
|
17
|
+
updatedAt
|
|
18
|
+
pushedAt
|
|
19
|
+
stargazers {
|
|
20
|
+
totalCount
|
|
21
|
+
}
|
|
22
|
+
watchers {
|
|
23
|
+
totalCount
|
|
24
|
+
}
|
|
25
|
+
forks {
|
|
26
|
+
totalCount
|
|
27
|
+
}
|
|
28
|
+
issues(states: OPEN) {
|
|
29
|
+
totalCount
|
|
30
|
+
}
|
|
31
|
+
licenseInfo {
|
|
32
|
+
name
|
|
33
|
+
}
|
|
34
|
+
primaryLanguage {
|
|
35
|
+
name
|
|
36
|
+
}
|
|
37
|
+
homepageUrl
|
|
38
|
+
defaultBranchRef {
|
|
39
|
+
name
|
|
40
|
+
}
|
|
41
|
+
}`
|
|
42
|
+
|
|
43
|
+
const issueQuerySnip = `pageInfo {
|
|
44
|
+
hasNextPage
|
|
45
|
+
endCursor
|
|
46
|
+
}
|
|
47
|
+
edges {
|
|
48
|
+
node {
|
|
49
|
+
__typename
|
|
50
|
+
number
|
|
51
|
+
url
|
|
52
|
+
state
|
|
53
|
+
title
|
|
54
|
+
bodyText
|
|
55
|
+
createdAt
|
|
56
|
+
updatedAt
|
|
57
|
+
closedAt
|
|
58
|
+
labels(first: 10) {
|
|
59
|
+
nodes {
|
|
60
|
+
color
|
|
61
|
+
name
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
assignees(first: 1) {
|
|
65
|
+
nodes {
|
|
66
|
+
login
|
|
67
|
+
avatarUrl
|
|
68
|
+
url
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
author {
|
|
72
|
+
login
|
|
73
|
+
url
|
|
74
|
+
avatarUrl
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}`
|
|
7
78
|
|
|
8
79
|
module.exports =
|
|
9
80
|
async function getOctokit (opts = {}) {
|
|
10
81
|
let {
|
|
11
82
|
token,
|
|
12
|
-
username,
|
|
13
|
-
password,
|
|
14
|
-
tfatoken,
|
|
15
83
|
log,
|
|
16
|
-
|
|
84
|
+
onSecondaryRateLimit,
|
|
17
85
|
onRateLimit
|
|
18
86
|
} = opts
|
|
19
87
|
|
|
20
88
|
let prompts = {}
|
|
21
|
-
if (!token
|
|
89
|
+
if (!token) {
|
|
22
90
|
prompts = await inquirer.prompt([{
|
|
23
91
|
name: 'token',
|
|
24
|
-
message: 'Token
|
|
25
|
-
when: !token && !(username && password)
|
|
26
|
-
}, {
|
|
27
|
-
name: 'username',
|
|
28
|
-
message: 'Username:',
|
|
29
|
-
default: username,
|
|
30
|
-
when: !username
|
|
31
|
-
}, {
|
|
32
|
-
name: 'password',
|
|
33
|
-
message: 'Password:',
|
|
34
|
-
type: 'password',
|
|
35
|
-
default: password,
|
|
36
|
-
when: !password
|
|
92
|
+
message: 'Token:'
|
|
37
93
|
}])
|
|
38
94
|
|
|
39
95
|
token = token || prompts.token
|
|
40
|
-
username = username || prompts.username
|
|
41
|
-
password = password || prompts.password
|
|
42
96
|
}
|
|
43
97
|
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
auth = token
|
|
47
|
-
} else if (username && password) {
|
|
48
|
-
auth = {
|
|
49
|
-
username,
|
|
50
|
-
password,
|
|
51
|
-
on2fa: async function on2fa () {
|
|
52
|
-
let { otp } = await inquirer.prompt({
|
|
53
|
-
name: 'otp',
|
|
54
|
-
message: '2FA Token (otp):',
|
|
55
|
-
when: !tfatoken
|
|
56
|
-
})
|
|
57
|
-
// If passed initially, null out so if we need
|
|
58
|
-
// a second tfa token it will be prompted for
|
|
59
|
-
otp = otp || tfatoken
|
|
60
|
-
tfatoken = null
|
|
61
|
-
return otp
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
98
|
+
const auth = token
|
|
99
|
+
const authGraphQL = `token ${token}`
|
|
65
100
|
|
|
66
101
|
log = log || console
|
|
67
102
|
|
|
68
|
-
const octokit =
|
|
103
|
+
const octokit = new OctokitRest({
|
|
69
104
|
auth,
|
|
70
105
|
throttle: {
|
|
71
|
-
|
|
106
|
+
onSecondaryRateLimit: onSecondaryRateLimit || ((err) => {
|
|
72
107
|
log.error(err)
|
|
73
108
|
}),
|
|
74
109
|
onRateLimit: onRateLimit || ((err, options) => {
|
|
@@ -78,7 +113,13 @@ async function getOctokit (opts = {}) {
|
|
|
78
113
|
}
|
|
79
114
|
})
|
|
80
115
|
|
|
81
|
-
|
|
116
|
+
const graphqlWithAuth = graphql.defaults({
|
|
117
|
+
headers: {
|
|
118
|
+
authorization: authGraphQL
|
|
119
|
+
}
|
|
120
|
+
})
|
|
121
|
+
|
|
122
|
+
return [octokit, graphqlWithAuth]
|
|
82
123
|
}
|
|
83
124
|
|
|
84
125
|
const Repo = module.exports.Repo =
|
|
@@ -86,34 +127,40 @@ class Repo {
|
|
|
86
127
|
constructor (owner, repo = {}) {
|
|
87
128
|
this.owner = owner
|
|
88
129
|
this.name = repo.name
|
|
89
|
-
this.url = repo.
|
|
130
|
+
this.url = repo.url
|
|
90
131
|
this.description = repo.description
|
|
91
|
-
this.created = repo.
|
|
92
|
-
this.updated = repo.
|
|
93
|
-
this.pushed = repo.
|
|
94
|
-
this.stars = repo.
|
|
95
|
-
this.watchers = repo.
|
|
96
|
-
this.forks = repo.forks
|
|
97
|
-
this.openIssues = repo.
|
|
98
|
-
this.license = repo.
|
|
99
|
-
this.language = repo.
|
|
100
|
-
this.homepage = repo.
|
|
132
|
+
this.created = repo.createdAt
|
|
133
|
+
this.updated = repo.updatedAt
|
|
134
|
+
this.pushed = repo.pushedAt
|
|
135
|
+
this.stars = repo.stargazers.totalCount
|
|
136
|
+
this.watchers = repo.watchers.totalCount
|
|
137
|
+
this.forks = repo.forks.totalCount
|
|
138
|
+
this.openIssues = repo.issues.totalCount
|
|
139
|
+
this.license = repo.licenseInfo && (repo.licenseInfo.spdx_id || repo.licenseInfo.name)
|
|
140
|
+
this.language = repo.primaryLanguage ? repo.primaryLanguage.name : repo.primaryLanguage
|
|
141
|
+
this.homepage = repo.homepageUrl
|
|
142
|
+
this.branch = repo.defaultBranchRef.name
|
|
101
143
|
}
|
|
102
144
|
}
|
|
103
145
|
|
|
104
146
|
module.exports.getRepo =
|
|
105
|
-
async function getRepo (
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
147
|
+
async function getRepo (graphQL, owner, repo) {
|
|
148
|
+
try {
|
|
149
|
+
const resp = await graphQL({
|
|
150
|
+
query: `query($org: String!, $repo: String!) {
|
|
151
|
+
repository(owner: $org, name: $repo)
|
|
152
|
+
${repoQuerySnip}
|
|
153
|
+
}`,
|
|
154
|
+
org: owner,
|
|
155
|
+
repo
|
|
156
|
+
})
|
|
157
|
+
return new Repo(owner, resp.repository)
|
|
158
|
+
} catch (error) {
|
|
159
|
+
error.code = 'GET_REPO_FAILED'
|
|
160
|
+
Error.captureStackTrace(error, module.exports.getRepo)
|
|
161
|
+
throw error
|
|
162
|
+
}
|
|
163
|
+
}
|
|
117
164
|
|
|
118
165
|
const Issue = module.exports.Issue =
|
|
119
166
|
class Issue {
|
|
@@ -121,55 +168,143 @@ class Issue {
|
|
|
121
168
|
this.owner = owner
|
|
122
169
|
this.repo = repo
|
|
123
170
|
this.number = issue.number
|
|
124
|
-
this.isPullRequest = !!issue.
|
|
125
|
-
this.url = issue.
|
|
171
|
+
this.isPullRequest = !!(issue.__typename === 'PullRequest')
|
|
172
|
+
this.url = issue.url
|
|
126
173
|
this.state = issue.state
|
|
127
174
|
this.title = issue.title
|
|
128
|
-
this.description = issue.
|
|
129
|
-
this.createdAt = issue.
|
|
130
|
-
this.updatedAt = issue.
|
|
131
|
-
this.closedAt = issue.
|
|
132
|
-
this.mergedAt = issue.
|
|
133
|
-
this.labels = issue.labels.map((l) => {
|
|
175
|
+
this.description = issue.bodyText
|
|
176
|
+
this.createdAt = issue.createdAt
|
|
177
|
+
this.updatedAt = issue.updatedAt
|
|
178
|
+
this.closedAt = issue.closedAt
|
|
179
|
+
this.mergedAt = issue.mergedAt
|
|
180
|
+
this.labels = issue.labels.nodes.map((l) => {
|
|
134
181
|
return {
|
|
135
182
|
name: l.name,
|
|
136
183
|
color: l.color
|
|
137
184
|
}
|
|
138
185
|
})
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
url: issue.assignee.html_url
|
|
186
|
+
let assignee = issue.assignees.nodes[0]
|
|
187
|
+
if (!assignee) {
|
|
188
|
+
assignee = null
|
|
143
189
|
}
|
|
144
|
-
this.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
190
|
+
this.assignee = assignee
|
|
191
|
+
this.author = issue.author && {
|
|
192
|
+
login: issue.author.login,
|
|
193
|
+
avatarUrl: issue.author.avatarUrl,
|
|
194
|
+
url: issue.author.url
|
|
148
195
|
}
|
|
149
196
|
}
|
|
150
197
|
}
|
|
151
198
|
|
|
199
|
+
async function getRemainingPullRequests (graphQL, owner, repo, cursor) {
|
|
200
|
+
try {
|
|
201
|
+
const resp = await graphQL({
|
|
202
|
+
query: `query ($org: String!, $repo: String!, $cursor: String!) {
|
|
203
|
+
organization(login: $org) {
|
|
204
|
+
repository(name: $repo) {
|
|
205
|
+
pullRequests(first: 100, after: $cursor, orderBy: {field: CREATED_AT, direction: DESC}) {
|
|
206
|
+
${issueQuerySnip}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
`,
|
|
212
|
+
org: owner,
|
|
213
|
+
repo,
|
|
214
|
+
cursor
|
|
215
|
+
})
|
|
216
|
+
const { pageInfo, edges } = resp.organization.repository.pullRequests
|
|
217
|
+
const pullRequests = !pageInfo.hasNextPage ? edges : edges.concat(await getRemainingPullRequests(graphQL, owner, repo, pageInfo.endCursor))
|
|
218
|
+
return pullRequests
|
|
219
|
+
} catch (error) {
|
|
220
|
+
error.code = 'GET_REPO_PRS_FAILED'
|
|
221
|
+
Error.captureStackTrace(error, module.exports.getRepoIssues)
|
|
222
|
+
throw error
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
async function getPullRequests (graphQL, owner, repo) {
|
|
227
|
+
try {
|
|
228
|
+
const resp = await graphQL({
|
|
229
|
+
query: `query ($org: String!, $repo: String!) {
|
|
230
|
+
organization(login: $org) {
|
|
231
|
+
repository(name: $repo) {
|
|
232
|
+
pullRequests(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {
|
|
233
|
+
${issueQuerySnip}
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
}`,
|
|
238
|
+
org: owner,
|
|
239
|
+
repo
|
|
240
|
+
})
|
|
241
|
+
const { pageInfo, edges } = resp.organization.repository.pullRequests
|
|
242
|
+
const pullRequests = !pageInfo.hasNextPage ? edges : edges.concat(await getRemainingPullRequests(graphQL, owner, repo, pageInfo.endCursor))
|
|
243
|
+
return pullRequests
|
|
244
|
+
} catch (error) {
|
|
245
|
+
error.code = 'GET_REPO_PRS_FAILED'
|
|
246
|
+
Error.captureStackTrace(error, module.exports.getRepoIssues)
|
|
247
|
+
throw error
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
async function getRemainingIssues (graphQL, owner, repo, cursor) {
|
|
252
|
+
try {
|
|
253
|
+
const resp = await graphQL({
|
|
254
|
+
query: `query ($org: String!, $repo: String!, $cursor: String!) {
|
|
255
|
+
organization(login: $org) {
|
|
256
|
+
repository(name: $repo) {
|
|
257
|
+
issues(first: 100, after: $cursor, orderBy: {field: CREATED_AT, direction: DESC}) {
|
|
258
|
+
${issueQuerySnip}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
`,
|
|
264
|
+
org: owner,
|
|
265
|
+
repo,
|
|
266
|
+
cursor
|
|
267
|
+
})
|
|
268
|
+
const { pageInfo, edges } = resp.organization.repository.issues
|
|
269
|
+
const issues = !pageInfo.hasNextPage ? edges : edges.concat(await getRemainingIssues(graphQL, owner, repo, pageInfo.endCursor))
|
|
270
|
+
return issues
|
|
271
|
+
} catch (error) {
|
|
272
|
+
error.code = 'GET_REPO_ISSUES_FAILED'
|
|
273
|
+
Error.captureStackTrace(error, module.exports.getRepoIssues)
|
|
274
|
+
throw error
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
152
278
|
module.exports.getRepoIssues =
|
|
153
|
-
async function * getRepoIssues (
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
279
|
+
async function * getRepoIssues (graphQL, owner, repo) {
|
|
280
|
+
try {
|
|
281
|
+
const resp = await graphQL({
|
|
282
|
+
query: `query ($org: String!, $repo: String!) {
|
|
283
|
+
organization(login: $org) {
|
|
284
|
+
repository(name: $repo) {
|
|
285
|
+
issues(first: 100, orderBy: {field: CREATED_AT, direction: DESC}) {
|
|
286
|
+
${issueQuerySnip}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}`,
|
|
291
|
+
org: owner,
|
|
292
|
+
repo
|
|
293
|
+
})
|
|
294
|
+
const { pageInfo, edges } = resp.organization.repository.issues
|
|
295
|
+
const issues = !pageInfo.hasNextPage ? edges : edges.concat(await getRemainingIssues(graphQL, owner, repo, pageInfo.endCursor))
|
|
167
296
|
|
|
168
|
-
|
|
169
|
-
|
|
297
|
+
issues.push.apply(issues, await getPullRequests(graphQL, owner, repo))
|
|
298
|
+
|
|
299
|
+
for (const i of issues) {
|
|
300
|
+
yield new Issue(owner, repo, i.node)
|
|
301
|
+
}
|
|
302
|
+
} catch (error) {
|
|
303
|
+
error.code = 'GET_REPO_ISSUES_FAILED'
|
|
304
|
+
Error.captureStackTrace(error, module.exports.getRepoIssues)
|
|
305
|
+
throw error
|
|
170
306
|
}
|
|
171
307
|
}
|
|
172
|
-
}
|
|
173
308
|
|
|
174
309
|
const Activity = module.exports.Activity =
|
|
175
310
|
class Activity {
|
|
@@ -202,79 +337,236 @@ async function * getRepoActivity (octokit, owner, repo) {
|
|
|
202
337
|
throw e
|
|
203
338
|
}
|
|
204
339
|
|
|
205
|
-
for (
|
|
340
|
+
for (const a of resp.data) {
|
|
206
341
|
yield new Activity(owner, repo, a)
|
|
207
342
|
}
|
|
208
343
|
}
|
|
209
344
|
}
|
|
210
345
|
|
|
211
346
|
module.exports.getReadme =
|
|
212
|
-
async function getReadme (
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
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
|
+
}
|
|
220
385
|
}
|
|
221
386
|
|
|
222
|
-
|
|
387
|
+
async function getRemainingRepos (graphQL, org, cursor) {
|
|
388
|
+
try {
|
|
389
|
+
const resp = await graphQL({
|
|
390
|
+
query: `query($org: String!, $cursor: String!)
|
|
391
|
+
{
|
|
392
|
+
organization(login: $org) {
|
|
393
|
+
repositories(first: 100, after: $cursor) {
|
|
394
|
+
pageInfo {
|
|
395
|
+
hasNextPage
|
|
396
|
+
endCursor
|
|
397
|
+
}
|
|
398
|
+
nodes
|
|
399
|
+
${repoQuerySnip}
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
}`,
|
|
403
|
+
org,
|
|
404
|
+
cursor
|
|
405
|
+
})
|
|
406
|
+
|
|
407
|
+
const { pageInfo, nodes } = resp.organization.repositories
|
|
408
|
+
const repos = !pageInfo.hasNextPage ? nodes : nodes.concat(await getRemainingRepos(graphQL, org, pageInfo.endCursor))
|
|
409
|
+
|
|
410
|
+
return repos
|
|
411
|
+
} catch (error) {
|
|
412
|
+
error.code = 'GET_ORG_REPOS_FAILED'
|
|
413
|
+
Error.captureStackTrace(error, module.exports.getOrgRepos)
|
|
414
|
+
throw error
|
|
415
|
+
}
|
|
223
416
|
}
|
|
224
417
|
|
|
225
418
|
module.exports.getOrgRepos =
|
|
226
|
-
async function * getOrgRepos (
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
419
|
+
async function * getOrgRepos (graphQL, org) {
|
|
420
|
+
try {
|
|
421
|
+
const resp = await graphQL({
|
|
422
|
+
query: `query($org: String!)
|
|
423
|
+
{
|
|
424
|
+
organization(login: $org) {
|
|
425
|
+
repositories(first: 100) {
|
|
426
|
+
pageInfo {
|
|
427
|
+
hasNextPage
|
|
428
|
+
endCursor
|
|
429
|
+
}
|
|
430
|
+
nodes
|
|
431
|
+
${repoQuerySnip}
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
}`,
|
|
435
|
+
org
|
|
436
|
+
})
|
|
235
437
|
|
|
236
|
-
|
|
237
|
-
|
|
438
|
+
const { pageInfo, nodes } = resp.organization.repositories
|
|
439
|
+
const repos = !pageInfo.hasNextPage ? nodes : nodes.concat(await getRemainingRepos(graphQL, org, pageInfo.endCursor))
|
|
440
|
+
|
|
441
|
+
for (const r of repos) {
|
|
442
|
+
yield new Repo(org, r)
|
|
443
|
+
}
|
|
444
|
+
} catch (error) {
|
|
445
|
+
error.code = 'GET_ORG_REPOS_FAILED'
|
|
446
|
+
Error.captureStackTrace(error, module.exports.getOrgRepos)
|
|
447
|
+
throw error
|
|
448
|
+
}
|
|
238
449
|
}
|
|
239
|
-
}
|
|
240
450
|
|
|
241
451
|
const Commit = module.exports.Commit =
|
|
242
452
|
class Commit {
|
|
243
453
|
constructor (owner, repo, commit = {}) {
|
|
244
454
|
this.owner = owner
|
|
245
455
|
this.repo = repo
|
|
246
|
-
this.nodeId = commit.
|
|
247
|
-
this.sha = commit.
|
|
248
|
-
this.message = commit.
|
|
249
|
-
this.url = commit.
|
|
250
|
-
this.date = new Date(commit.
|
|
456
|
+
this.nodeId = commit.id
|
|
457
|
+
this.sha = commit.oid
|
|
458
|
+
this.message = commit.message
|
|
459
|
+
this.url = commit.url
|
|
460
|
+
this.date = new Date(commit.authoredDate)
|
|
251
461
|
|
|
252
|
-
let author = commit.author || commit.committer
|
|
462
|
+
let author = commit.author.user || commit.committer
|
|
253
463
|
if (!author) {
|
|
254
464
|
author = {
|
|
255
|
-
login: commit.
|
|
465
|
+
login: commit.author.email
|
|
256
466
|
}
|
|
257
467
|
}
|
|
258
468
|
this.author = author
|
|
259
469
|
}
|
|
260
470
|
}
|
|
261
471
|
|
|
472
|
+
async function getRemainingCommits (graphQL, owner, repo, cursor, branch) {
|
|
473
|
+
try {
|
|
474
|
+
const resp = await graphQL({
|
|
475
|
+
query: `query ($org: String!, $repo: String!, $cursor: String!, $branch: String!) {
|
|
476
|
+
repository(name: $repo, owner: $org) {
|
|
477
|
+
object(expression: $branch) {
|
|
478
|
+
... on Commit {
|
|
479
|
+
history(first: 100, after: $cursor) {
|
|
480
|
+
nodes {
|
|
481
|
+
id
|
|
482
|
+
oid
|
|
483
|
+
message
|
|
484
|
+
url
|
|
485
|
+
authoredDate
|
|
486
|
+
author {
|
|
487
|
+
email
|
|
488
|
+
user {
|
|
489
|
+
login
|
|
490
|
+
id
|
|
491
|
+
avatarUrl
|
|
492
|
+
url
|
|
493
|
+
isSiteAdmin
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
pageInfo {
|
|
498
|
+
endCursor
|
|
499
|
+
hasNextPage
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
`,
|
|
507
|
+
org: owner,
|
|
508
|
+
repo,
|
|
509
|
+
cursor,
|
|
510
|
+
branch
|
|
511
|
+
})
|
|
512
|
+
const { pageInfo, nodes } = resp.repository.object.history
|
|
513
|
+
const commits = !pageInfo.hasNextPage ? nodes : nodes.concat(await getRemainingCommits(graphQL, owner, repo, pageInfo.endCursor, branch))
|
|
514
|
+
|
|
515
|
+
return commits
|
|
516
|
+
} catch (error) {
|
|
517
|
+
error.code = 'GET_REPO_COMMITS_FAILED'
|
|
518
|
+
throw (error)
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
|
|
262
522
|
module.exports.getRepoCommits =
|
|
263
|
-
async function * getRepoCommits (
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
523
|
+
async function * getRepoCommits (graphQL, owner, repo, branch) {
|
|
524
|
+
try {
|
|
525
|
+
const resp = await graphQL({
|
|
526
|
+
query: `query ($org: String!, $repo: String!, $branch: String!) {
|
|
527
|
+
repository(name: $repo, owner: $org) {
|
|
528
|
+
object(expression: $branch) {
|
|
529
|
+
... on Commit {
|
|
530
|
+
history(first: 100) {
|
|
531
|
+
nodes {
|
|
532
|
+
id
|
|
533
|
+
oid
|
|
534
|
+
message
|
|
535
|
+
url
|
|
536
|
+
authoredDate
|
|
537
|
+
author {
|
|
538
|
+
email
|
|
539
|
+
user {
|
|
540
|
+
login
|
|
541
|
+
id
|
|
542
|
+
avatarUrl
|
|
543
|
+
url
|
|
544
|
+
isSiteAdmin
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
pageInfo {
|
|
549
|
+
endCursor
|
|
550
|
+
hasNextPage
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
`,
|
|
558
|
+
org: owner,
|
|
559
|
+
repo,
|
|
560
|
+
branch
|
|
561
|
+
})
|
|
562
|
+
const { pageInfo, nodes } = resp.repository.object.history
|
|
563
|
+
const commits = !pageInfo.hasNextPage ? nodes : nodes.concat(await getRemainingCommits(graphQL, owner, repo, pageInfo.endCursor, branch))
|
|
275
564
|
|
|
276
|
-
for (
|
|
277
|
-
yield new Commit(owner, repo,
|
|
565
|
+
for (const c of commits) {
|
|
566
|
+
yield new Commit(owner, repo, c)
|
|
278
567
|
}
|
|
568
|
+
} catch (error) {
|
|
569
|
+
error.code = 'GET_REPO_COMMITS_FAILED'
|
|
570
|
+
throw (error)
|
|
279
571
|
}
|
|
280
572
|
}
|
package/lib/npm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
'use strict'
|
|
2
|
-
const
|
|
2
|
+
const pacote = require('pacote')
|
|
3
3
|
|
|
4
4
|
const Packument = module.exports.Packument =
|
|
5
5
|
class Packument {
|
|
@@ -12,7 +12,7 @@ class Packument {
|
|
|
12
12
|
}
|
|
13
13
|
|
|
14
14
|
module.exports.getPackument = async function getNpmPackument (packageName) {
|
|
15
|
-
const resp = await
|
|
15
|
+
const resp = await pacote.packument(packageName)
|
|
16
16
|
return new Packument(resp)
|
|
17
17
|
}
|
|
18
18
|
|
|
@@ -30,6 +30,6 @@ class Manifest {
|
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
32
|
module.exports.getManifest = async function getNpmManifest (packageName) {
|
|
33
|
-
const resp = await
|
|
33
|
+
const resp = await pacote.manifest(packageName)
|
|
34
34
|
return new Manifest(resp)
|
|
35
35
|
}
|
package/lib/project.js
CHANGED
|
@@ -23,7 +23,7 @@ module.exports.Project = class Project {
|
|
|
23
23
|
this.repo = repo
|
|
24
24
|
this.repoOwner = repoOwner
|
|
25
25
|
this.repoName = repoName
|
|
26
|
-
this.repoBranch = proj.repoBranch
|
|
26
|
+
this.repoBranch = proj.repoBranch
|
|
27
27
|
this.repoDirectory = proj.repoDirectory || '/'
|
|
28
28
|
this.packageName = null
|
|
29
29
|
}
|
package/lib/template/index.js
CHANGED
|
@@ -6,7 +6,7 @@ module.exports = async function (config, db) {
|
|
|
6
6
|
const accumulator = {}
|
|
7
7
|
|
|
8
8
|
// Read full index
|
|
9
|
-
for await (
|
|
9
|
+
for await (const { key, value } of readFullIndex(db)) {
|
|
10
10
|
await Promise.all(Object.keys(indicies).map(async (index) => {
|
|
11
11
|
accumulator[index] = await indicies[index](accumulator[index], config, key, value)
|
|
12
12
|
}))
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pkgjs/statusboard",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.1.0",
|
|
4
4
|
"description": "A dashboard for project status",
|
|
5
5
|
"author": "Wes Todd <wes@wesleytodd.com>",
|
|
6
6
|
"keywords": [
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
"badges",
|
|
10
10
|
"express"
|
|
11
11
|
],
|
|
12
|
-
"license": "
|
|
12
|
+
"license": "MIT",
|
|
13
13
|
"main": "index.js",
|
|
14
14
|
"repository": {
|
|
15
15
|
"type": "git",
|
|
@@ -19,7 +19,8 @@
|
|
|
19
19
|
"statusboard": "./bin/statusboard"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
|
-
"
|
|
22
|
+
"lint": "standard",
|
|
23
|
+
"test": "mocha",
|
|
23
24
|
"prepublushOnly": "npm t",
|
|
24
25
|
"postpublish": "git push origin && git push origin --tags",
|
|
25
26
|
"clean": "./bin/statusboard clean -C ./test/fixtures/config -d ./gh-pages/data.db",
|
|
@@ -29,33 +30,35 @@
|
|
|
29
30
|
"serve": "./bin/statusboard serve -o ./gh-pages -C ./test/fixtures/config -d ./gh-pages/data.db"
|
|
30
31
|
},
|
|
31
32
|
"devDependencies": {
|
|
32
|
-
"mocha": "^
|
|
33
|
-
"
|
|
34
|
-
"standard": "^12.0.1"
|
|
33
|
+
"mocha": "^10.8.2",
|
|
34
|
+
"standard": "^17.1.2"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@octokit/
|
|
38
|
-
"@octokit/plugin-
|
|
39
|
-
"@octokit/
|
|
37
|
+
"@octokit/graphql": "^7.1.0",
|
|
38
|
+
"@octokit/plugin-retry": "^6.0.1",
|
|
39
|
+
"@octokit/plugin-throttling": "^8.2.0",
|
|
40
|
+
"@octokit/rest": "^20.1.1",
|
|
40
41
|
"@primer/octicons": "^9.1.1",
|
|
41
|
-
"@wesleytodd/buildcss": "0.0.
|
|
42
|
+
"@wesleytodd/buildcss": "0.0.6",
|
|
42
43
|
"@wesleytodd/buildjs": "0.0.8",
|
|
43
44
|
"babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
|
|
44
45
|
"cptmpl": "0.0.4",
|
|
45
|
-
"dotenv": "^
|
|
46
|
+
"dotenv": "^16.4.7",
|
|
46
47
|
"es5-lit-element": "^2.2.1",
|
|
48
|
+
"es5-lit-html": "^1.1.1",
|
|
47
49
|
"express": "^4.17.1",
|
|
48
50
|
"fs-extra": "^8.1.0",
|
|
49
|
-
"inquirer": "^
|
|
51
|
+
"inquirer": "^12.4.2",
|
|
50
52
|
"install": "^0.13.0",
|
|
51
53
|
"js-yaml": "^3.13.1",
|
|
52
54
|
"level": "^5.0.1",
|
|
53
|
-
"libnpm": "^2.0.1",
|
|
54
55
|
"lit-element": "^2.2.1",
|
|
55
56
|
"nighthawk": "^2.3.0-1",
|
|
56
|
-
"
|
|
57
|
-
"
|
|
58
|
-
"
|
|
59
|
-
|
|
57
|
+
"pacote": "^20.0.0",
|
|
58
|
+
"regenerator-runtime": "^0.14.1",
|
|
59
|
+
"yargs": "^17.7.2"
|
|
60
|
+
},
|
|
61
|
+
"engines": {
|
|
62
|
+
"node": ">=18"
|
|
60
63
|
}
|
|
61
64
|
}
|
package/template/indicies.js
CHANGED
|
@@ -70,7 +70,7 @@ module.exports = {
|
|
|
70
70
|
}
|
|
71
71
|
|
|
72
72
|
if (!user) {
|
|
73
|
-
return data
|
|
73
|
+
return data
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
data[user.login] = data[user.login] || user
|
|
@@ -80,7 +80,7 @@ module.exports = {
|
|
|
80
80
|
},
|
|
81
81
|
|
|
82
82
|
labeledIssues: async (data, config, key, { type, project, detail }) => {
|
|
83
|
-
if (type !== 'ISSUE' || detail.state !== '
|
|
83
|
+
if (type !== 'ISSUE' || detail.state !== 'OPEN') {
|
|
84
84
|
return data
|
|
85
85
|
}
|
|
86
86
|
|
|
@@ -93,7 +93,7 @@ module.exports = {
|
|
|
93
93
|
|
|
94
94
|
labels[label.name] = labels[label.name] || []
|
|
95
95
|
const d = {
|
|
96
|
-
label
|
|
96
|
+
label,
|
|
97
97
|
issue: detail,
|
|
98
98
|
project
|
|
99
99
|
}
|
package/template/js/index.js
CHANGED
|
@@ -72,7 +72,7 @@ require('nighthawk')({
|
|
|
72
72
|
<li>
|
|
73
73
|
<span class="project-link">
|
|
74
74
|
<a href="https://www.github.com/${issue.project.repoOwner}" target="_blank">${issue.project.repoOwner}</a>
|
|
75
|
-
/ <a href="
|
|
75
|
+
/ <a href="https://www.github.com/${issue.project.repo}" target="_blank">${issue.project.repoName}</a>
|
|
76
76
|
</span>
|
|
77
77
|
: <a href="${issue.issue.url}" target="_blank">${issue.issue.title}</a>
|
|
78
78
|
</li>
|
|
@@ -119,7 +119,7 @@ require('nighthawk')({
|
|
|
119
119
|
<main>
|
|
120
120
|
${res.locals.issues.map(([tag, issues]) => html`
|
|
121
121
|
<section>
|
|
122
|
-
<h1><a href="${config.baseUrl}issues/${tag.name}">${tag.name}</a></h1>
|
|
122
|
+
<h1><a href="${config.baseUrl}/issues/${tag.name}">${tag.name}</a></h1>
|
|
123
123
|
|
|
124
124
|
<div class="issues-list">
|
|
125
125
|
<ul>
|
package/template/js/page.js
CHANGED
package/test/fixtures/config.js
CHANGED
package/test/index.js
CHANGED
|
@@ -5,7 +5,6 @@ const assert = require('assert')
|
|
|
5
5
|
const fs = require('fs-extra')
|
|
6
6
|
const pkg = require('../package.json')
|
|
7
7
|
const statusboard = require('../')
|
|
8
|
-
const { Config } = statusboard
|
|
9
8
|
|
|
10
9
|
// These tests require a github token
|
|
11
10
|
assert(process.env.GITHUB_TOKEN, `
|
|
@@ -27,7 +26,7 @@ suite(pkg.name, () => {
|
|
|
27
26
|
const board = await statusboard(CONFIG)
|
|
28
27
|
assert.strictEqual(board.config.db, CONFIG.db)
|
|
29
28
|
assert.strictEqual(board.config.outputDirectory, CONFIG.outputDirectory)
|
|
30
|
-
assert.strictEqual(board.config.baseUrl,
|
|
29
|
+
assert.strictEqual(board.config.baseUrl, CONFIG.baseUrl)
|
|
31
30
|
assert.strictEqual(board.config.title, CONFIG.title)
|
|
32
31
|
assert.strictEqual(board.config.description, CONFIG.description)
|
|
33
32
|
|
|
@@ -41,12 +40,12 @@ suite(pkg.name, () => {
|
|
|
41
40
|
assert.strictEqual(board.config.projects[0].repoOwner, CONFIG.projects[0].split('/')[0])
|
|
42
41
|
assert.strictEqual(board.config.projects[0].repoName, CONFIG.projects[0].split('/')[1])
|
|
43
42
|
|
|
44
|
-
assert.strictEqual(board.config.projects[1].name, CONFIG.projects[1])
|
|
45
|
-
assert.strictEqual(board.config.projects[1].repo, CONFIG.projects[1])
|
|
46
|
-
assert.strictEqual(board.config.projects[1].repoOwner, CONFIG.projects[1].split('/')[0])
|
|
47
|
-
assert.strictEqual(board.config.projects[1].repoName, CONFIG.projects[1].split('/')[1])
|
|
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])
|
|
48
47
|
|
|
49
|
-
assert
|
|
48
|
+
assert(board.config.issueLabels.length > 0)
|
|
50
49
|
assert.strictEqual(board.config.people.length, CONFIG.people.length)
|
|
51
50
|
|
|
52
51
|
// Check exposed interface a little
|