Add hybrid versioning scripts, version shown in app footer
This commit is contained in:
25
src/App.tsx
25
src/App.tsx
@@ -19,7 +19,7 @@ import Settings from './components/settings';
|
||||
import LanguageSelector from './components/language-selector';
|
||||
import DisclaimerModal from './components/disclaimer-modal';
|
||||
import { Button } from './components/ui/button';
|
||||
import { PROJECT_REPOSITORY_URL } from './constants/defaults';
|
||||
import { PROJECT_REPOSITORY_URL, APP_VERSION } from './constants/defaults';
|
||||
|
||||
// Custom Hooks
|
||||
import { useAppState } from './hooks/useAppState';
|
||||
@@ -220,15 +220,20 @@ const MedPlanAssistant = () => {
|
||||
>
|
||||
{t('disclaimerModalFooterLink')}
|
||||
</Button>
|
||||
<a
|
||||
href={PROJECT_REPOSITORY_URL}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center justify-center w-8 h-8 rounded-md hover:bg-accent text-foreground hover:text-accent-foreground transition-colors"
|
||||
title={t('footerProjectRepo')}
|
||||
>
|
||||
<GitBranch size={18} />
|
||||
</a>
|
||||
<div className="flex items-center gap-3">
|
||||
<span className="text-xs text-muted-foreground" title={`Version: ${APP_VERSION}${APP_VERSION.endsWith('-dirty') ? ' (uncommitted changes)' : ''}`}>
|
||||
v{APP_VERSION}
|
||||
</span>
|
||||
<a
|
||||
href={PROJECT_REPOSITORY_URL}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className="inline-flex items-center justify-center w-8 h-8 rounded-md hover:bg-accent text-foreground hover:text-accent-foreground transition-colors"
|
||||
title={t('footerProjectRepo')}
|
||||
>
|
||||
<GitBranch size={18} />
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
@@ -8,8 +8,28 @@
|
||||
* @license MIT
|
||||
*/
|
||||
|
||||
import packageJson from '../../package.json';
|
||||
// Direct import of version.json - Vite handles this natively with import assertions
|
||||
// This file is generated by prebuild script with git info
|
||||
// @ts-ignore
|
||||
import versionJsonDefault from '../version.json' assert { type: 'json' };
|
||||
|
||||
// Use the imported version.json, or fall back to -dev version
|
||||
const versionInfo = versionJsonDefault && Object.keys(versionJsonDefault).length > 0 && versionJsonDefault.version && !versionJsonDefault.version.includes('unknown')
|
||||
? versionJsonDefault
|
||||
: {
|
||||
version: `${packageJson.version}-dev`,
|
||||
semver: packageJson.version,
|
||||
commit: 'unknown',
|
||||
branch: 'unknown',
|
||||
buildDate: new Date().toISOString(),
|
||||
gitDate: 'unknown',
|
||||
};
|
||||
|
||||
export const LOCAL_STORAGE_KEY = 'medPlanAssistantState_v7';
|
||||
export const PROJECT_REPOSITORY_URL = 'https://git.11001001.org/cbaoth/med-plan-assistant';
|
||||
export const APP_VERSION = versionInfo.version;
|
||||
export const BUILD_INFO = versionInfo;
|
||||
|
||||
// Pharmacokinetic Constants (from research literature)
|
||||
// MW ratio: 135.21 (d-amphetamine) / 455.60 (LDX dimesylate) = 0.29677
|
||||
|
||||
8
src/version.json.template
Normal file
8
src/version.json.template
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"version": "0.0.0-dev",
|
||||
"semver": "0.0.0",
|
||||
"commit": "unknown",
|
||||
"branch": "unknown",
|
||||
"buildDate": "1970-01-01T00:00:00.000Z",
|
||||
"gitDate": "unknown"
|
||||
}
|
||||
Reference in New Issue
Block a user