mirror of
https://github.com/clusterio/clusterio.git
synced 2026-11-15 23:24:52 +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
@@ -12,7 +12,7 @@ const lib = require("@clusterio/lib");
|
||||
const { LineSplitter, ConsoleTransport, logger } = lib;
|
||||
|
||||
// Make sure permissions from plugins are loaded
|
||||
require("../../plugins/global_chat/info");
|
||||
require("../../plugins/global_chat/dist/plugin/info");
|
||||
require("../../plugins/player_auth/info");
|
||||
require("../../plugins/research_sync/info");
|
||||
require("../../plugins/statistics_exporter/info");
|
||||
|
||||
@@ -18,11 +18,11 @@ describe("lib/plugin_loader", function() {
|
||||
async function writePlugin(pluginPath, infoName) {
|
||||
await fs.outputFile(
|
||||
path.join(pluginPath, "info.js"),
|
||||
`module.exports = { name: "${infoName}" };`
|
||||
`module.exports.default = { name: "${infoName}" };`
|
||||
);
|
||||
await fs.outputFile(
|
||||
path.join(pluginPath, "package.json"),
|
||||
'{ "version": "0.0.1" }'
|
||||
'{ "version": "0.0.1", "main":"info.js" }'
|
||||
);
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ describe("lib/plugin_loader", function() {
|
||||
it("should throw on missing plugin", async function() {
|
||||
await assert.rejects(
|
||||
lib.loadPluginInfos(new Map([["missing", missingPlugin]]), []),
|
||||
new RegExp(`^Error: PluginError: Cannot find module '${escapeRegExp(missingPlugin)}/info'`)
|
||||
new RegExp(`^Error: PluginError: Cannot find module '${escapeRegExp(missingPlugin)}'`)
|
||||
);
|
||||
});
|
||||
it("should load test plugin", async function() {
|
||||
|
||||
Reference in new issue
Block a user