From 706bc23f0489bf0fe9a4b844cc36077f52600041 Mon Sep 17 00:00:00 2001 From: Anmol Sethi Date: Tue, 3 Nov 2020 21:53:16 -0500 Subject: [PATCH] plugin: Fixes for CI --- ci/dev/test.sh | 2 +- src/node/plugin.ts | 10 +++++----- src/node/routes/apps.ts | 2 +- src/node/routes/index.ts | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/ci/dev/test.sh b/ci/dev/test.sh index 6eaa3878..9922a9c8 100755 --- a/ci/dev/test.sh +++ b/ci/dev/test.sh @@ -6,7 +6,7 @@ main() { cd test/test-plugin make -s out/index.js - cd $OLDPWD + cd "$OLDPWD" mocha -r ts-node/register ./test/*.test.ts "$@" } diff --git a/src/node/plugin.ts b/src/node/plugin.ts index 368d6f7f..fea85710 100644 --- a/src/node/plugin.ts +++ b/src/node/plugin.ts @@ -54,14 +54,14 @@ export class PluginAPI { */ public async applications(): Promise { const apps = new Array() - for (const [_, p] of this.plugins) { + for (const [, p] of this.plugins) { const pluginApps = await p.applications() // Add plugin key to each app. apps.push( ...pluginApps.map((app) => { - app = {...app, path: path.join(p.routerPath, app.path || "")} - app = {...app, iconPath: path.join(app.path || "", app.iconPath)} + app = { ...app, path: path.join(p.routerPath, app.path || "") } + app = { ...app, iconPath: path.join(app.path || "", app.iconPath) } return { ...app, plugin: { @@ -85,7 +85,7 @@ export class PluginAPI { * mount mounts all plugin routers onto r. */ public mount(r: express.Router): void { - for (const [_, p] of this.plugins) { + for (const [, p] of this.plugins) { r.use(`/${p.name}`, p.router()) } } @@ -142,7 +142,7 @@ export class PluginAPI { encoding: "utf8", }) const packageJSON: PackageJSON = JSON.parse(str) - for (const [_, p] of this.plugins) { + for (const [, p] of this.plugins) { if (p.name === packageJSON.name) { this.logger.warn( `ignoring duplicate plugin ${q(p.name)} at ${q(dir)}, using previously loaded ${q(p.modulePath)}`, diff --git a/src/node/routes/apps.ts b/src/node/routes/apps.ts index 4298fb39..5c8541fc 100644 --- a/src/node/routes/apps.ts +++ b/src/node/routes/apps.ts @@ -12,6 +12,6 @@ export function router(papi: PluginAPI): express.Router { router.get("/", async (req, res) => { res.json(await papi.applications()) }) - + return router } diff --git a/src/node/routes/index.ts b/src/node/routes/index.ts index a39b2a6a..da714eea 100644 --- a/src/node/routes/index.ts +++ b/src/node/routes/index.ts @@ -16,6 +16,7 @@ import { PluginAPI } from "../plugin" import { getMediaMime, paths } from "../util" import { WebsocketRequest } from "../wsRouter" import * as domainProxy from "./domainProxy" +import * as apps from "./apps" import * as health from "./health" import * as login from "./login" import * as proxy from "./pathProxy" @@ -23,7 +24,6 @@ import * as proxy from "./pathProxy" import * as _static from "./static" import * as update from "./update" import * as vscode from "./vscode" -import * as apps from "./apps" declare global { // eslint-disable-next-line @typescript-eslint/no-namespace