diff --git a/src/components/Settings.tsx b/src/components/Settings.tsx index 4eea977a..854616b1 100644 --- a/src/components/Settings.tsx +++ b/src/components/Settings.tsx @@ -1,3 +1,4 @@ +/* global __APP_VERSION__, __GIT_COMMIT__, __GIT_COMMIT_URL__ */ import React, { useState, useEffect, useRef } from 'react' import { faTimes, faUndo } from '@fortawesome/free-solid-svg-icons' import { RelayPool } from 'applesauce-relay' diff --git a/src/vite-env.d.ts b/src/vite-env.d.ts index 866850ab..af4f4bdb 100644 --- a/src/vite-env.d.ts +++ b/src/vite-env.d.ts @@ -8,3 +8,10 @@ declare module '*.svg?raw' { const content: string export default content } + +// Build-time defines injected by Vite in vite.config.ts +declare const __APP_VERSION__: string +declare const __GIT_COMMIT__: string +declare const __GIT_BRANCH__: string +declare const __BUILD_TIME__: string +declare const __GIT_COMMIT_URL__: string diff --git a/vite.config.ts b/vite.config.ts index 5e07de93..8869630d 100644 --- a/vite.config.ts +++ b/vite.config.ts @@ -1,3 +1,4 @@ +/* eslint-env node */ import { defineConfig } from 'vite' import react from '@vitejs/plugin-react' import { VitePWA } from 'vite-plugin-pwa' @@ -11,10 +12,14 @@ function getGitMetadata() { let branch = envRef try { if (!commit) commit = execSync('git rev-parse HEAD', { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim() - } catch {} + } catch { + // ignore + } try { if (!branch) branch = execSync('git rev-parse --abbrev-ref HEAD', { stdio: ['ignore', 'pipe', 'ignore'] }).toString().trim() - } catch {} + } catch { + // ignore + } return { commit, branch } } @@ -49,7 +54,9 @@ function getCommitUrl(commit: string): string { const cleaned = https.replace(/\.git$/, '') return `${cleaned}/commit/${commit}` } - } catch {} + } catch { + // ignore + } return '' }