Merge #498: validate manifest versions against the root plugin.json

This commit is contained in:
Addy Osmani authored and GitHub committed 2026-09-25 21:15:27 -07:00
commit 9d0583f526
2 files changed
+7 -13

No files matched your search

+3 -7
View File
@@ -1,7 +1,6 @@
"use strict";
const assert = require("node:assert/strict");
const { execFileSync } = require("node:child_process");
const { readFileSync } = require("node:fs");
const test = require("node:test");
@@ -18,12 +17,9 @@ function readManifestVersion(manifestPath) {
return manifest.version ?? manifest.plugins?.[0]?.version;
}
test("all plugin manifests use the latest release tag", () => {
const expectedVersion = execFileSync(
"git",
["describe", "--tags", "--abbrev=0"],
{ encoding: "utf8" },
).trim();
test("all plugin manifests use the root plugin.json version", () => {
const expectedVersion = readManifestVersion("plugin.json");
assert.ok(expectedVersion, "plugin.json must define a version");
for (const manifestPath of manifestPaths) {
assert.equal(
+4 -6
View File
@@ -2,7 +2,6 @@
"use strict";
const { execFileSync } = require("node:child_process");
const { readFileSync } = require("node:fs");
const manifestPaths = [
@@ -18,11 +17,10 @@ function readManifestVersion(manifestPath) {
return manifest.version ?? manifest.plugins?.[0]?.version;
}
const expectedVersion = execFileSync(
"git",
["describe", "--tags", "--abbrev=0"],
{ encoding: "utf8" },
).trim();
const expectedVersion = readManifestVersion("plugin.json");
if (!expectedVersion) {
throw new Error("plugin.json is missing a version field");
}
for (const manifestPath of manifestPaths) {
const version = readManifestVersion(manifestPath);