From dfb8a853749e1d29a7bc5b8dd8baa976112e927b Mon Sep 17 00:00:00 2001 From: Stephen Zhou Date: Mon, 15 Apr 2024 13:17:12 +0800 Subject: [PATCH] fix: patch changelogithub to find correct tag --- package.json | 7 ++++++- patches/changelogithub@0.13.6.patch | 30 +++++++++++++++++++++++++++++ pnpm-lock.yaml | 10 ++++++++-- 3 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 patches/changelogithub@0.13.6.patch diff --git a/package.json b/package.json index e8893f2..e3fa0fa 100644 --- a/package.json +++ b/package.json @@ -86,5 +86,10 @@ "typescript": "^5.4.5", "vitest": "^1.5.0" }, - "prettier": "prettier-config-hyoban" + "prettier": "prettier-config-hyoban", + "pnpm": { + "patchedDependencies": { + "changelogithub@0.13.6": "patches/changelogithub@0.13.6.patch" + } + } } diff --git a/patches/changelogithub@0.13.6.patch b/patches/changelogithub@0.13.6.patch new file mode 100644 index 0000000..0fdaad7 --- /dev/null +++ b/patches/changelogithub@0.13.6.patch @@ -0,0 +1,30 @@ +diff --git a/dist/index.cjs b/dist/index.cjs +index 58583c81c7d53430a0fa0ec4272835d0612a9e0e..af680a98143fcb32435650df652c5e954395210b 100644 +--- a/dist/index.cjs ++++ b/dist/index.cjs +@@ -144,8 +144,8 @@ async function getLastMatchingTag(inputTag) { + const tags = await getGitTags(); + let tag; + if (!isPrerelease2 && isVersion) +- tag = tags.find((tag2) => tag2 !== inputTag && tag2[0] === "v" && !tag2.includes("-")); +- tag || (tag = tags.find((tag2) => tag2 !== inputTag)); ++ tag = tags.find((tag2) => tag2 !== inputTag && semver__default.valid(semver__default.coerce(tag)) && semver__default.prerelease(tag) === null); ++ tag || (tag = tags.find((tag2) => tag2 !== inputTag && semver__default.valid(semver__default.coerce(tag)))); + return tag; + } + async function isRefGitTag(to) { +diff --git a/dist/index.mjs b/dist/index.mjs +index 2aa6747fdfa40e0980f7cfc9480c99536e7c636b..d7587dbcbdeefb608a82b637f36adfd8feff7b68 100644 +--- a/dist/index.mjs ++++ b/dist/index.mjs +@@ -138,8 +138,8 @@ async function getLastMatchingTag(inputTag) { + const tags = await getGitTags(); + let tag; + if (!isPrerelease2 && isVersion) +- tag = tags.find((tag2) => tag2 !== inputTag && tag2[0] === "v" && !tag2.includes("-")); +- tag || (tag = tags.find((tag2) => tag2 !== inputTag)); ++ tag = tags.find((tag2) => tag2 !== inputTag && semver.valid(semver.coerce(tag)) && semver.prerelease(tag) === null); ++ tag || (tag = tags.find((tag2) => tag2 !== inputTag && semver.valid(semver.coerce(tag)))); + return tag; + } + async function isRefGitTag(to) { diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ea58dbe..412bc02 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -4,6 +4,11 @@ settings: autoInstallPeers: true excludeLinksFromLockfile: false +patchedDependencies: + changelogithub@0.13.6: + hash: bp55gl5l5mpi3mkh3b7g5vhtg4 + path: patches/changelogithub@0.13.6.patch + importers: .: @@ -13,7 +18,7 @@ importers: version: /@hyoban/bumpp@9.4.0-1 changelogithub: specifier: ^0.13.6 - version: 0.13.6 + version: 0.13.6(patch_hash=bp55gl5l5mpi3mkh3b7g5vhtg4) conventional-changelog: specifier: ^5.1.0 version: 5.1.0 @@ -1705,7 +1710,7 @@ packages: yaml: 2.4.1 dev: false - /changelogithub@0.13.6: + /changelogithub@0.13.6(patch_hash=bp55gl5l5mpi3mkh3b7g5vhtg4): resolution: {integrity: sha512-cxkPxGSG51gDX0rjSNbsBAPbM4elTjpTcvmQGqTQ4GPoA6H2/iIbhgo4Dr/SzOsthw+sChrfgPnwIYadA2xmlg==} engines: {node: '>=12.0.0'} hasBin: true @@ -1720,6 +1725,7 @@ packages: ofetch: 1.3.4 semver: 7.6.0 dev: false + patched: true /chardet@0.7.0: resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==}