plugin: Fixes for CI
This commit is contained in:
parent
af73b96313
commit
706bc23f04
@ -6,7 +6,7 @@ main() {
|
|||||||
|
|
||||||
cd test/test-plugin
|
cd test/test-plugin
|
||||||
make -s out/index.js
|
make -s out/index.js
|
||||||
cd $OLDPWD
|
cd "$OLDPWD"
|
||||||
mocha -r ts-node/register ./test/*.test.ts "$@"
|
mocha -r ts-node/register ./test/*.test.ts "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,14 +54,14 @@ export class PluginAPI {
|
|||||||
*/
|
*/
|
||||||
public async applications(): Promise<Application[]> {
|
public async applications(): Promise<Application[]> {
|
||||||
const apps = new Array<Application>()
|
const apps = new Array<Application>()
|
||||||
for (const [_, p] of this.plugins) {
|
for (const [, p] of this.plugins) {
|
||||||
const pluginApps = await p.applications()
|
const pluginApps = await p.applications()
|
||||||
|
|
||||||
// Add plugin key to each app.
|
// Add plugin key to each app.
|
||||||
apps.push(
|
apps.push(
|
||||||
...pluginApps.map((app) => {
|
...pluginApps.map((app) => {
|
||||||
app = {...app, path: path.join(p.routerPath, app.path || "")}
|
app = { ...app, path: path.join(p.routerPath, app.path || "") }
|
||||||
app = {...app, iconPath: path.join(app.path || "", app.iconPath)}
|
app = { ...app, iconPath: path.join(app.path || "", app.iconPath) }
|
||||||
return {
|
return {
|
||||||
...app,
|
...app,
|
||||||
plugin: {
|
plugin: {
|
||||||
@ -85,7 +85,7 @@ export class PluginAPI {
|
|||||||
* mount mounts all plugin routers onto r.
|
* mount mounts all plugin routers onto r.
|
||||||
*/
|
*/
|
||||||
public mount(r: express.Router): void {
|
public mount(r: express.Router): void {
|
||||||
for (const [_, p] of this.plugins) {
|
for (const [, p] of this.plugins) {
|
||||||
r.use(`/${p.name}`, p.router())
|
r.use(`/${p.name}`, p.router())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -142,7 +142,7 @@ export class PluginAPI {
|
|||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
})
|
})
|
||||||
const packageJSON: PackageJSON = JSON.parse(str)
|
const packageJSON: PackageJSON = JSON.parse(str)
|
||||||
for (const [_, p] of this.plugins) {
|
for (const [, p] of this.plugins) {
|
||||||
if (p.name === packageJSON.name) {
|
if (p.name === packageJSON.name) {
|
||||||
this.logger.warn(
|
this.logger.warn(
|
||||||
`ignoring duplicate plugin ${q(p.name)} at ${q(dir)}, using previously loaded ${q(p.modulePath)}`,
|
`ignoring duplicate plugin ${q(p.name)} at ${q(dir)}, using previously loaded ${q(p.modulePath)}`,
|
||||||
|
@ -12,6 +12,6 @@ export function router(papi: PluginAPI): express.Router {
|
|||||||
router.get("/", async (req, res) => {
|
router.get("/", async (req, res) => {
|
||||||
res.json(await papi.applications())
|
res.json(await papi.applications())
|
||||||
})
|
})
|
||||||
|
|
||||||
return router
|
return router
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import { PluginAPI } from "../plugin"
|
|||||||
import { getMediaMime, paths } from "../util"
|
import { getMediaMime, paths } from "../util"
|
||||||
import { WebsocketRequest } from "../wsRouter"
|
import { WebsocketRequest } from "../wsRouter"
|
||||||
import * as domainProxy from "./domainProxy"
|
import * as domainProxy from "./domainProxy"
|
||||||
|
import * as apps from "./apps"
|
||||||
import * as health from "./health"
|
import * as health from "./health"
|
||||||
import * as login from "./login"
|
import * as login from "./login"
|
||||||
import * as proxy from "./pathProxy"
|
import * as proxy from "./pathProxy"
|
||||||
@ -23,7 +24,6 @@ import * as proxy from "./pathProxy"
|
|||||||
import * as _static from "./static"
|
import * as _static from "./static"
|
||||||
import * as update from "./update"
|
import * as update from "./update"
|
||||||
import * as vscode from "./vscode"
|
import * as vscode from "./vscode"
|
||||||
import * as apps from "./apps"
|
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
// eslint-disable-next-line @typescript-eslint/no-namespace
|
||||||
|
Loading…
Reference in New Issue
Block a user