From fcec4de6001262db9e69999f3cea9a15c8c86e55 Mon Sep 17 00:00:00 2001 From: hasundue Date: Sun, 4 Aug 2024 09:36:27 +0900 Subject: [PATCH] fix(core/updates): error on JSR deps with `yanked = false` version --- core/updates.ts | 2 +- core/updates_test.ts | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/core/updates.ts b/core/updates.ts index 89c7fa38..ab5b7ddf 100644 --- a/core/updates.ts +++ b/core/updates.ts @@ -140,7 +140,7 @@ async function getJsrVersions(dep: DependencyState<"jsr">): Promise { assertOk(res); const isJsrPackageMeta = is.ObjectOf({ versions: is.RecordOf( - is.ObjectOf({ yanked: is.OptionalOf(is.LiteralOf(true)) }), + is.ObjectOf({ yanked: is.OptionalOf(is.Boolean) }), is.String, ), }); diff --git a/core/updates_test.ts b/core/updates_test.ts index 9c6935b2..bae00718 100644 --- a/core/updates_test.ts +++ b/core/updates_test.ts @@ -23,7 +23,7 @@ describe("get", () => { }); }); - it("should get an update to a http dep with a v-lead semver", async () => { + it("should get an update to a http dep with a v-prefixed semver", async () => { const dep = parse("https://deno.land/x/flash@v0.8.0"); assertEquals(await get(dep), { released: "v0.8.1", @@ -63,6 +63,11 @@ describe("get", () => { assertEquals(await get(dep), undefined); }); + it("should not throw on a jsr dep with a `yanked = false` version", async () => { + const dep = parse("jsr:@denosaurs/emoji@~0.3.0"); + await get(dep); + }); + it("should get an update to a npm dep", async () => { const dep = parse("npm:@conventional-commits/parser@^0.3.0"); assertEquals(await get(dep), {