Port global_chat plugin to typescript (#497)

* .js to .ts

* translate

* update paths to dist/plugin

* add "tsc --build" to prepare

* use field main in package.json de find info

* tsc --build need to append before webpack

* update test and use for plugins package.main
This commit is contained in:
Luciole authored and GitHub committed 2023-08-18 00:06:49 +02:00
1 parent 477b600b1b
commit 50f12c719b
26 files changed
+104 -102

No files matched your search

+2 -3
View File
@@ -24,12 +24,11 @@ export async function loadPluginInfos(pluginList: Map<string, string>) {
let plugins: libPlugin.PluginInfo[] = [];
for (let [pluginName, pluginPath] of pluginList) {
let pluginInfo: libPlugin.PluginInfo;
let pluginPackage: { version: string };
let pluginPackage: { version: string, main?: string };
try {
pluginInfo = require(path.posix.join(pluginPath, "info"));
pluginInfo = require(pluginPath).default;
pluginPackage = require(path.posix.join(pluginPath, "package.json"));
} catch (err: any) {
throw new libErrors.PluginError(pluginName, err);
}
+1 -1
View File
@@ -60,7 +60,7 @@ export async function handlePluginCommand(
let pluginInfo: { name: string };
try {
// eslint-disable-next-line node/global-require
pluginInfo = require(path.posix.join(pluginPath, "info"));
pluginInfo = require(pluginPath).default;
} catch (err: any) {
logger.error(`Unable to import plugin info from ${args.path}:\n${err.stack}`);
process.exitCode = 1;