Skip to content

Commit

Permalink
fix tanstack router example
Browse files Browse the repository at this point in the history
  • Loading branch information
garronej committed Sep 27, 2024
1 parent f1c8559 commit 89bee70
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 7 deletions.
6 changes: 3 additions & 3 deletions examples/tanstack-router-file-based/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-router": "1.47.1",
"@tanstack/react-router": "1.58.11",
"oidc-spa": "latest",
"react": "18.2.0",
"react-dom": "18.2.0",
"zod": "3.22.4"
},
"devDependencies": {
"@tanstack/router-vite-plugin": "1.47.0",
"@tanstack/router-vite-plugin": "1.58.10",
"@types/react": "18.2.75",
"@types/react-dom": "18.2.24",
"@typescript-eslint/eslint-plugin": "6.20.0",
Expand All @@ -28,7 +28,7 @@
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.5",
"typescript": "5.4.4",
"vite": "5.2.8",
"vite": "5.4.8",
"vite-plugin-commonjs": "0.10.1",
"vite-tsconfig-paths": "4.3.2"
}
Expand Down
39 changes: 38 additions & 1 deletion examples/tanstack-router-file-based/src/routeTree.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,44 @@ declare module '@tanstack/react-router' {

// Create and export the route tree

export const routeTree = rootRoute.addChildren({ IndexRoute, ProtectedRoute })
export interface FileRoutesByFullPath {
'/': typeof IndexRoute
'/protected': typeof ProtectedRoute
}

export interface FileRoutesByTo {
'/': typeof IndexRoute
'/protected': typeof ProtectedRoute
}

export interface FileRoutesById {
__root__: typeof rootRoute
'/': typeof IndexRoute
'/protected': typeof ProtectedRoute
}

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

export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
ProtectedRoute: typeof ProtectedRoute
}

const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
ProtectedRoute: ProtectedRoute,
}

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

/* prettier-ignore-end */

Expand Down
4 changes: 2 additions & 2 deletions examples/tanstack-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"preview": "vite preview"
},
"dependencies": {
"@tanstack/react-router": "1.47.1",
"@tanstack/react-router": "1.58.11",
"oidc-spa": "latest",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand All @@ -27,7 +27,7 @@
"eslint-plugin-react-hooks": "4.6.0",
"eslint-plugin-react-refresh": "0.4.5",
"typescript": "5.4.4",
"vite": "5.3.4",
"vite": "5.4.8",
"vite-tsconfig-paths": "4.3.2",
"vite-plugin-commonjs": "0.10.1"
}
Expand Down
12 changes: 11 additions & 1 deletion scripts/link-in-examples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,17 @@ const testAppNames = ["react-router", "tanstack-router", "tanstack-router-file-b
const getTestAppPath = (testAppName: (typeof testAppNames)[number]) =>
pathJoin(projectDirPath, "examples", testAppName);

testAppNames.forEach(testAppName => execSync("yarn install", { "cwd": getTestAppPath(testAppName) }));
testAppNames.forEach(testAppName => {
const cwd = getTestAppPath(testAppName);

const yarnLockFilePath = pathJoin(cwd, "yarn.lock");

if (fs.existsSync(yarnLockFilePath)) {
fs.rmSync(yarnLockFilePath);
}

execSync("yarn install", { cwd });
});

console.log("=== Linking common dependencies ===");

Expand Down

0 comments on commit 89bee70

Please sign in to comment.