-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
docs(solid-start): start-large example #5847
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| node_modules | ||
| .DS_Store | ||
| dist | ||
| dist-ssr | ||
| *.local | ||
| (gen) | ||
| node_modules | ||
| package-lock.json | ||
| yarn.lock | ||
|
|
||
| .DS_Store | ||
| .cache | ||
| .env | ||
| .vercel | ||
| .output | ||
| /build/ | ||
| /api/ | ||
| /server/build | ||
| /public/build | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "files.watcherExclude": { | ||
| "**/routeTree.gen.ts": true | ||
| }, | ||
| "search.exclude": { | ||
| "**/routeTree.gen.ts": true | ||
| }, | ||
| "files.readonlyInclude": { | ||
| "**/routeTree.gen.ts": true | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "name": "tanstack-solid-start-example-large", | ||
| "private": true, | ||
| "sideEffects": false, | ||
| "type": "module", | ||
| "scripts": { | ||
| "dev": "vite dev", | ||
| "build": "vite build && tsc --noEmit", | ||
| "start": "vite start", | ||
| "gen": "node ./src/createRoutes.mjs", | ||
| "test:types": "tsc --extendedDiagnostics" | ||
| }, | ||
| "dependencies": { | ||
| "@tanstack/solid-query": "^5.90.0", | ||
| "@tanstack/solid-router": "^1.135.2", | ||
| "@tanstack/solid-router-devtools": "^1.135.2", | ||
| "@tanstack/solid-start": "^1.135.2", | ||
| "solid-js": "^1.9.10", | ||
| "redaxios": "^0.5.1", | ||
| "tailwind-merge": "^2.6.0", | ||
| "valibot": "^1.0.0-beta.15" | ||
|
Comment on lines
+13
to
+21
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Use Per the coding guidelines, internal TanStack packages should use the As per coding guidelines. Apply this diff: "dependencies": {
- "@tanstack/solid-query": "^5.90.0",
- "@tanstack/solid-router": "^1.135.2",
- "@tanstack/solid-router-devtools": "^1.135.2",
- "@tanstack/solid-start": "^1.135.2",
+ "@tanstack/solid-query": "workspace:*",
+ "@tanstack/solid-router": "workspace:*",
+ "@tanstack/solid-router-devtools": "workspace:*",
+ "@tanstack/solid-start": "workspace:*",
"solid-js": "^1.9.10",
"redaxios": "^0.5.1",
"tailwind-merge": "^2.6.0",
"valibot": "^1.0.0-beta.15"
},🤖 Prompt for AI Agents |
||
| }, | ||
| "devDependencies": { | ||
| "@tailwindcss/postcss": "^4.1.15", | ||
| "@types/node": "^22.5.4", | ||
| "vite-plugin-solid": "^2.11.10", | ||
| "postcss": "^8.5.1", | ||
| "tailwindcss": "^4.1.15", | ||
| "typescript": "^5.7.2", | ||
| "vite": "^7.1.7", | ||
| "vite-tsconfig-paths": "^5.1.4" | ||
| }, | ||
| "keywords": [], | ||
| "author": "", | ||
| "license": "ISC" | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| export default { | ||
| plugins: { | ||
| '@tailwindcss/postcss': {}, | ||
| }, | ||
| } |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,49 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { readFile, writeFile, mkdir } from 'fs/promises' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { existsSync } from 'fs' | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const length = 100 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const main = async () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const absolute = (await readFile('./src/routes/absolute.tsx')).toString() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const relative = (await readFile('./src/routes/relative.tsx')).toString() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const searchRoute = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await readFile('./src/routes/search/route.tsx') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toString() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const search = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await readFile('./src/routes/search/searchPlaceholder.tsx') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toString() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const paramsRoute = ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await readFile('./src/routes/params/route.tsx') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toString() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const params = await ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await readFile('./src/routes/params/$paramsPlaceholder.tsx') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ).toString() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!existsSync('./src/routes/(gen)')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await mkdir('./src/routes/(gen)') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!existsSync('./src/routes/(gen)/search')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await mkdir('./src/routes/(gen)/search') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!existsSync('./src/routes/(gen)/params')) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await mkdir('./src/routes/(gen)/params') | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await writeFile('./src/routes/(gen)/search/route.tsx', searchRoute) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await writeFile('./src/routes/(gen)/params/route.tsx', paramsRoute) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| for (let y = 0; y < length; y = y + 1) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const replacedAbsolute = absolute.replaceAll('/absolute', `/absolute${y}`) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const replacedRelative = relative.replaceAll('/relative', `/relative${y}`) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const replacedSearch = search.replaceAll('searchPlaceholder', `search${y}`) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const replacedParams = params.replaceAll('paramsPlaceholder', `param${y}`) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await writeFile(`./src/routes/(gen)/absolute${y}.tsx`, replacedAbsolute) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await writeFile(`./src/routes/(gen)/relative${y}.tsx`, replacedRelative) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await writeFile(`./src/routes/(gen)/search/search${y}.tsx`, replacedSearch) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| await writeFile(`./src/routes/(gen)/params/$param${y}.tsx`, replacedParams) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| main() | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+37
to
+49
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Handle
-main()
+main().catch((err) => {
+ console.error(err)
+ process.exit(1)
+})📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,239 @@ | ||
| /* 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 { Route as rootRouteImport } from './routes/__root' | ||
| import { Route as RelativeRouteImport } from './routes/relative' | ||
| import { Route as LinkPropsRouteImport } from './routes/linkProps' | ||
| import { Route as AbsoluteRouteImport } from './routes/absolute' | ||
| import { Route as SearchRouteRouteImport } from './routes/search/route' | ||
| import { Route as ParamsRouteRouteImport } from './routes/params/route' | ||
| import { Route as IndexRouteImport } from './routes/index' | ||
| import { Route as SearchSearchPlaceholderRouteImport } from './routes/search/searchPlaceholder' | ||
| import { Route as ParamsParamsPlaceholderRouteImport } from './routes/params/$paramsPlaceholder' | ||
|
|
||
| const RelativeRoute = RelativeRouteImport.update({ | ||
| id: '/relative', | ||
| path: '/relative', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
| const LinkPropsRoute = LinkPropsRouteImport.update({ | ||
| id: '/linkProps', | ||
| path: '/linkProps', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
| const AbsoluteRoute = AbsoluteRouteImport.update({ | ||
| id: '/absolute', | ||
| path: '/absolute', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
| const SearchRouteRoute = SearchRouteRouteImport.update({ | ||
| id: '/search', | ||
| path: '/search', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
| const ParamsRouteRoute = ParamsRouteRouteImport.update({ | ||
| id: '/params', | ||
| path: '/params', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
| const IndexRoute = IndexRouteImport.update({ | ||
| id: '/', | ||
| path: '/', | ||
| getParentRoute: () => rootRouteImport, | ||
| } as any) | ||
| const SearchSearchPlaceholderRoute = SearchSearchPlaceholderRouteImport.update({ | ||
| id: '/searchPlaceholder', | ||
| path: '/searchPlaceholder', | ||
| getParentRoute: () => SearchRouteRoute, | ||
| } as any) | ||
| const ParamsParamsPlaceholderRoute = ParamsParamsPlaceholderRouteImport.update({ | ||
| id: '/$paramsPlaceholder', | ||
| path: '/$paramsPlaceholder', | ||
| getParentRoute: () => ParamsRouteRoute, | ||
| } as any) | ||
|
|
||
| export interface FileRoutesByFullPath { | ||
| '/': typeof IndexRoute | ||
| '/params': typeof ParamsRouteRouteWithChildren | ||
| '/search': typeof SearchRouteRouteWithChildren | ||
| '/absolute': typeof AbsoluteRoute | ||
| '/linkProps': typeof LinkPropsRoute | ||
| '/relative': typeof RelativeRoute | ||
| '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute | ||
| '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute | ||
| } | ||
| export interface FileRoutesByTo { | ||
| '/': typeof IndexRoute | ||
| '/params': typeof ParamsRouteRouteWithChildren | ||
| '/search': typeof SearchRouteRouteWithChildren | ||
| '/absolute': typeof AbsoluteRoute | ||
| '/linkProps': typeof LinkPropsRoute | ||
| '/relative': typeof RelativeRoute | ||
| '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute | ||
| '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute | ||
| } | ||
| export interface FileRoutesById { | ||
| __root__: typeof rootRouteImport | ||
| '/': typeof IndexRoute | ||
| '/params': typeof ParamsRouteRouteWithChildren | ||
| '/search': typeof SearchRouteRouteWithChildren | ||
| '/absolute': typeof AbsoluteRoute | ||
| '/linkProps': typeof LinkPropsRoute | ||
| '/relative': typeof RelativeRoute | ||
| '/params/$paramsPlaceholder': typeof ParamsParamsPlaceholderRoute | ||
| '/search/searchPlaceholder': typeof SearchSearchPlaceholderRoute | ||
| } | ||
| export interface FileRouteTypes { | ||
| fileRoutesByFullPath: FileRoutesByFullPath | ||
| fullPaths: | ||
| | '/' | ||
| | '/params' | ||
| | '/search' | ||
| | '/absolute' | ||
| | '/linkProps' | ||
| | '/relative' | ||
| | '/params/$paramsPlaceholder' | ||
| | '/search/searchPlaceholder' | ||
| fileRoutesByTo: FileRoutesByTo | ||
| to: | ||
| | '/' | ||
| | '/params' | ||
| | '/search' | ||
| | '/absolute' | ||
| | '/linkProps' | ||
| | '/relative' | ||
| | '/params/$paramsPlaceholder' | ||
| | '/search/searchPlaceholder' | ||
| id: | ||
| | '__root__' | ||
| | '/' | ||
| | '/params' | ||
| | '/search' | ||
| | '/absolute' | ||
| | '/linkProps' | ||
| | '/relative' | ||
| | '/params/$paramsPlaceholder' | ||
| | '/search/searchPlaceholder' | ||
| fileRoutesById: FileRoutesById | ||
| } | ||
| export interface RootRouteChildren { | ||
| IndexRoute: typeof IndexRoute | ||
| ParamsRouteRoute: typeof ParamsRouteRouteWithChildren | ||
| SearchRouteRoute: typeof SearchRouteRouteWithChildren | ||
| AbsoluteRoute: typeof AbsoluteRoute | ||
| LinkPropsRoute: typeof LinkPropsRoute | ||
| RelativeRoute: typeof RelativeRoute | ||
| } | ||
|
|
||
| declare module '@tanstack/solid-router' { | ||
| interface FileRoutesByPath { | ||
| '/relative': { | ||
| id: '/relative' | ||
| path: '/relative' | ||
| fullPath: '/relative' | ||
| preLoaderRoute: typeof RelativeRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| '/linkProps': { | ||
| id: '/linkProps' | ||
| path: '/linkProps' | ||
| fullPath: '/linkProps' | ||
| preLoaderRoute: typeof LinkPropsRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| '/absolute': { | ||
| id: '/absolute' | ||
| path: '/absolute' | ||
| fullPath: '/absolute' | ||
| preLoaderRoute: typeof AbsoluteRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| '/search': { | ||
| id: '/search' | ||
| path: '/search' | ||
| fullPath: '/search' | ||
| preLoaderRoute: typeof SearchRouteRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| '/params': { | ||
| id: '/params' | ||
| path: '/params' | ||
| fullPath: '/params' | ||
| preLoaderRoute: typeof ParamsRouteRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| '/': { | ||
| id: '/' | ||
| path: '/' | ||
| fullPath: '/' | ||
| preLoaderRoute: typeof IndexRouteImport | ||
| parentRoute: typeof rootRouteImport | ||
| } | ||
| '/search/searchPlaceholder': { | ||
| id: '/search/searchPlaceholder' | ||
| path: '/searchPlaceholder' | ||
| fullPath: '/search/searchPlaceholder' | ||
| preLoaderRoute: typeof SearchSearchPlaceholderRouteImport | ||
| parentRoute: typeof SearchRouteRoute | ||
| } | ||
| '/params/$paramsPlaceholder': { | ||
| id: '/params/$paramsPlaceholder' | ||
| path: '/$paramsPlaceholder' | ||
| fullPath: '/params/$paramsPlaceholder' | ||
| preLoaderRoute: typeof ParamsParamsPlaceholderRouteImport | ||
| parentRoute: typeof ParamsRouteRoute | ||
| } | ||
| } | ||
| } | ||
|
|
||
| interface ParamsRouteRouteChildren { | ||
| ParamsParamsPlaceholderRoute: typeof ParamsParamsPlaceholderRoute | ||
| } | ||
|
|
||
| const ParamsRouteRouteChildren: ParamsRouteRouteChildren = { | ||
| ParamsParamsPlaceholderRoute: ParamsParamsPlaceholderRoute, | ||
| } | ||
|
|
||
| const ParamsRouteRouteWithChildren = ParamsRouteRoute._addFileChildren( | ||
| ParamsRouteRouteChildren, | ||
| ) | ||
|
|
||
| interface SearchRouteRouteChildren { | ||
| SearchSearchPlaceholderRoute: typeof SearchSearchPlaceholderRoute | ||
| } | ||
|
|
||
| const SearchRouteRouteChildren: SearchRouteRouteChildren = { | ||
| SearchSearchPlaceholderRoute: SearchSearchPlaceholderRoute, | ||
| } | ||
|
|
||
| const SearchRouteRouteWithChildren = SearchRouteRoute._addFileChildren( | ||
| SearchRouteRouteChildren, | ||
| ) | ||
|
|
||
| const rootRouteChildren: RootRouteChildren = { | ||
| IndexRoute: IndexRoute, | ||
| ParamsRouteRoute: ParamsRouteRouteWithChildren, | ||
| SearchRouteRoute: SearchRouteRouteWithChildren, | ||
| AbsoluteRoute: AbsoluteRoute, | ||
| LinkPropsRoute: LinkPropsRoute, | ||
| RelativeRoute: RelativeRoute, | ||
| } | ||
| export const routeTree = rootRouteImport | ||
| ._addFileChildren(rootRouteChildren) | ||
| ._addFileTypes<FileRouteTypes>() | ||
|
|
||
| import type { getRouter } from './router.tsx' | ||
| import type { createStart } from '@tanstack/solid-start' | ||
| declare module '@tanstack/solid-start' { | ||
| interface Register { | ||
| ssr: true | ||
| router: Awaited<ReturnType<typeof getRouter>> | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| import { createRouter } from '@tanstack/solid-router' | ||
| import { QueryClient } from '@tanstack/solid-query' | ||
| import { routeTree } from './routeTree.gen' | ||
|
|
||
| export function getRouter() { | ||
| const queryClient = new QueryClient() | ||
| const router = createRouter({ | ||
| routeTree, | ||
| context: { | ||
| queryClient: queryClient, | ||
| }, | ||
| }) | ||
|
|
||
| return router | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove duplicate entries.
The file contains duplicate entries for
node_modules(lines 1 and 7) and.DS_Store(lines 2 and 11).Apply this diff to remove the duplicates:
📝 Committable suggestion
🤖 Prompt for AI Agents