1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-18 09:35:20 +02:00
joplin/packages/lib/services/plugins/utils/isCompatible/index.ts

16 lines
618 B
TypeScript

import { compareVersions } from 'compare-versions';
import minVersionForPlatform from './minVersionForPlatform';
import { ManifestSlice } from './types';
import { AppType } from '../../../../models/Setting';
const isVersionCompatible = (appVersion: string, manifestMinVersion: string) => {
return compareVersions(appVersion, manifestMinVersion) >= 0;
};
const isCompatible = (appVersion: string, appType: AppType, manifest: ManifestSlice): boolean => {
const minVersion = minVersionForPlatform(appType, manifest);
return minVersion && isVersionCompatible(appVersion, minVersion);
};
export default isCompatible;