Changed the framework so that apps out of the box come with the Bridgeman Accessible Web Components library (which if not used introduces little latency but if used provide large value)
All checks were successful
Publish to Private NPM Registry / publish (push) Successful in 34s

This commit is contained in:
Alan Bridgeman 2026-05-13 13:29:25 -05:00
parent 7f9506279f
commit 5a18653c69
5 changed files with 36 additions and 11 deletions

View file

@ -9,7 +9,8 @@ on:
jobs:
publish:
runs-on: default
#runs-on: self-hosted
env:
PRIVATE_NPM_REGISTRY: 'https://npm.pkg.bridgemanaccessible.ca'
steps:
# Checkout the repository
@ -36,7 +37,7 @@ jobs:
# > Optional registry to set up for auth. Will set the registry in a project level .npmrc and .yarnrc file,
# > and set up auth to read in from env.NODE_AUTH_TOKEN.
# > Default: ''
registry-url: 'https://npm.pkg.bridgemanaccessible.ca'
registry-url: ${{ env.PRIVATE_NPM_REGISTRY }}
# Taken from [Repo README](https://github.com/actions/setup-node#readme)
#
@ -68,7 +69,7 @@ jobs:
echo "Version: $VERSION"
NAME=$(node -p "require('./package.json').name")
LATEST_VERSION=$(npm show $NAME version --registry https://npm.pkg.bridgemanaccessible.ca)
LATEST_VERSION=$(npm show $NAME version --registry ${{ env.PRIVATE_NPM_REGISTRY }} 2>/dev/null || echo "0.0.0")
echo "Latest version: $LATEST_VERSION"
if [ "$LATEST_VERSION" != "$VERSION" ]; then
@ -109,4 +110,4 @@ jobs:
cd dist
# Publish the package to the private NPM registry
npm publish --registry http://npm.pkg.bridgemanaccessible.ca/
npm publish --registry ${{ env.PRIVATE_NPM_REGISTRY }}

View file

@ -41,6 +41,7 @@
"dependencies": {
"@BridgemanAccessible/ba-auth": "^1.0.52",
"@BridgemanAccessible/ba-logging": "^1.0.2",
"@BridgemanAccessible/ba-web-components": "^1.0.0",
"express": "^4.19.2",
"fs-extra": "^11.2.0",
"jsdom": "^24.1.0",

View file

@ -1,6 +1,7 @@
import 'reflect-metadata';
import type { Application } from 'express';
import type { RequestHandler } from 'express';
import useComponentsLibrary from '@BridgemanAccessible/ba-web-components';
import { logMessage, LogLevel } from '@BridgemanAccessible/ba-logging';
import { Initializer } from './Initializer.js';
@ -30,7 +31,7 @@ export class App {
* The main entry point for the web app
* This is mostly required because of async/await
*/
async run<T extends Initializer>(initializer?: T, callback?: (app: App) => void | Promise<void>, onErrorCallback?: (error: any) => void | Promise<void>) {
async run<T extends Initializer>(initializer?: T, callback?: (app: App) => void | Promise<void>, onErrorCallback?: (error: any) => void | Promise<void>, includeComponentLibrary: boolean = true): Promise<void> {
// Do the initial setup of the app
if(typeof initializer !== 'undefined') {
this.initializer = initializer;
@ -41,6 +42,11 @@ export class App {
await this.initializer.init();
if(includeComponentLibrary) {
const componentsLibraryMiddleware = await useComponentsLibrary({ expressApp: this.getExpressApp() }) as RequestHandler;
this.getExpressApp().use(componentsLibraryMiddleware);
}
// Start the server
const port = process.env.PORT || this.DEFAULT_PORT;
this.getExpressApp().listen(port, async () => {

View file

@ -1,5 +1,3 @@
import axios from 'axios';
import { Scopes } from '@BridgemanAccessible/ba-auth';
import Client from '@BridgemanAccessible/ba-auth/client';
import type { OnAuthCallback } from '@BridgemanAccessible/ba-auth/client';
@ -321,6 +319,7 @@ export class OAuthApp<TCustomClaims extends BridgemanAccessibleAppClaims, TScope
* It's done this way so that it's almost entirely transparent the difference between apps that have OAuth and those that don't.
*
* @param app The Express app object (that is now listening)
* @param callback The callback to call after setting up the OAuth client (this is the `onStart` callback provided to the `run` method)
*/
private async onStart(app: App, callback?: (app: OAuthApp<TCustomClaims, TScopes>) => void | Promise<void>) {
try {
@ -370,7 +369,7 @@ export class OAuthApp<TCustomClaims extends BridgemanAccessibleAppClaims, TScope
* And doesn't have to worry about the OAuth details to make this work.
* Though it does provide tweaking the OAuth details via options provided to the constructor.
*/
async run<T extends Initializer>(initializer?: T, callback?: (app: OAuthApp<TCustomClaims, TScopes>) => void | Promise<void>) {
await super.run(initializer, async (app: App) => this.onStart(app, callback));
async run<T extends Initializer>(initializer?: T, callback?: (app: OAuthApp<TCustomClaims, TScopes>) => void | Promise<void>, onErrorCallback?: (error: any) => void | Promise<void>, includeComponentLibrary: boolean = true): Promise<void> {
await super.run(initializer, async (app: App) => this.onStart(app, callback), onErrorCallback, includeComponentLibrary);
}
}

View file

@ -44,6 +44,14 @@
axios "^1.8.4"
express "^4.21.2"
"@BridgemanAccessible/ba-web-components@^1.0.0":
version "1.0.0"
resolved "https://npm.pkg.bridgemanaccessible.ca/@BridgemanAccessible/ba-web-components/-/ba-web-components-1.0.0.tgz#66d7f2ff68983bbdc2ed7d2252c232d768d6c928"
integrity sha512-wJ/nEh0J+wDQsYZkZFM58D74tmsJ5AYvaqVX4V6hBBPSbPu8mmkLH2fdb2Qn6mQi8lAV1xmuc/olSg0S82tujQ==
dependencies:
ejs "^5.0.2"
open-props "2.0.0-beta.5"
"@asamuzakjp/css-color@^3.2.0":
version "3.2.0"
resolved "https://registry.yarnpkg.com/@asamuzakjp/css-color/-/css-color-3.2.0.tgz#cc42f5b85c593f79f1fa4f25d2b9b321e61d1794"
@ -506,6 +514,11 @@ ejs@^3.1.9:
dependencies:
jake "^10.8.5"
ejs@^5.0.2:
version "5.0.2"
resolved "https://registry.yarnpkg.com/ejs/-/ejs-5.0.2.tgz#cb8a7922ec1e71193b2507942250e230e200de79"
integrity sha512-IpbUaI/CAW86l3f+T8zN0iggSc0LmMZLcIW5eRVStLVNCoTXkE0YlncbbH50fp8Cl6zHIky0sW2uUbhBqGw0Jw==
encodeurl@^2.0.0, encodeurl@~2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-2.0.0.tgz#7b8ea898077d7e409d3ac45474ea38eaf0857a58"
@ -1039,6 +1052,11 @@ once@^1.4.0:
dependencies:
wrappy "1"
open-props@2.0.0-beta.5:
version "2.0.0-beta.5"
resolved "https://registry.yarnpkg.com/open-props/-/open-props-2.0.0-beta.5.tgz#9885e32640ba342fa500e78aa9f7fc1d92d9b5b0"
integrity sha512-Ahq2/q6T+0kzI9Lwt3f8CX6l0IQxqKYkeMi4u09gdFkFmxB1gYuSwqg2xd5nVN1zEYtUN93V0DbQRoDsP3OSmw==
pako@^2.0.4:
version "2.1.0"
resolved "https://registry.yarnpkg.com/pako/-/pako-2.1.0.tgz#266cc37f98c7d883545d11335c00fbd4062c9a86"