add version
This commit is contained in:
parent
ff44a2f69f
commit
248f382276
6 changed files with 37 additions and 9 deletions
|
@ -23,6 +23,7 @@
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^9.22.0",
|
"@eslint/js": "^9.22.0",
|
||||||
|
"@types/node": "^22.15.19",
|
||||||
"@types/react": "^19.0.10",
|
"@types/react": "^19.0.10",
|
||||||
"@types/react-dom": "^19.0.4",
|
"@types/react-dom": "^19.0.4",
|
||||||
"@types/react-router-dom": "^5.3.3",
|
"@types/react-router-dom": "^5.3.3",
|
||||||
|
|
11
src/App.tsx
11
src/App.tsx
|
@ -1,23 +1,16 @@
|
||||||
import { BrowserRouter, Route, Routes } from 'react-router-dom'
|
import { BrowserRouter, Route, Routes } from 'react-router-dom'
|
||||||
import HomePage from './app/feed/pages/HomePage.tsx'
|
import HomePage from './app/feed/pages/HomePage.tsx'
|
||||||
import { PostsService } from './app/feed/posts/postsService.ts'
|
|
||||||
import AuthorPage from './app/feed/pages/AuthorPage.tsx'
|
import AuthorPage from './app/feed/pages/AuthorPage.tsx'
|
||||||
import { MediaService } from './app/media/mediaService.ts'
|
|
||||||
import SignupPage from './app/auth/pages/SignupPage.tsx'
|
import SignupPage from './app/auth/pages/SignupPage.tsx'
|
||||||
import LoginPage from './app/auth/pages/LoginPage.tsx'
|
import LoginPage from './app/auth/pages/LoginPage.tsx'
|
||||||
import { AuthService } from './app/auth/authService.ts'
|
|
||||||
import LogoutPage from './app/auth/pages/LogoutPage.tsx'
|
import LogoutPage from './app/auth/pages/LogoutPage.tsx'
|
||||||
import UnauthorizedHandler from './app/auth/components/UnauthorizedHandler.tsx'
|
import UnauthorizedHandler from './app/auth/components/UnauthorizedHandler.tsx'
|
||||||
import AdminPage from './app/admin/pages/AdminPage.tsx'
|
import AdminPage from './app/admin/pages/AdminPage.tsx'
|
||||||
import SignupCodesManagementPage from './app/admin/pages/subpages/SignupCodesManagementPage.tsx'
|
import SignupCodesManagementPage from './app/admin/pages/subpages/SignupCodesManagementPage.tsx'
|
||||||
import { initUser } from './app/user/user.ts'
|
|
||||||
import { useRefreshSessionLoop } from './useRefreshSessionLoop.ts'
|
import { useRefreshSessionLoop } from './useRefreshSessionLoop.ts'
|
||||||
|
import { initApp } from './initApp.ts'
|
||||||
|
|
||||||
const postService = new PostsService()
|
const { postService, mediaService, authService } = initApp()
|
||||||
const mediaService = new MediaService()
|
|
||||||
const authService = new AuthService()
|
|
||||||
|
|
||||||
initUser()
|
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
useRefreshSessionLoop(authService)
|
useRefreshSessionLoop(authService)
|
||||||
|
|
16
src/initApp.ts
Normal file
16
src/initApp.ts
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
import { initUser } from './app/user/user.ts'
|
||||||
|
import { setGlobal } from './app/femtoApp.ts'
|
||||||
|
import { PostsService } from './app/feed/posts/postsService.ts'
|
||||||
|
import { MediaService } from './app/media/mediaService.ts'
|
||||||
|
import { AuthService } from './app/auth/authService.ts'
|
||||||
|
|
||||||
|
export function initApp() {
|
||||||
|
setGlobal('version', import.meta.env.VITE_FEMTO_VERSION)
|
||||||
|
initUser()
|
||||||
|
|
||||||
|
const postService = new PostsService()
|
||||||
|
const mediaService = new MediaService()
|
||||||
|
const authService = new AuthService()
|
||||||
|
|
||||||
|
return { postService, mediaService, authService }
|
||||||
|
}
|
1
src/types.d.ts
vendored
1
src/types.d.ts
vendored
|
@ -15,5 +15,6 @@ declare global {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface FemtoApp {
|
export interface FemtoApp {
|
||||||
|
version: string
|
||||||
user: User | null
|
user: User | null
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import react from '@vitejs/plugin-react'
|
import react from '@vitejs/plugin-react'
|
||||||
import tailwindcss from '@tailwindcss/vite'
|
import tailwindcss from '@tailwindcss/vite'
|
||||||
|
import fs from 'node:fs'
|
||||||
|
|
||||||
|
const packageJson = JSON.parse(fs.readFileSync('./package.json', 'utf-8'))
|
||||||
|
|
||||||
|
process.env.VITE_FEMTO_VERSION = packageJson.version
|
||||||
|
|
||||||
// https://vite.dev/config/
|
// https://vite.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
|
12
yarn.lock
12
yarn.lock
|
@ -778,6 +778,13 @@
|
||||||
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
|
resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.15.tgz#596a1747233694d50f6ad8a7869fcb6f56cf5841"
|
||||||
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
|
integrity sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==
|
||||||
|
|
||||||
|
"@types/node@^22.15.19":
|
||||||
|
version "22.15.19"
|
||||||
|
resolved "https://registry.yarnpkg.com/@types/node/-/node-22.15.19.tgz#ba9f321675243af0456d607fa82a4865931e0cef"
|
||||||
|
integrity sha512-3vMNr4TzNQyjHcRZadojpRaD9Ofr6LsonZAoQ+HMUa/9ORTPoxVIw0e0mpqWpdjj8xybyCM+oKOUH2vwFu/oEw==
|
||||||
|
dependencies:
|
||||||
|
undici-types "~6.21.0"
|
||||||
|
|
||||||
"@types/react-dom@^19.0.4":
|
"@types/react-dom@^19.0.4":
|
||||||
version "19.1.3"
|
version "19.1.3"
|
||||||
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-19.1.3.tgz#3f0c60804441bf34d19f8dd0d44405c0c0e21bfa"
|
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-19.1.3.tgz#3f0c60804441bf34d19f8dd0d44405c0c0e21bfa"
|
||||||
|
@ -2439,6 +2446,11 @@ typescript@~5.7.2:
|
||||||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e"
|
resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.7.3.tgz#919b44a7dbb8583a9b856d162be24a54bf80073e"
|
||||||
integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==
|
integrity sha512-84MVSjMEHP+FQRPy3pX9sTVV/INIex71s9TL2Gm5FG/WG1SqXeKyZ0k7/blY/4FdOzI12CBy1vGc4og/eus0fw==
|
||||||
|
|
||||||
|
undici-types@~6.21.0:
|
||||||
|
version "6.21.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-6.21.0.tgz#691d00af3909be93a7faa13be61b3a5b50ef12cb"
|
||||||
|
integrity sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==
|
||||||
|
|
||||||
unpipe@1.0.0:
|
unpipe@1.0.0:
|
||||||
version "1.0.0"
|
version "1.0.0"
|
||||||
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
|
resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue