mirror of
https://github.com/unraid/api.git
synced 2026-02-12 19:18:28 -06:00
fix: unraid-connect plugin not loaded when connect is installed (#1856)
Previously, api plugins could only be installed as `peerDependencies` in the api. This change allows them to be listed as `dependencies` as well. This makes plugin loading (eg loading Connect) more robust. Tests: - [x] Re-logging on 7.3.0-beta.0.5
This commit is contained in:
@@ -91,13 +91,9 @@ export class PluginService {
|
||||
return name;
|
||||
})
|
||||
);
|
||||
const { peerDependencies } = getPackageJson();
|
||||
// All api plugins must be installed as peer dependencies of the unraid-api package
|
||||
if (!peerDependencies) {
|
||||
PluginService.logger.warn('Unraid-API peer dependencies not found; skipping plugins.');
|
||||
return [];
|
||||
}
|
||||
const pluginTuples = Object.entries(peerDependencies).filter(
|
||||
const { peerDependencies = {}, dependencies = {} } = getPackageJson();
|
||||
const allDependencies = { ...peerDependencies, ...dependencies };
|
||||
const pluginTuples = Object.entries(allDependencies).filter(
|
||||
(entry): entry is [string, string] => {
|
||||
const [pkgName, version] = entry;
|
||||
return pluginNames.has(pkgName) && typeof version === 'string';
|
||||
|
||||
Reference in New Issue
Block a user