Skip to content

Commit

Permalink
feat: commit hash
Browse files Browse the repository at this point in the history
  • Loading branch information
Tanimodori committed Feb 23, 2024
1 parent 8ce7526 commit e23c897
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 104 deletions.
4 changes: 1 addition & 3 deletions packages/preload/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
* @module preload
*/

import { sha256sum } from './nodeCrypto';
import { versions } from './versions';
import * as windowOps from './libs/windowOps';
import * as globalShortcut from './libs/globalShortcut';

export { sha256sum, versions, windowOps, globalShortcut };
export { windowOps, globalShortcut };
5 changes: 0 additions & 5 deletions packages/preload/src/nodeCrypto.ts

This file was deleted.

1 change: 0 additions & 1 deletion packages/preload/src/versions.ts

This file was deleted.

3 changes: 3 additions & 0 deletions packages/renderer/.eslintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
"browser": true,
"node": false
},
"globals": {
"__COMMIT_HASH__": "readonly"
},
"extends": [
/** @see https://eslint.vuejs.org/rules/ */
"plugin:vue/vue3-recommended"
Expand Down
30 changes: 0 additions & 30 deletions packages/renderer/src/components/ElectronVersions.vue

This file was deleted.

12 changes: 0 additions & 12 deletions packages/renderer/src/components/ReactiveCounter.vue

This file was deleted.

53 changes: 0 additions & 53 deletions packages/renderer/src/components/ReactiveHash.vue

This file was deleted.

4 changes: 4 additions & 0 deletions packages/renderer/src/views/settings/SettingsView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
{{ $t('settings.about.title') }}
</a-divider>
<div class="about">
{{ `GBFR-ACT-Frontend v${APP_VERSION} (${commitHash})` }}
<br />
{{ $t('settings.about.mit') }}
<br />
{{ $t('settings.about.copyright') }}
Expand All @@ -49,6 +51,8 @@
import StyleSettings from './StyleSettings.vue';
import LayoutSettings from './LayoutSettings.vue';
import ShortcutSettings from './ShortcutSettings.vue';
const APP_VERSION = import.meta.env.VITE_APP_VERSION;
const commitHash = __COMMIT_HASH__;
</script>

<style scoped lang="less">
Expand Down
5 changes: 5 additions & 0 deletions packages/renderer/types/env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
declare global {
const __COMMIT_HASH__: string;
}

export {};
6 changes: 6 additions & 0 deletions packages/renderer/vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { renderer } from 'unplugin-auto-expose';
import { join } from 'node:path';
import Icons from 'unplugin-icons/vite';
import VueI18nPlugin from '@intlify/unplugin-vue-i18n/vite';
import { execSync } from 'child_process';

const commitHash = execSync('git rev-parse --short HEAD').toString().trim();

const PACKAGE_ROOT = __dirname;
const PROJECT_ROOT = join(PACKAGE_ROOT, '../..');
Expand All @@ -24,6 +27,9 @@ const config = {
'vue-i18n': 'vue-i18n/dist/vue-i18n.runtime.esm-bundler.js',
},
},
define: {
__COMMIT_HASH__: JSON.stringify(commitHash),
},
base: '',
server: {
fs: {
Expand Down

0 comments on commit e23c897

Please sign in to comment.