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:
parent
c6c72a0f11
commit
8347937fc0
@ -62,7 +62,7 @@ describe("Extension/App versions compatibility check", () => {
|
|||||||
|
|
||||||
it("is compatible with lensEngine with prerelease", () => {
|
it("is compatible with lensEngine with prerelease", () => {
|
||||||
expect(isCompatibleExtension({
|
expect(isCompatibleExtension({
|
||||||
appSemVer: semver.coerce("5.5.0-alpha.0"),
|
appSemVer: semver.parse("5.5.0-alpha.0"),
|
||||||
})(getExtensionManifestMock({
|
})(getExtensionManifestMock({
|
||||||
lensEngine: "^5.4.0-alpha.0",
|
lensEngine: "^5.4.0-alpha.0",
|
||||||
}))).toBeTruthy();
|
}))).toBeTruthy();
|
||||||
|
|||||||
@ -11,7 +11,7 @@ interface Dependencies {
|
|||||||
|
|
||||||
export const isCompatibleExtension = ({ appSemVer }: Dependencies): ((manifest: LensExtensionManifest) => boolean) => {
|
export const isCompatibleExtension = ({ appSemVer }: Dependencies): ((manifest: LensExtensionManifest) => boolean) => {
|
||||||
return (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 manifestLensEngine = manifest.engines.lens;
|
||||||
const validVersion = manifestLensEngine.match(/^[\^0-9]\d*\.\d+\b/); // must start from ^ or number
|
const validVersion = manifestLensEngine.match(/^[\^0-9]\d*\.\d+\b/); // must start from ^ or number
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user