Skip to content

Commit

Permalink
Fix broken ignore regexp matching
Browse files Browse the repository at this point in the history
  • Loading branch information
jhheider committed Jul 11, 2022
1 parent 71a97e3 commit 7a96464
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hooks/useGitHubAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,14 @@ export default function useGitHubAPI(): Response {
const releases = await GET<GHRelease[]>(`https://api.github.com/repos/${user}/${repo}/releases`, RELOAD_POLICY)
// All of this will be moot once we implement proper version-mapping per package
return releases.compactMap(({ tag_name, name }) => {
const raw_version = (tag_name ?? name ?? "").replace(/-/, '+')
const raw_version = (tag_name ?? name ?? "")
if (ignoredVersions?.some(v => raw_version.match(v))) { return undefined }
const munged_raw = raw_version.replace(/-/, '+')

// This isn't great, but per-package versions.ts support will allow us to use strict parsing throughout
// coerce is much looser, and misses things like build IDs and
// pre-release identifiers
return flatMap(raw_version, x => semver.parse(x) || semver.coerce(x))
return flatMap(munged_raw, x => semver.parse(x) || semver.coerce(x))
}, { throws: true })
}
return { getVersions }
Expand Down

0 comments on commit 7a96464

Please sign in to comment.