mirror of
https://github.com/thepeacockproject/Peacock
synced 2024-09-25 19:27:54 +02:00
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
|
* @internal
|
||||||
*/
|
*/
|
||||||
private async _loadPlugins(): Promise<void> {
|
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(
|
const entries = (await readdir(process.cwd())).filter(
|
||||||
(n) => isPlugin(n, "js") || isPlugin(n, "cjs"),
|
(n) => isPlugin(n, "js") || isPlugin(n, "cjs"),
|
||||||
)
|
)
|
||||||
|
@ -3,13 +3,13 @@
|
|||||||
This folder contains some tools related to the build/packaging/deployment
|
This folder contains some tools related to the build/packaging/deployment
|
||||||
infrastructure of the project.
|
infrastructure of the project.
|
||||||
|
|
||||||
- `build.mjs` - The esbuild configuration for the server in production.
|
- `build.mjs` - The esbuild configuration for the server in production.
|
||||||
- `buildTasks.mjs` - Pre-bundling of specific files.
|
- `buildTasks.mjs` - Pre-bundling of specific files.
|
||||||
- `devLoader.mjs` - Starts the server in the development environment.
|
- `devLoader.mjs` - Starts the server in the development environment.
|
||||||
- `esbuild-plugin-license.mjs` - esbuild plugin that automatically updates the
|
- `esbuild-plugin-license.mjs` - esbuild plugin that automatically updates the
|
||||||
THIRDPARTYNOTICES.txt file.
|
THIRDPARTYNOTICES.txt file.
|
||||||
- `extractChallengeData.mjs` - a little CLI tool for downloading challenges from
|
- `extractChallengeData.mjs` - a little CLI tool for downloading challenges from
|
||||||
the IOI servers.
|
the IOI servers.
|
||||||
- `HOW_TO_USE.html` - legacy help file.
|
- `HOW_TO_USE.html` - legacy help file.
|
||||||
- `json5ToJson.mjs` - Converts a JSON5 file to a JSON file with the same name (
|
- `json5ToJson.mjs` - Converts a JSON5 file to a JSON file with the same name (
|
||||||
but the JSON extension).
|
but the JSON extension).
|
||||||
|
Loading…
Reference in New Issue
Block a user