show version & bump
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "dyad",
|
||||
"productName": "dyad",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"description": "My Electron application description",
|
||||
"main": ".vite/build/main.js",
|
||||
"repository": {
|
||||
|
||||
@@ -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 };
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -36,6 +36,7 @@ const validInvokeChannels = [
|
||||
"github:is-repo-available",
|
||||
"github:create-repo",
|
||||
"github:push",
|
||||
"get-app-version",
|
||||
] as const;
|
||||
|
||||
// Add valid receive channels
|
||||
|
||||
Reference in New Issue
Block a user