From 673679e4fe70414d4fa6ea02ae15d038bc405142 Mon Sep 17 00:00:00 2001 From: Innei Date: Sat, 9 Nov 2024 18:54:47 +0800 Subject: [PATCH] chore: resolve hotfix updatelog redirect Signed-off-by: Innei --- .../renderer/src/initialize/migrates/index.ts | 5 +++++ changelog/{0.1.2-beta.0.md => 0.1.2.md} | 2 +- changelog/0.2.0-beta.0.md | 22 ------------------- changelog/{0.2.0-beta.1.md => 0.2.0.md} | 0 configs/vite.render.config.ts | 4 +++- scripts/apply-changelog.ts | 6 +++-- 6 files changed, 13 insertions(+), 26 deletions(-) rename changelog/{0.1.2-beta.0.md => 0.1.2.md} (95%) delete mode 100644 changelog/0.2.0-beta.0.md rename changelog/{0.2.0-beta.1.md => 0.2.0.md} (100%) diff --git a/apps/renderer/src/initialize/migrates/index.ts b/apps/renderer/src/initialize/migrates/index.ts index c2b910ccc..13b05ef1e 100644 --- a/apps/renderer/src/initialize/migrates/index.ts +++ b/apps/renderer/src/initialize/migrates/index.ts @@ -16,6 +16,11 @@ export const doMigration = async () => { if (lastVersion === APP_VERSION) return + const lastVersionParts = lastVersion.split("-") + const lastVersionMajorMinor = lastVersionParts[0] + const currentVersionMajorMinor = APP_VERSION.split("-")[0] + if (lastVersionMajorMinor === currentVersionMajorMinor) return + // NOTE: Add migration logic here if (!APP_VERSION.includes("nightly")) { diff --git a/changelog/0.1.2-beta.0.md b/changelog/0.1.2.md similarity index 95% rename from changelog/0.1.2-beta.0.md rename to changelog/0.1.2.md index 83fb7a3b5..9de316899 100644 --- a/changelog/0.1.2-beta.0.md +++ b/changelog/0.1.2.md @@ -1,4 +1,4 @@ -# What's new in v0.1.2-beta.0 +# What's new in v0.1.2 ## Features diff --git a/changelog/0.2.0-beta.0.md b/changelog/0.2.0-beta.0.md deleted file mode 100644 index 880e11f1f..000000000 --- a/changelog/0.2.0-beta.0.md +++ /dev/null @@ -1,22 +0,0 @@ -# What's new in v0.2.0-beta.0 - -## New Features - -- Feed owners can now reset their feeds. -- Image Gallery: Clicking on the image button in the entry opens the Image gallery modal (only if there are multiple large images in the entry!). -- Now you can export the data from the local database. -- App: In consideration of your hard drive, now it supports clearing cache and limiting the size of cache. -- Added a new feature to allow minimizing to the system tray by enabling a switch in the settings. -- Discover Page: Enhance RSSHub recommendations with filters -- Quickly update views or categories at once by dragging and dropping. - -## Improvements - -- Optimized the Zen mode experience on macOS. -- Improvement web app global shortcuts. -- Optimized the Timeline's data cache, reducing data reloads within a short period of time. You can go to Settings -> General -> Timeline -> Reduce timeline refetch to control this feature, default is enabled. - -## Bug Fixes - -- Fixed the issue where the Volume of VideoPlayer was not clickable. -- While using arrow keys to switch between entries, the entry view will not scroll unexpexted. diff --git a/changelog/0.2.0-beta.1.md b/changelog/0.2.0.md similarity index 100% rename from changelog/0.2.0-beta.1.md rename to changelog/0.2.0.md diff --git a/configs/vite.render.config.ts b/configs/vite.render.config.ts index 56ded1550..cc6492e45 100644 --- a/configs/vite.render.config.ts +++ b/configs/vite.render.config.ts @@ -19,8 +19,10 @@ const pkg = JSON.parse(readFileSync(resolve(pkgDir, "./package.json"), "utf8")) const isCI = process.env.CI === "true" || process.env.CI === "1" const getChangelogFileContent = () => { - const { version } = pkg + const { version: pkgVersion } = pkg const isDev = process.env.NODE_ENV === "development" + // get major-minor-patch, e.g. 0.2.0-beta.2 -> 0.2.0 + const version = pkgVersion.split("-")[0] try { return readFileSync(resolve(pkgDir, "./changelog", `${isDev ? "next" : version}.md`), "utf8") } catch { diff --git a/scripts/apply-changelog.ts b/scripts/apply-changelog.ts index b86057635..ff252696a 100644 --- a/scripts/apply-changelog.ts +++ b/scripts/apply-changelog.ts @@ -9,11 +9,13 @@ const nextFile = join(changelogDir, "next.md") const new_version = process.argv[2] +const majorMinorPatch = new_version.split("-")[0] + const nextContent = readFileSync(nextFile, "utf-8") -writeFileSync(nextFile, nextContent.replaceAll("NEXT_VERSION", new_version)) +writeFileSync(nextFile, nextContent.replaceAll("NEXT_VERSION", majorMinorPatch)) // Rename the next.md to the new version -renameSync(nextFile, join(changelogDir, `${new_version}.md`)) +renameSync(nextFile, join(changelogDir, `${majorMinorPatch}.md`)) // Replace the NEXT_VERSION in the next.md file with the new version // Create the new next.md file