diff --git a/backend/package.json b/backend/package.json index 98785ea..33f4123 100644 --- a/backend/package.json +++ b/backend/package.json @@ -18,9 +18,9 @@ "test:cov": "jest --coverage", "test:debug": "node --inspect-brk -r tsconfig-paths/register -r ts-node/register node_modules/.bin/jest --runInBand", "test:e2e": "jest --config ./test/jest-e2e.json", - "publish:patch": "npm version -w packages/reiverr-plugin --git-tag-version false patch && npm run -w packages/reiverr-plugin build && npm publish -w packages/reiverr-plugin", - "publish:minor": "npm version -w packages/reiverr-plugin --git-tag-version false minor && npm run -w packages/reiverr-plugin build && npm publish -w packages/reiverr-plugin", - "publish:major": "npm version -w packages/reiverr-plugin --git-tag-version false major && npm run -w packages/reiverr-plugin build && npm publish -w packages/reiverr-plugin", + "publish:patch": "npm version -w packages/reiverr-plugin --git-tag-version false --workspaces-update false patch && npm run -w packages/reiverr-plugin build && npm publish -w packages/reiverr-plugin", + "publish:minor": "npm version -w packages/reiverr-plugin --git-tag-version false --workspaces-update false minor && npm run -w packages/reiverr-plugin build && npm publish -w packages/reiverr-plugin", + "publish:major": "npm version -w packages/reiverr-plugin --git-tag-version false --workspaces-update false major && npm run -w packages/reiverr-plugin build && npm publish -w packages/reiverr-plugin", "openapi:generate:tmdb": "ts-node scripts/generate-tmdb-openapi.ts", "openapi:generate-spec": "ts-node scripts/generate-openapi-spec.ts", "typeorm": "ts-node ./node_modules/typeorm/cli", diff --git a/backend/packages/reiverr-plugin/package.json b/backend/packages/reiverr-plugin/package.json index f9342c7..7978d54 100644 --- a/backend/packages/reiverr-plugin/package.json +++ b/backend/packages/reiverr-plugin/package.json @@ -1,14 +1,14 @@ { "name": "@aleksilassila/reiverr-plugin", - "version": "2.0.0", + "version": "2.1.0", "main": "dist/src/index", + "types": "./dist/src/index.d.ts", "scripts": { "build": "tsc" }, "author": "", "license": "ISC", "devDependencies": {}, - "types": "./dist/index.d.ts", "description": "", "publishConfig": { "registry": "https://npm.pkg.github.com/" diff --git a/backend/packages/reiverr-plugin/src/plugin.ts b/backend/packages/reiverr-plugin/src/plugin.ts index 7d1baba..4799551 100644 --- a/backend/packages/reiverr-plugin/src/plugin.ts +++ b/backend/packages/reiverr-plugin/src/plugin.ts @@ -141,11 +141,14 @@ export abstract class SourceProvider { options: { context: UserContext; uri: string; targetUrl?: string }, ) => Promise; + _getPluginVersion(): string { + return getReiverrPluginVersion(); + } + _isCompatibleWith(version: string): boolean { const pluginVersion = getReiverrPluginVersion(); const pluginVersionParts = pluginVersion.split('.'); const versionParts = version.split('.'); - console.log('comparing versions', pluginVersion, version); if ( !pluginVersionParts.length || diff --git a/backend/src/source-providers/source-providers.service.ts b/backend/src/source-providers/source-providers.service.ts index 3bdb4db..9bab9f2 100644 --- a/backend/src/source-providers/source-providers.service.ts +++ b/backend/src/source-providers/source-providers.service.ts @@ -45,13 +45,18 @@ export class SourceProvidersService { for (const pluginPath of pluginPaths) { try { + const supportedPluginVersion = getReiverrPluginVersion(); // eslint-disable-next-line @typescript-eslint/no-var-requires const pluginModule = require(pluginPath); const provider: PluginProvider = new pluginModule.default() as PluginProvider; provider.getPlugins().forEach((plugin) => { - if (plugin._isCompatibleWith(getReiverrPluginVersion())) { + if (plugin._isCompatibleWith(supportedPluginVersion)) { plugins[plugin.name] = plugin; + } else { + this.logger.warn( + `Plugin ${plugin.name}@${plugin._getPluginVersion()} is not compatible with Reiverr plugin API version ${supportedPluginVersion}`, + ); } }); } catch (e) {