diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index fccf1a7..193261f 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -9,10 +9,26 @@ on:
- main
concurrency:
- group: "test"
+ group: "${{ github.workflow }} ✨ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: false
jobs:
+ lint:
+ name: Lint
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Setup Node.js
+ uses: actions/setup-node@v4
+ with:
+ node-version: 'lts/*'
+
+ - name: Install dependencies
+ run: npm install --ignore-scripts --only=dev
+
+ - name: Run lint
+ run: npm run lint
+
test:
runs-on: ubuntu-latest
strategy:
@@ -20,11 +36,16 @@ jobs:
node-version: [18, 19, 20, 21, 22, 23]
steps:
- uses: actions/checkout@v4
+
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- - name: npm install and test
+
+ - name: Install dependencies
+ run: npm install
+
+ - name: Run tests
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm it
\ No newline at end of file
+ run: npm test
\ No newline at end of file
diff --git a/lib/config.js b/lib/config.js
index bff0675..7bc97d6 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -16,7 +16,7 @@ const DEFAULTS = {
baseUrl: '',
port: 5005,
template: builder,
- indicies: indicies,
+ indicies,
title: 'StatusBoard',
description: 'Project StatusBoard',
issueLabels: ['top priority', 'good first issue', 'help wanted', 'discussion', 'meeting']
diff --git a/lib/db/build-index.js b/lib/db/build-index.js
index 207b365..fc5072a 100644
--- a/lib/db/build-index.js
+++ b/lib/db/build-index.js
@@ -6,8 +6,8 @@ const { Project } = require('../project')
module.exports = async function buildIndex (config, db) {
// Loop projects
- for await (let evt of iterateProjects(config)) {
- let { type, project, detail } = evt
+ for await (const evt of iterateProjects(config)) {
+ const { type, project, detail } = evt
let key = `${project.repoOwner}:${project.repoName}:${type}`
switch (type) {
case 'ISSUE':
@@ -32,21 +32,21 @@ async function * iterateProjects (config) {
const [octokit, graphQL] = await github(config.github)
// Load projects
- for (let proj of config.projects) {
- for await (let evt of loadProject(octokit, graphQL, proj, config)) {
+ for (const proj of config.projects) {
+ for await (const evt of loadProject(octokit, graphQL, proj, config)) {
yield evt
}
}
// Load projects for org
- for (let org of config.orgs) {
+ for (const org of config.orgs) {
try {
- for await (let repo of github.getOrgRepos(graphQL, org.name)) {
+ for await (const repo of github.getOrgRepos(graphQL, org.name)) {
const proj = new Project({
repoOwner: repo.owner,
repoName: repo.name
})
- for await (let evt of loadProject(octokit, graphQL, proj, config, repo)) {
+ for await (const evt of loadProject(octokit, graphQL, proj, config, repo)) {
yield evt
}
}
@@ -130,7 +130,7 @@ async function * loadProject (octokit, graphQL, project, config, _repo) {
}
try {
- for await (let issue of github.getRepoIssues(graphQL, project.repoOwner, project.repoName)) {
+ for await (const issue of github.getRepoIssues(graphQL, project.repoOwner, project.repoName)) {
yield projectDetail('ISSUE', project, issue)
}
} catch (e) {
@@ -138,7 +138,7 @@ async function * loadProject (octokit, graphQL, project, config, _repo) {
}
try {
- for await (let activity of github.getRepoActivity(octokit, project.repoOwner, project.repoName)) {
+ for await (const activity of github.getRepoActivity(octokit, project.repoOwner, project.repoName)) {
yield projectDetail('ACTIVITY', project, activity)
}
} catch (e) {
@@ -146,7 +146,7 @@ async function * loadProject (octokit, graphQL, project, config, _repo) {
}
try {
- for await (let commit of github.getRepoCommits(graphQL, project.repoOwner, project.repoName)) {
+ for await (const commit of github.getRepoCommits(graphQL, project.repoOwner, project.repoName)) {
yield projectDetail('COMMIT', project, commit)
}
} catch (e) {
diff --git a/lib/github.js b/lib/github.js
index d8d7793..73f0ba0 100644
--- a/lib/github.js
+++ b/lib/github.js
@@ -148,7 +148,7 @@ module.exports.getRepo =
${repoQuerySnip}
}`,
org: owner,
- repo: repo
+ repo
})
return new Repo(owner, resp.repository)
} catch (error) {
@@ -206,8 +206,8 @@ async function getRemainingPullRequests (graphQL, owner, repo, cursor) {
}
`,
org: owner,
- repo: repo,
- cursor: cursor
+ repo,
+ cursor
})
const { pageInfo, edges } = resp.organization.repository.pullRequests
const pullRequests = !pageInfo.hasNextPage ? edges : edges.concat(await getRemainingPullRequests(graphQL, owner, repo, pageInfo.endCursor))
@@ -232,7 +232,7 @@ async function getPullRequests (graphQL, owner, repo) {
}
}`,
org: owner,
- repo: repo
+ repo
})
const { pageInfo, edges } = resp.organization.repository.pullRequests
const pullRequests = !pageInfo.hasNextPage ? edges : edges.concat(await getRemainingPullRequests(graphQL, owner, repo, pageInfo.endCursor))
@@ -258,8 +258,8 @@ async function getRemainingIssues (graphQL, owner, repo, cursor) {
}
`,
org: owner,
- repo: repo,
- cursor: cursor
+ repo,
+ cursor
})
const { pageInfo, edges } = resp.organization.repository.issues
const issues = !pageInfo.hasNextPage ? edges : edges.concat(await getRemainingIssues(graphQL, owner, repo, pageInfo.endCursor))
@@ -274,7 +274,7 @@ async function getRemainingIssues (graphQL, owner, repo, cursor) {
module.exports.getRepoIssues =
async function * getRepoIssues (graphQL, owner, repo) {
try {
- let resp = await graphQL({
+ const resp = await graphQL({
query: `query ($org: String!, $repo: String!) {
organization(login: $org) {
repository(name: $repo) {
@@ -285,14 +285,14 @@ module.exports.getRepoIssues =
}
}`,
org: owner,
- repo: repo
+ repo
})
const { pageInfo, edges } = resp.organization.repository.issues
const issues = !pageInfo.hasNextPage ? edges : edges.concat(await getRemainingIssues(graphQL, owner, repo, pageInfo.endCursor))
issues.push.apply(issues, await getPullRequests(graphQL, owner, repo))
- for (let i of issues) {
+ for (const i of issues) {
yield new Issue(owner, repo, i.node)
}
} catch (error) {
@@ -333,7 +333,7 @@ async function * getRepoActivity (octokit, owner, repo) {
throw e
}
- for (let a of resp.data) {
+ for (const a of resp.data) {
yield new Activity(owner, repo, a)
}
}
@@ -364,7 +364,7 @@ module.exports.getReadme =
}
`,
org: owner,
- repo: repo
+ repo
})
let readmeText
Object.values(resp.repository).forEach(element => {
@@ -396,8 +396,8 @@ async function getRemainingRepos (graphQL, org, cursor) {
}
}
}`,
- org: org,
- cursor: cursor
+ org,
+ cursor
})
const { pageInfo, nodes } = resp.organization.repositories
@@ -414,7 +414,7 @@ async function getRemainingRepos (graphQL, org, cursor) {
module.exports.getOrgRepos =
async function * getOrgRepos (graphQL, org) {
try {
- let resp = await graphQL({
+ const resp = await graphQL({
query: `query($org: String!)
{
organization(login: $org) {
@@ -428,13 +428,13 @@ module.exports.getOrgRepos =
}
}
}`,
- org: org
+ org
})
const { pageInfo, nodes } = resp.organization.repositories
const repos = !pageInfo.hasNextPage ? nodes : nodes.concat(await getRemainingRepos(graphQL, org, pageInfo.endCursor))
- for (let r of repos) {
+ for (const r of repos) {
yield new Repo(org, r)
}
} catch (error) {
@@ -467,7 +467,7 @@ class Commit {
async function getRemainingCommits (graphQL, owner, repo, cursor) {
try {
- let resp = await graphQL({
+ const resp = await graphQL({
query: `query ($org: String!, $repo: String!, $cursor: String!) {
repository(name: $repo, owner: $org) {
object(expression: "master") {
@@ -501,8 +501,8 @@ async function getRemainingCommits (graphQL, owner, repo, cursor) {
}
`,
org: owner,
- repo: repo,
- cursor: cursor
+ repo,
+ cursor
})
const { pageInfo, nodes } = resp.repository.object.history
const commits = !pageInfo.hasNextPage ? nodes : nodes.concat(await getRemainingCommits(graphQL, owner, repo, pageInfo.endCursor))
@@ -517,7 +517,7 @@ async function getRemainingCommits (graphQL, owner, repo, cursor) {
module.exports.getRepoCommits =
async function * getRepoCommits (graphQL, owner, repo) {
try {
- let resp = await graphQL({
+ const resp = await graphQL({
query: `query ($org: String!, $repo: String!) {
repository(name: $repo, owner: $org) {
object(expression: "master") {
@@ -551,12 +551,12 @@ async function * getRepoCommits (graphQL, owner, repo) {
}
`,
org: owner,
- repo: repo
+ repo
})
const { pageInfo, nodes } = resp.repository.object.history
const commits = !pageInfo.hasNextPage ? nodes : nodes.concat(await getRemainingCommits(graphQL, owner, repo, pageInfo.endCursor))
- for (let c of commits) {
+ for (const c of commits) {
yield new Commit(owner, repo, c)
}
} catch (error) {
diff --git a/lib/template/index.js b/lib/template/index.js
index ed6cdc9..1ee87f0 100644
--- a/lib/template/index.js
+++ b/lib/template/index.js
@@ -6,7 +6,7 @@ module.exports = async function (config, db) {
const accumulator = {}
// Read full index
- for await (let { key, value } of readFullIndex(db)) {
+ for await (const { key, value } of readFullIndex(db)) {
await Promise.all(Object.keys(indicies).map(async (index) => {
accumulator[index] = await indicies[index](accumulator[index], config, key, value)
}))
diff --git a/package.json b/package.json
index 926baa5..f54aed5 100644
--- a/package.json
+++ b/package.json
@@ -19,7 +19,8 @@
"statusboard": "./bin/statusboard"
},
"scripts": {
- "test": "standard && mocha",
+ "lint": "standard",
+ "test": "mocha",
"prepublushOnly": "npm t",
"postpublish": "git push origin && git push origin --tags",
"clean": "./bin/statusboard clean -C ./test/fixtures/config -d ./gh-pages/data.db",
@@ -29,9 +30,8 @@
"serve": "./bin/statusboard serve -o ./gh-pages -C ./test/fixtures/config -d ./gh-pages/data.db"
},
"devDependencies": {
- "mocha": "^6.1.4",
- "serve": "^11.1.0",
- "standard": "^12.0.1"
+ "mocha": "^10.8.2",
+ "standard": "^17.1.2"
},
"dependencies": {
"@octokit/graphql": "^7.1.0",
diff --git a/template/indicies.js b/template/indicies.js
index 76598a7..9f725a9 100644
--- a/template/indicies.js
+++ b/template/indicies.js
@@ -93,7 +93,7 @@ module.exports = {
labels[label.name] = labels[label.name] || []
const d = {
- label: label,
+ label,
issue: detail,
project
}
diff --git a/template/js/page.js b/template/js/page.js
index 6a9abfb..a4ca915 100644
--- a/template/js/page.js
+++ b/template/js/page.js
@@ -8,6 +8,7 @@ class Page extends LitElement {
config: { type: Object }
}
}
+
render () {
return html`
diff --git a/template/js/project-list.js b/template/js/project-list.js
index c9cd324..cd88ccc 100644
--- a/template/js/project-list.js
+++ b/template/js/project-list.js
@@ -9,6 +9,7 @@ class ProjectList extends LitElement {
projects: { type: Object }
}
}
+
render () {
return html`