mirror of
https://github.com/dergigi/boris.git
synced 2025-12-18 15:14:20 +01:00
fix(types): add global declarations for build-time defines and fix eslint issues
This commit is contained in:
@@ -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'
|
||||
|
||||
7
src/vite-env.d.ts
vendored
7
src/vite-env.d.ts
vendored
@@ -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
|
||||
|
||||
@@ -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 ''
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user