Initialize tanstack/start
This commit is contained in:
parent
16ae786e11
commit
fb8a9ce6e2
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -130,3 +130,4 @@ dist
|
|||
.yarn/install-state.gz
|
||||
.pnp.*
|
||||
|
||||
.vinxi
|
3
app.config.ts
Normal file
3
app.config.ts
Normal file
|
@ -0,0 +1,3 @@
|
|||
import { defineConfig } from '@tanstack/start/config'
|
||||
|
||||
export default defineConfig({})
|
7
app/client.tsx
Normal file
7
app/client.tsx
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { hydrateRoot } from 'react-dom/client'
|
||||
import { StartClient } from '@tanstack/start'
|
||||
import { createRouter } from './router'
|
||||
|
||||
const router = createRouter()
|
||||
|
||||
hydrateRoot(document.getElementById('root')!, <StartClient router={router} />)
|
57
app/routeTree.gen.ts
Normal file
57
app/routeTree.gen.ts
Normal file
|
@ -0,0 +1,57 @@
|
|||
/* prettier-ignore-start */
|
||||
|
||||
/* eslint-disable */
|
||||
|
||||
// @ts-nocheck
|
||||
|
||||
// noinspection JSUnusedGlobalSymbols
|
||||
|
||||
// This file is auto-generated by TanStack Router
|
||||
|
||||
// Import Routes
|
||||
|
||||
import { Route as rootRoute } from './routes/__root'
|
||||
import { Route as IndexImport } from './routes/index'
|
||||
|
||||
// Create/Update Routes
|
||||
|
||||
const IndexRoute = IndexImport.update({
|
||||
path: '/',
|
||||
getParentRoute: () => rootRoute,
|
||||
} as any)
|
||||
|
||||
// Populate the FileRoutesByPath interface
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
interface FileRoutesByPath {
|
||||
'/': {
|
||||
id: '/'
|
||||
path: '/'
|
||||
fullPath: '/'
|
||||
preLoaderRoute: typeof IndexImport
|
||||
parentRoute: typeof rootRoute
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Create and export the route tree
|
||||
|
||||
export const routeTree = rootRoute.addChildren({ IndexRoute })
|
||||
|
||||
/* prettier-ignore-end */
|
||||
|
||||
/* ROUTE_MANIFEST_START
|
||||
{
|
||||
"routes": {
|
||||
"__root__": {
|
||||
"filePath": "__root.tsx",
|
||||
"children": [
|
||||
"/"
|
||||
]
|
||||
},
|
||||
"/": {
|
||||
"filePath": "index.tsx"
|
||||
}
|
||||
}
|
||||
}
|
||||
ROUTE_MANIFEST_END */
|
16
app/router.tsx
Normal file
16
app/router.tsx
Normal file
|
@ -0,0 +1,16 @@
|
|||
import { createRouter as createTanStackRouter } from '@tanstack/react-router'
|
||||
import { routeTree } from './routeTree.gen'
|
||||
|
||||
export function createRouter() {
|
||||
const router = createTanStackRouter({
|
||||
routeTree,
|
||||
})
|
||||
|
||||
return router
|
||||
}
|
||||
|
||||
declare module '@tanstack/react-router' {
|
||||
interface Register {
|
||||
router: ReturnType<typeof createRouter>
|
||||
}
|
||||
}
|
43
app/routes/__root.tsx
Normal file
43
app/routes/__root.tsx
Normal file
|
@ -0,0 +1,43 @@
|
|||
import { createRootRoute } from '@tanstack/react-router'
|
||||
import { Outlet, ScrollRestoration } from '@tanstack/react-router'
|
||||
import { Body, Head, Html, Meta, Scripts } from '@tanstack/start'
|
||||
import * as React from 'react'
|
||||
|
||||
export const Route = createRootRoute({
|
||||
meta: () => [
|
||||
{
|
||||
charSet: 'utf-8',
|
||||
},
|
||||
{
|
||||
name: 'viewport',
|
||||
content: 'width=device-width, initial-scale=1',
|
||||
},
|
||||
{
|
||||
title: 'TanStack Start Starter',
|
||||
},
|
||||
],
|
||||
component: RootComponent,
|
||||
})
|
||||
|
||||
function RootComponent() {
|
||||
return (
|
||||
<RootDocument>
|
||||
<Outlet />
|
||||
</RootDocument>
|
||||
)
|
||||
}
|
||||
|
||||
function RootDocument({ children }: { children: React.ReactNode }) {
|
||||
return (
|
||||
<Html>
|
||||
<Head>
|
||||
<Meta />
|
||||
</Head>
|
||||
<Body>
|
||||
{children}
|
||||
<ScrollRestoration />
|
||||
<Scripts />
|
||||
</Body>
|
||||
</Html>
|
||||
)
|
||||
}
|
14
app/routes/index.tsx
Normal file
14
app/routes/index.tsx
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { createFileRoute, useRouter } from '@tanstack/react-router'
|
||||
|
||||
export const Route = createFileRoute('/')({
|
||||
component: Home,
|
||||
})
|
||||
|
||||
function Home() {
|
||||
const router = useRouter()
|
||||
const state = Route.useLoaderData()
|
||||
|
||||
return (
|
||||
<h1>Hello World();</h1>
|
||||
)
|
||||
}
|
13
app/ssr.tsx
Normal file
13
app/ssr.tsx
Normal file
|
@ -0,0 +1,13 @@
|
|||
import {
|
||||
createStartHandler,
|
||||
defaultStreamHandler,
|
||||
} from '@tanstack/start/server'
|
||||
import { getRouterManifest } from '@tanstack/start/router-manifest'
|
||||
|
||||
import { createRouter } from './router'
|
||||
|
||||
export default createStartHandler({
|
||||
createRouter,
|
||||
getRouterManifest,
|
||||
})(defaultStreamHandler)
|
||||
|
7988
package-lock.json
generated
Normal file
7988
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
28
package.json
Normal file
28
package.json
Normal file
|
@ -0,0 +1,28 @@
|
|||
{
|
||||
"name": "szuntis-frontend",
|
||||
"version": "1.0.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vinxi dev",
|
||||
"build": "vinxi build",
|
||||
"start": "vinxi start"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"@tanstack/react-router": "^1.52.4",
|
||||
"@tanstack/start": "^1.52.4",
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
"react": "^18.3.1",
|
||||
"react-dom": "^18.3.1",
|
||||
"vinxi": "^0.4.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.3.5",
|
||||
"@types/react-dom": "^18.3.0",
|
||||
"typescript": "^5.5.4"
|
||||
}
|
||||
}
|
10
tsconfig.json
Normal file
10
tsconfig.json
Normal file
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"jsx": "react-jsx",
|
||||
"moduleResolution": "Bundler",
|
||||
"module": "Preserve",
|
||||
"target": "ES2022",
|
||||
"skipLibCheck": true,
|
||||
},
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user