Archived
1
0

plugin: Plugin modules now export a single top level identifier

Makes typing much easier. Addresse's Will's last comment.
This commit is contained in:
Anmol Sethi
2020-11-04 23:10:41 -05:00
parent 8a8159c683
commit 14f408a837
3 changed files with 39 additions and 31 deletions

View File

@ -2,33 +2,35 @@ import * as express from "express"
import * as fspath from "path"
import * as pluginapi from "../../../typings/pluginapi"
export const displayName = "Test Plugin"
export const routerPath = "/test-plugin"
export const homepageURL = "https://example.com"
export const description = "Plugin used in code-server tests."
export const plugin: pluginapi.Plugin = {
displayName: "Test Plugin",
routerPath: "/test-plugin",
homepageURL: "https://example.com",
description: "Plugin used in code-server tests.",
export function init(config: pluginapi.PluginConfig) {
config.logger.debug("test-plugin loaded!")
}
export function router(): express.Router {
const r = express.Router()
r.get("/goland/icon.svg", (req, res) => {
res.sendFile(fspath.resolve(__dirname, "../public/icon.svg"))
})
return r
}
export function applications(): pluginapi.Application[] {
return [
{
name: "Test App",
version: "4.0.0",
iconPath: "/icon.svg",
path: "/test-app",
description: "This app does XYZ.",
homepageURL: "https://example.com",
},
]
init: (config) => {
config.logger.debug("test-plugin loaded!")
},
router: () => {
const r = express.Router()
r.get("/goland/icon.svg", (req, res) => {
res.sendFile(fspath.resolve(__dirname, "../public/icon.svg"))
})
return r
},
applications: () => {
return [
{
name: "Test App",
version: "4.0.0",
iconPath: "/icon.svg",
path: "/test-app",
description: "This app does XYZ.",
homepageURL: "https://example.com",
},
]
},
}