Skip to content

Commit

Permalink
try different approach 2
Browse files Browse the repository at this point in the history
  • Loading branch information
BastianGanze committed Aug 26, 2023
1 parent 97d1222 commit c7e9353
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "weebsync",
"version": "0.7.3",
"version": "0.7.4",
"description": "A small tool to automatically sync files from an ftp server.",
"license": "MIT",
"private": true,
Expand All @@ -11,9 +11,9 @@
],
"outputPath": "dist",
"targets": [
"node16-linuxstatic",
"node16-win-x64",
"node16-mac-x64"
"node18-linuxstatic",
"node18-win-x64",
"node18-mac-x64"
]
},
"scripts": {
Expand Down
23 changes: 18 additions & 5 deletions server/src/plugin-system.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,11 +125,24 @@ async function loadPlugin(
) {
try {
const thisPluginDirectory = `${pluginDir}/${pluginFolder}`;
const plugin = (
(await import(`${thisPluginDirectory}/index.mjs`)) as {
default: WeebsyncPlugin;
}
).default;
let plugin: WeebsyncPlugin;
try {
plugin = (
(await import(`${thisPluginDirectory}/index.mjs`)) as {
default: WeebsyncPlugin;
}
).default;
} catch (e) {
applicationState.communication.logWarning(
"Could not load plugin as .mjs, trying .js now...",
);
plugin = (
(await import(`${thisPluginDirectory}/index.js`)) as {
default: WeebsyncPlugin;
}
).default;
}

pluginApis[plugin.name] = {
applicationState,
communication: applicationState.communication,
Expand Down

0 comments on commit c7e9353

Please sign in to comment.