mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-18 23:33:12 +09:00
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:
1 parent
477b600b1b
commit
50f12c719b
26 files changed
+104
-102
No files matched your search
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in new issue
Block a user