Skip to content

Commit

Permalink
ci: handle cases where changeset releases are empty
Browse files Browse the repository at this point in the history
  • Loading branch information
SegaraRai committed Jun 30, 2024
1 parent 15dd271 commit 56171f1
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions scripts/nextVersion.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { spawnSync } from "node:child_process";
import { readFile } from "node:fs/promises";

interface ChangesetStatus {
changesets: unknown[];
releases: { name: string; newVersion: string }[];
}

spawnSync("pnpm", ["changeset", "status", "--output", "changeset-status.json"]);

const changesetStatus = JSON.parse(
await readFile("changeset-status.json", "utf8")
) as { releases: { name: string; newVersion: string }[] };
) as ChangesetStatus;
const release = changesetStatus.releases.find(
(release) => release.name === "vite-plugin-modular-tailwindcss"
);

if (!release) {
console.error("Release not found in changeset status");
process.exit(1);
if (release) {
console.log(release.newVersion);
} else {
console.error("Not ready for release yet.");
}

console.log(release.newVersion);

0 comments on commit 56171f1

Please sign in to comment.