feat: implement version bump workflow and display app version on DashboardPage
This commit is contained in:
11
frontend/src/__tests__/pages/DashboardPage.test.tsx
Normal file
11
frontend/src/__tests__/pages/DashboardPage.test.tsx
Normal file
@@ -0,0 +1,11 @@
|
||||
import { render, screen } from '@testing-library/react'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import DashboardPage from '@/pages/DashboardPage'
|
||||
|
||||
describe('DashboardPage', () => {
|
||||
it('should_display_app_version_when_rendered', () => {
|
||||
render(<DashboardPage />)
|
||||
|
||||
expect(screen.getByText(/version 0.1.0/i)).toBeInTheDocument()
|
||||
})
|
||||
})
|
||||
@@ -1,8 +1,11 @@
|
||||
export default function DashboardPage() {
|
||||
const appVersion = __APP_VERSION__
|
||||
|
||||
return (
|
||||
<div className="p-8">
|
||||
<h1 className="text-2xl font-bold text-gray-900">Dashboard</h1>
|
||||
<p className="mt-2 text-sm text-gray-500">Dashboard — coming in Step 11.</p>
|
||||
<p className="mt-2 text-xs text-gray-400">Version {appVersion}</p>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
3
frontend/src/vite-env.d.ts
vendored
Normal file
3
frontend/src/vite-env.d.ts
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
declare const __APP_VERSION__: string
|
||||
@@ -1,10 +1,14 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
import path from 'path'
|
||||
import packageJson from './package.json'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
define: {
|
||||
__APP_VERSION__: JSON.stringify(packageJson.version),
|
||||
},
|
||||
resolve: {
|
||||
alias: {
|
||||
'@': path.resolve(__dirname, './src'),
|
||||
|
||||
Reference in New Issue
Block a user