Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,21 @@
},
"dependencies": {
"@tanstack/react-query": "^5.0.0",
"@tanstack/react-router": "^1.0.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tailwindcss": "^3.0.0",
"@tanstack/react-router": "^1.89.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"tailwind-merge": "^2.0.0"
"react": "^18.2.0",
"react-dom": "^18.2.0",
"tailwind-merge": "^2.0.0",
"tailwindcss": "^3.0.0"
},
"devDependencies": {
"@tanstack/router-devtools": "^1.95.0",
"@tanstack/router-plugin": "^1.95.0",
"@types/node": "^20.0.0",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.0",
"@vitejs/plugin-react-swc": "^3.0.0",
"@types/node": "^20.0.0",
"@vitejs/plugin-react": "^4.3.4",
"autoprefixer": "^10.0.0",
"postcss": "^8.0.0",
"tsconfig": "workspace:*",
Expand Down
16 changes: 15 additions & 1 deletion apps/web/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,26 @@
import { RouterProvider, createRouter } from '@tanstack/react-router';
import React from 'react';
import ReactDOM from 'react-dom/client';
import './index.css';

// Import the generated route tree
import { routeTree } from './routeTree.gen';

// Create a new router instance
const router = createRouter({ routeTree });

// Register the router instance for type safety
declare module '@tanstack/react-router' {
interface Register {
router: typeof router;
}
}

const rootElement = document.getElementById('root');
if (!rootElement) throw new Error('Root element not found');

ReactDOM.createRoot(rootElement).render(
<React.StrictMode>
<div>Hello from Web</div>
<RouterProvider router={router} />
</React.StrictMode>
);
116 changes: 116 additions & 0 deletions apps/web/src/routeTree.gen.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
/* eslint-disable */

// @ts-nocheck

// noinspection JSUnusedGlobalSymbols

// This file was automatically generated by TanStack Router.
// You should NOT make any changes in this file as it will be overwritten.
// Additionally, you should also exclude this file from your linter and/or formatter to prevent it from being checked or modified.

import { createFileRoute } from '@tanstack/react-router'

// Import Routes

import { Route as rootRoute } from './routes/__root'

// Create Virtual Routes

const AboutLazyImport = createFileRoute('/about')()
const IndexLazyImport = createFileRoute('/')()

// Create/Update Routes

const AboutLazyRoute = AboutLazyImport.update({
id: '/about',
path: '/about',
getParentRoute: () => rootRoute,
} as any).lazy(() => import('./routes/about.lazy').then((d) => d.Route))

const IndexLazyRoute = IndexLazyImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRoute,
} as any).lazy(() => import('./routes/index.lazy').then((d) => d.Route))

// Populate the FileRoutesByPath interface

declare module '@tanstack/react-router' {
interface FileRoutesByPath {
'/': {
id: '/'
path: '/'
fullPath: '/'
preLoaderRoute: typeof IndexLazyImport
parentRoute: typeof rootRoute
}
'/about': {
id: '/about'
path: '/about'
fullPath: '/about'
preLoaderRoute: typeof AboutLazyImport
parentRoute: typeof rootRoute
}
}
}

// Create and export the route tree

export interface FileRoutesByFullPath {
'/': typeof IndexLazyRoute
'/about': typeof AboutLazyRoute
}

export interface FileRoutesByTo {
'/': typeof IndexLazyRoute
'/about': typeof AboutLazyRoute
}

export interface FileRoutesById {
__root__: typeof rootRoute
'/': typeof IndexLazyRoute
'/about': typeof AboutLazyRoute
}

export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths: '/' | '/about'
fileRoutesByTo: FileRoutesByTo
to: '/' | '/about'
id: '__root__' | '/' | '/about'
fileRoutesById: FileRoutesById
}

export interface RootRouteChildren {
IndexLazyRoute: typeof IndexLazyRoute
AboutLazyRoute: typeof AboutLazyRoute
}

const rootRouteChildren: RootRouteChildren = {
IndexLazyRoute: IndexLazyRoute,
AboutLazyRoute: AboutLazyRoute,
}

export const routeTree = rootRoute
._addFileChildren(rootRouteChildren)
._addFileTypes<FileRouteTypes>()

/* ROUTE_MANIFEST_START
{
"routes": {
"__root__": {
"filePath": "__root.tsx",
"children": [
"/",
"/about"
]
},
"/": {
"filePath": "index.lazy.tsx"
},
"/about": {
"filePath": "about.lazy.tsx"
}
}
}
ROUTE_MANIFEST_END */
20 changes: 20 additions & 0 deletions apps/web/src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Link, Outlet, createRootRoute } from '@tanstack/react-router';
import { TanStackRouterDevtools } from '@tanstack/router-devtools';

export const Route = createRootRoute({
component: () => (
<>
<div className="p-2 flex gap-2">
<Link to="/" className="[&.active]:font-bold">
Home
</Link>{' '}
<Link to="/about" className="[&.active]:font-bold">
About
</Link>
</div>
<hr />
<Outlet />
<TanStackRouterDevtools />
</>
),
});
9 changes: 9 additions & 0 deletions apps/web/src/routes/about.lazy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { createLazyFileRoute } from '@tanstack/react-router';

export const Route = createLazyFileRoute('/about')({
component: About,
});

function About() {
return <div className="p-2">Hello from About!</div>;
}
13 changes: 13 additions & 0 deletions apps/web/src/routes/index.lazy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { createLazyFileRoute } from '@tanstack/react-router';

export const Route = createLazyFileRoute('/')({
component: Index,
});

function Index() {
return (
<div className="p-2">
<h3>Welcome Home!</h3>
</div>
);
}
13 changes: 7 additions & 6 deletions apps/web/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import react from "@vitejs/plugin-react-swc";
import { defineConfig } from "vite";
import { TanStackRouterVite } from '@tanstack/router-plugin/vite';
import viteReact from '@vitejs/plugin-react';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [react()],
server: {
port: 3000,
},
plugins: [TanStackRouterVite(), viteReact()],
server: {
port: 3000,
},
});
8 changes: 7 additions & 1 deletion biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@
"enabled": true
},
"files": {
"ignore": ["**/node_modules/**", "**/dist/**", ".turbo/**", "./.vscode/**"]
"ignore": [
"**/node_modules/**",
"**/dist/**",
".turbo/**",
"./.vscode/**",
"apps/web/src/routeTree.gen.ts"
]
},
"linter": {
"enabled": true,
Expand Down
Loading
Loading