diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..798d33c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,55 @@ +name: Generate StatusBoard + +on: + push: + branches: + - master + workflow_dispatch: + schedule: + - cron: "0 */2 * * *" + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: "pages" + cancel-in-progress: false + +jobs: + index: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Setup Pages + uses: actions/configure-pages@v5 + - uses: actions/setup-node@v4 + with: + node-version: 12 + - uses: actions/cache@v4 + id: cache + with: + path: | + ~/.npm + ~/.cache + ./node_modules + key: ${{ runner.os }}-build-${{ github.sha }} + - if: steps.cache.outputs.cache-hit != 'true' + run: npm install + shell: bash + - run: npm run build + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + # Upload entire repository + path: './build' + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..cf60e97 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,18 @@ +name: Run Tests + +on: [push] + +jobs: + test: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [22.x] + 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 + run: npm it diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d5e177a --- /dev/null +++ b/.gitignore @@ -0,0 +1,19 @@ +package-lock.json +build +data.db + +# Logs +logs +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* + +# Diagnostic reports (https://nodejs.org/api/report.html) +report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json + +# Dependency directories +node_modules/ + +# dotenv environment variables file +.env diff --git a/.npmrc b/.npmrc new file mode 100644 index 0000000..43c97e7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +package-lock=false diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..c8588b2 --- /dev/null +++ b/LICENSE @@ -0,0 +1,22 @@ +(The MIT License) + +Copyright (c) 2019 Wes Todd + +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: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +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. diff --git a/README.md b/README.md index c920ba7..900ca8e 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,14 @@ **Notice: This is a work in progress, some things might not work as expected** -This package exposes an api and cli for managing a project status board. It -is a wrapper around `@pkgjs/statusboard` with configuration for Express +This package exposes an api and cli for managing a project StatusBoard. It +is a thin wrapper around `@pkgjs/statusboard` with configuration for Express projects. + +The status board website can be found here: https://expressjs.github.io/statusboard/ + +Build and serve the StatusBoard locally: + +```bash +exsb build &&exsb serve +``` diff --git a/bin/exsb b/bin/exsb new file mode 100755 index 0000000..7e6aba1 --- /dev/null +++ b/bin/exsb @@ -0,0 +1,6 @@ +#! /usr/bin/env node +'use strict' +const { cli } = require('@pkgjs/statusboard') + +// Construct the cli +cli(require('..'), process.argv.slice(2)) diff --git a/index.js b/index.js new file mode 100644 index 0000000..f30d0f5 --- /dev/null +++ b/index.js @@ -0,0 +1,129 @@ +'use strict' +const path = require('path') +const statusboard = require('@pkgjs/statusboard') + +module.exports = async (c) => { + return statusboard(await config(c)) +} + +const config = module.exports.config = async (c = {}) => { + const buildDir = path.join(__dirname, 'build') + + return Object.assign({ + // Status Board Config + db: path.join(buildDir, 'data', 'data.db'), + baseUrl: '/statusboard', + outputDirectory: buildDir, + github: { + token: process.env.GITHUB_TOKEN + }, + // Project configs + title: 'Express', + description: 'Fast, unopinionated, minimalist web framework for node. ', + issueLabels: ['top priority', 'good first issue', 'require-triage', 'help wanted', 'discuss', 'meeting'], + projects: [ + 'expressjs/admin', + 'expressjs/basic-auth-connect', + 'expressjs/body-parser', + 'expressjs/compression', + 'expressjs/cors', + 'expressjs/discussions', + 'expressjs/express', + 'expressjs/expressjs.com', + 'expressjs/morgan', + 'expressjs/response-time', + 'expressjs/session', + 'expressjs/multer', + 'expressjs/serve-static', + 'expressjs/errorhandler', + 'expressjs/serve-index', + 'expressjs/timeout', + 'expressjs/flash', + 'expressjs/vhost', + + 'pillarjs/router', + 'pillarjs/cookies', + 'pillarjs/send', + 'pillarjs/finalhandler', + 'pillarjs/path-to-regexp', + + 'jshttp/cookie', + 'jshttp/fresh', + 'jshttp/content-disposition', + 'jshttp/mime-db', + 'jshttp/media-typer', + 'jshttp/range-parser', + 'jshttp/type-is', + 'jshttp/accepts', + 'jshttp/negotiator', + 'jshttp/mime-types', + 'jshttp/compressible', + 'jshttp/content-type', + 'jshttp/http-errors', + 'jshttp/proxy-addr', + 'jshttp/etag', + 'jshttp/forwarded', + 'jshttp/on-finished', + 'jshttp/on-headers', + 'jshttp/vary', + 'jshttp/basic-auth', + 'jshttp/methods', + 'jshttp/statuses' + ], + teams: { + technicalCommitee: [{ + name: 'Blake Embrey', + github: 'blakeembrey', + npm: 'blakeembrey', + twitter: 'blakeembrey', + email: 'hello@blakeembrey.com' + }, { + name: 'Rand McKinney', + github: 'crandmck', + npm: 'crandmck', + twitter: 'randmckinney', + email: 'crandmck@yahoo.com' + }, + { + name: 'Chris de Almeida', + github: 'ctcpip', + npm: 'ctcpip', + twitter: 'SoftwareChrisGo', + email: 'chrisda@codenothing.com' + }, + { + name: 'Jon Church', + github: 'jonchurch', + npm: 'jonchurch', + twitter: 'jonchurch', + email: 'me@jonchurch.com' + }, + { + name: 'Linus Unnebäck', + github: 'LinusU', + npm: 'linusu', + twitter: 'LinusU', + email: 'linus@folkdatorn.se' + }, + { + name: 'Jean Burellier', + github: 'sheplu', + npm: 'sheplu', + twitter: 'shepsheplu' + }, + { + name: 'Ulises Gascón', + github: 'ulisesGascon', + npm: 'ulisesgascon', + twitter: 'kom_256', + email: 'ulisesgascongonzalez@gmail.com' + }, { + name: 'Wes Todd', + github: 'wesleytodd', + npm: 'wesleytodd', + twitter: 'wesleytodd', + email: 'wes@wesleytodd.com' + }] + } + }, c) +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..5976eba --- /dev/null +++ b/package.json @@ -0,0 +1,29 @@ +{ + "name": "@expressjs/statusboard", + "private": true, + "description": "Express project StatusBoard", + "author": "Wes Todd ", + "maintainers": [ + "Sebastian Beltran " + ], + "license": "MIT", + "main": "index.js", + "bin": { + "exsb": "./bin/exsb" + }, + "scripts": { + "test": "standard && mocha", + "prepublushOnly": "npm t", + "build": "./bin/exsb build", + "buildsite": "npm run clean && ./bin/exsb site", + "buildindex": "./bin/exsb index", + "clean": "rm -rf build/css build/js" + }, + "devDependencies": { + "mocha": "^6.2.0", + "standard": "^13.1.0" + }, + "dependencies": { + "@pkgjs/statusboard": "0.0.14" + } +} diff --git a/test/index.js b/test/index.js new file mode 100644 index 0000000..2f83bbe --- /dev/null +++ b/test/index.js @@ -0,0 +1,14 @@ +'use strict' +const { describe, it } = require('mocha') +const assert = require('assert') +const pkg = require('../package.json') +const exsb = require('../') + +describe(pkg.name, () => { + it('should create a configured statusboard instance', async () => { + const sb = await exsb() + assert.strictEqual(typeof sb.buildIndex, 'function') + assert.strictEqual(typeof sb.buildSite, 'function') + assert.strictEqual(typeof sb.serve, 'function') + }) +})