show version & bump

This commit is contained in:
Will Chen
2025-04-15 00:22:19 -07:00
parent caa9a1566e
commit 6b0df21a05
5 changed files with 40 additions and 1 deletions

View File

@@ -1071,4 +1071,11 @@ export function registerAppHandlers() {
return { success: true, message: "Successfully reset everything" };
});
ipcMain.handle("get-app-version", async () => {
// Read version from package.json at project root
const packageJsonPath = path.resolve(__dirname, "..", "..", "package.json");
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
return { version: packageJson.version };
});
}

View File

@@ -617,6 +617,17 @@ export class IpcClient {
}
// --- End GitHub Repo Management ---
// Get the main app version
public async getAppVersion(): Promise<string> {
try {
const result = await this.ipcRenderer.invoke("get-app-version");
return result.version as string;
} catch (error) {
showError(error);
throw error;
}
}
// Example methods for listening to events (if needed)
// public on(channel: string, func: (...args: any[]) => void): void {
}

View File

@@ -26,6 +26,7 @@ export default function SettingsPage() {
const [nodeVersion, setNodeVersion] = useState<string | null>(null);
const [npmVersion, setNpmVersion] = useState<string | null>(null);
const [downloadClicked, setDownloadClicked] = useState(false);
const [appVersion, setAppVersion] = useState<string | null>(null);
useEffect(() => {
const checkNode = async () => {
@@ -40,6 +41,17 @@ export default function SettingsPage() {
}
};
checkNode();
// Fetch app version
const fetchVersion = async () => {
try {
const version = await IpcClient.getInstance().getAppVersion();
setAppVersion(version);
} catch (error) {
setAppVersion(null);
}
};
fetchVersion();
}, []);
const handleResetEverything = async () => {
@@ -123,6 +135,14 @@ export default function SettingsPage() {
Settings
</h1>
{/* App Version Section */}
<div className="mb-6 flex items-center text-sm text-gray-500 dark:text-gray-400">
<span className="mr-2 font-medium">App Version:</span>
<span className="bg-gray-100 dark:bg-gray-700 px-2 py-0.5 rounded text-gray-800 dark:text-gray-200 font-mono">
{appVersion ? appVersion : "-"}
</span>
</div>
<div className="space-y-6">
<div className="bg-white dark:bg-gray-800 rounded-xl shadow-sm p-6">
<h2 className="text-lg font-medium text-gray-900 dark:text-white mb-4">

View File

@@ -36,6 +36,7 @@ const validInvokeChannels = [
"github:is-repo-available",
"github:create-repo",
"github:push",
"get-app-version",
] as const;
// Add valid receive channels