1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

allow to use semver.parse range format

Signed-off-by: Roman <ixrock@gmail.com>
This commit is contained in:
Roman 2022-05-10 19:38:02 +03:00
parent c6c72a0f11
commit 8347937fc0
2 changed files with 2 additions and 2 deletions

View File

@ -62,7 +62,7 @@ describe("Extension/App versions compatibility check", () => {
it("is compatible with lensEngine with prerelease", () => {
expect(isCompatibleExtension({
appSemVer: semver.coerce("5.5.0-alpha.0"),
appSemVer: semver.parse("5.5.0-alpha.0"),
})(getExtensionManifestMock({
lensEngine: "^5.4.0-alpha.0",
}))).toBeTruthy();

View File

@ -11,7 +11,7 @@ interface Dependencies {
export const isCompatibleExtension = ({ appSemVer }: Dependencies): ((manifest: LensExtensionManifest) => boolean) => {
return (manifest: LensExtensionManifest): boolean => {
const { raw: appVersion } = appSemVer;
const appVersion = appSemVer.raw.split("-")[0]; // drop prerelease version if any, e.g. "-alpha.0"
const manifestLensEngine = manifest.engines.lens;
const validVersion = manifestLensEngine.match(/^[\^0-9]\d*\.\d+\b/); // must start from ^ or number