feat(plugins): Load plugins from "plugins" folder (#1)
This commit is contained in:
parent
dc112cfdf4
commit
d8827a0097
|
@ -869,11 +869,23 @@ export class Controller {
|
|||
}
|
||||
|
||||
/**
|
||||
* Loads all normal, pre-built or pure JS plugins.
|
||||
* Loads all normal, pre-built or pure JS plugins either from root or plugins folder.
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
private async _loadPlugins(): Promise<void> {
|
||||
if (existsSync("plugins")) {
|
||||
const entries = (
|
||||
await readdir(join(process.cwd(), "plugins"))
|
||||
).filter((n) => isPlugin(n, "js") || isPlugin(n, "cjs"))
|
||||
|
||||
for (const plugin of entries) {
|
||||
const sourceFile = join(process.cwd(), "plugins", plugin)
|
||||
const src = (await readFile(sourceFile)).toString()
|
||||
|
||||
await this._executePlugin(plugin, src, sourceFile)
|
||||
}
|
||||
}
|
||||
const entries = (await readdir(process.cwd())).filter(
|
||||
(n) => isPlugin(n, "js") || isPlugin(n, "cjs"),
|
||||
)
|
||||
|
|
|
@ -3,13 +3,13 @@
|
|||
This folder contains some tools related to the build/packaging/deployment
|
||||
infrastructure of the project.
|
||||
|
||||
- `build.mjs` - The esbuild configuration for the server in production.
|
||||
- `buildTasks.mjs` - Pre-bundling of specific files.
|
||||
- `devLoader.mjs` - Starts the server in the development environment.
|
||||
- `esbuild-plugin-license.mjs` - esbuild plugin that automatically updates the
|
||||
THIRDPARTYNOTICES.txt file.
|
||||
- `extractChallengeData.mjs` - a little CLI tool for downloading challenges from
|
||||
the IOI servers.
|
||||
- `HOW_TO_USE.html` - legacy help file.
|
||||
- `json5ToJson.mjs` - Converts a JSON5 file to a JSON file with the same name (
|
||||
but the JSON extension).
|
||||
- `build.mjs` - The esbuild configuration for the server in production.
|
||||
- `buildTasks.mjs` - Pre-bundling of specific files.
|
||||
- `devLoader.mjs` - Starts the server in the development environment.
|
||||
- `esbuild-plugin-license.mjs` - esbuild plugin that automatically updates the
|
||||
THIRDPARTYNOTICES.txt file.
|
||||
- `extractChallengeData.mjs` - a little CLI tool for downloading challenges from
|
||||
the IOI servers.
|
||||
- `HOW_TO_USE.html` - legacy help file.
|
||||
- `json5ToJson.mjs` - Converts a JSON5 file to a JSON file with the same name (
|
||||
but the JSON extension).
|
||||
|
|
Loading…
Reference in New Issue