Unverified Commit 9f92dfe0 authored by Hong Minhee's avatar Hong Minhee
Browse files

Fix workspace package detection in check-versions

The script was missing packages that exist in pnpm-workspace.yaml but not
in deno.json workspaces. This fix ensures all workspace packages are
properly detected and checked for version consistency.
parent e1bff276
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@
    "@std/async": "jsr:@std/async@^1.0.13",
    "@std/fs": "jsr:@std/fs@^1.0.3",
    "@std/path": "jsr:@std/path@^1.0.6",
    "@std/yaml": "jsr:@std/yaml@^1.0.8",
    "amqplib": "npm:amqplib@^0.10.8",
    "h3": "npm:h3@^1.15.0",
    "ioredis": "npm:ioredis@^5.6.1",
+0 −1
Original line number Diff line number Diff line
@@ -27,7 +27,6 @@
    "@std/assert": "jsr:@std/assert@^0.226.0",
    "@std/testing": "jsr:@std/testing@^0.224.0",
    "@std/url": "jsr:@std/url@^0.225.1",
    "@std/yaml": "jsr:@std/yaml@^0.224.3",
    "asn1js": "npm:asn1js@^3.0.5",
    "byte-encodings": "npm:byte-encodings@^1.0.11",
    "es-toolkit": "jsr:@es-toolkit/es-toolkit@^1.39.5",
+16 −2
Original line number Diff line number Diff line
import { dirname, join } from "@std/path";
import { dirname, fromFileUrl, join, normalize, resolve } from "@std/path";
import { parse } from "@std/yaml";
import workspaceMetadata from "../deno.json" with { type: "json" };
import fedifyMetadata from "../fedify/deno.json" with { type: "json" };

@@ -11,9 +12,22 @@ if (Deno.args.includes("--help") || Deno.args.includes("-h")) {
  Deno.exit(0);
}

const workspaceMembers = workspaceMetadata.workspace;
const fix = Deno.args.includes("--fix") || Deno.args.includes("-f");

const workspaceMembers = workspaceMetadata.workspace;
const pnpmWorkspace = await Deno.readTextFile(
  fromFileUrl(import.meta.resolve("../pnpm-workspace.yaml")),
);
const projectRoot = dirname(import.meta.dirname!);
const normalizedWorkspaceMembers = workspaceMembers.map((member) =>
  normalize(resolve(projectRoot, member))
);
for (const pkg of (parse(pnpmWorkspace) as { packages: string[] }).packages) {
  const normalizedPkg = normalize(resolve(projectRoot, pkg));
  if (normalizedWorkspaceMembers.includes(normalizedPkg)) continue;
  workspaceMembers.push(pkg);
}

let version = fedifyMetadata.version;
let mismatched = 0;
for (const member of workspaceMembers) {