Skip to content

Commit

Permalink
feat: show program version
Browse files Browse the repository at this point in the history
  • Loading branch information
rzuppur committed Oct 21, 2022
1 parent b1f5e14 commit 6686ec6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
{
"name": "rekordfix",
"private": true,
"version": "0.6.0",
"version": "0.7.0",
"main": "packages/main/dist/index.cjs",
"repository": {
"type": "git",
"url": "https://github.com/rzuppur/rekordfix"
},
"scripts": {
"build": "npm run build:main && npm run build:preload && npm run build:renderer",
"build:main": "cd ./packages/main && vite build",
Expand Down
5 changes: 5 additions & 0 deletions packages/main/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,12 @@ async function handlePlaylistSave(
}
}

function handleVersion(): string {
return app.getVersion();
}

app.whenReady().then(() => {
ipcMain.handle('dialog:openFile', handleFileOpen);
ipcMain.handle('downloadPlaylist', handlePlaylistSave);
ipcMain.handle('get:version', handleVersion);
});
4 changes: 4 additions & 0 deletions packages/preload/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,7 @@ export function openXML(): Promise<{xml: Collection; path: string; cancelled?: b
export function downloadPlaylist(content: string, filename: string): Promise<string | undefined> {
return ipcRenderer.invoke('downloadPlaylist', content, filename);
}

export function getVersion(): Promise<string> {
return ipcRenderer.invoke('get:version');
}
9 changes: 8 additions & 1 deletion packages/renderer/src/App.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<script lang="ts" setup>
import {openXML, downloadPlaylist} from '#preload';
import {openXML, downloadPlaylist, getVersion} from '#preload';
import type {Ref} from 'vue';
import {ref} from 'vue';
import type {Folder, Playlist, TrackData} from '/@/model';
Expand Down Expand Up @@ -144,6 +144,11 @@ const actionSaveDuplicatePlaylist = async () => {
if (path) toast(`✔ Playlist saved to ${path}`);
playlistSaving.value = false;
};
const version = ref('');
(async () => {
version.value = await getVersion();
})();
</script>
<template lang="pug">

Expand Down Expand Up @@ -203,6 +208,8 @@ const actionSaveDuplicatePlaylist = async () => {
r-icon.green.r-m-r-sm(icon="check")
| No duplicates in collection

.r-text-color-muted.r-p-sm.r-text-xxs Rekordfix v{{ version }}

</template>
<style lang="stylus">
Expand Down

0 comments on commit 6686ec6

Please sign in to comment.