mirror of
https://github.com/penpot/penpot.git
synced 2026-11-06 10:00:38 +00:00
The plugin compared the full major.minor.patch of the running Penpot version with the MCP package version. The MCP package version is only set per minor release (2.15.0, 2.16.0, 2.17.0), so every Penpot patch release (for example 2.16.2 or 2.17.2) showed the "Version mismatch detected" warning although nothing changed for the MCP. Compare only major.minor, move the check into a small module with unit tests, and update the README versioning note to match. AI-assisted-by: claude-opus-5-5 Signed-off-by: robertkodra <36516516+robertkodra@users.noreply.github.com>
29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import assert from "node:assert/strict";
|
|
import test from "node:test";
|
|
import { extractMinorVersion, isCompatibleVersion } from "./VersionCompatibility.ts";
|
|
|
|
test("extracts major.minor from release and pre-release versions", () => {
|
|
assert.equal(extractMinorVersion("2.18.1"), "2.18");
|
|
assert.equal(extractMinorVersion("2.17.0"), "2.17");
|
|
assert.equal(extractMinorVersion("2.15.0-rc.1.116"), "2.15");
|
|
assert.equal(extractMinorVersion("2.18.1-dev.140"), "2.18");
|
|
assert.equal(extractMinorVersion("2.18"), "2.18");
|
|
});
|
|
|
|
test("returns non-matching versions unchanged", () => {
|
|
assert.equal(extractMinorVersion("<2.15"), "<2.15");
|
|
assert.equal(extractMinorVersion("develop"), "develop");
|
|
});
|
|
|
|
test("treats patch releases of the same minor version as compatible", () => {
|
|
assert.equal(isCompatibleVersion(extractMinorVersion("2.17.2"), extractMinorVersion("2.17.0")), true);
|
|
});
|
|
|
|
test("reports a different minor version as incompatible", () => {
|
|
assert.equal(isCompatibleVersion(extractMinorVersion("2.18.1"), extractMinorVersion("2.17.0")), false);
|
|
});
|
|
|
|
test("treats local development builds of Penpot as compatible", () => {
|
|
assert.equal(isCompatibleVersion(extractMinorVersion("0.0.0"), extractMinorVersion("2.17.0")), true);
|
|
});
|