mirror of
https://github.com/certimate-go/certimate.git
synced 2026-09-24 23:10:13 +08:00
fix(ui): fix version comparer
This commit is contained in:
@@ -90,11 +90,11 @@ const useVersionChecker = () => {
|
||||
|
||||
if (releases[nIdx]) {
|
||||
localStorage.setItem(LOCAL_STORAGE_KEY, releases[nIdx].name);
|
||||
return compareVersions(releases[nIdx].name, APP_VERSION) === 1;
|
||||
} else {
|
||||
localStorage.removeItem(LOCAL_STORAGE_KEY);
|
||||
return false;
|
||||
}
|
||||
|
||||
return !!releases[nIdx];
|
||||
},
|
||||
{
|
||||
manual: true,
|
||||
|
||||
+4
-1
@@ -33,13 +33,16 @@ const preserveFilesPlugin = (filesToPreserve: string[]): Plugin => {
|
||||
};
|
||||
};
|
||||
|
||||
export default defineConfig(() => {
|
||||
export default defineConfig(({ command }) => {
|
||||
let appVersion = undefined;
|
||||
try {
|
||||
const content = fs.readFileSync(path.resolve(__dirname, "../internal/app/app.go"), "utf-8");
|
||||
const matches = content.match(/AppVersion\s+=\s+"(.+?)"/);
|
||||
if (matches) {
|
||||
appVersion = matches[1];
|
||||
if (command === "serve") {
|
||||
appVersion += "-dev";
|
||||
}
|
||||
console.info("[certimate] AppVersion is " + appVersion);
|
||||
} else {
|
||||
throw new Error("AppVersion not found in '/internal/app/app.go'");
|
||||
|
||||
Reference in New Issue
Block a user