Skip to content
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
.DS_Store
.env
.output
.nitro
.tanstack
26 changes: 26 additions & 0 deletions e2e-tests/test-applications/tanstack-start-test-app/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "tanstack-start-test-app",
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"start": "node .output/server/index.mjs"
},
"dependencies": {
"@tanstack/react-router": "^1.132.0",
"@tanstack/react-start": "^1.132.0",
"@tanstack/router-plugin": "^1.132.0",
"nitro": "latest",
"react": "^19.2.0",
"react-dom": "^19.2.0",
"vite-tsconfig-paths": "^6.0.2"
},
"devDependencies": {
"@types/react": "^19.2.0",
"@types/react-dom": "^19.2.0",
"@vitejs/plugin-react": "^5.0.4",
"typescript": "^5.7.2",
"vite": "^7.1.7"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/* 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 IndexRouteImport } from './routes/index'

const IndexRoute = IndexRouteImport.update({
id: '/',
path: '/',
getParentRoute: () => rootRouteImport,
} as any)

export interface FileRoutesByFullPath {
'/': typeof IndexRoute
}
export interface FileRoutesByTo {
'/': typeof IndexRoute
}
export interface FileRoutesById {
__root__: typeof rootRouteImport
'/': typeof IndexRoute
}
export interface FileRouteTypes {
fileRoutesByFullPath: FileRoutesByFullPath
fullPaths: '/'
fileRoutesByTo: FileRoutesByTo
to: '/'
id: '__root__' | '/'
fileRoutesById: FileRoutesById
}
export interface RootRouteChildren {
IndexRoute: typeof IndexRoute
}

declare module '@tanstack/react-router' {
interface FileRoutesByPath {
'/': {
id: '/'
path: '/'
fullPath: '/'
preLoaderRoute: typeof IndexRouteImport
parentRoute: typeof rootRouteImport
}
}
}

const rootRouteChildren: RootRouteChildren = {
IndexRoute: IndexRoute,
}
export const routeTree = rootRouteImport
._addFileChildren(rootRouteChildren)
._addFileTypes<FileRouteTypes>()

import type { getRouter } from './router.tsx'
import type { createStart } from '@tanstack/react-start'
declare module '@tanstack/react-start' {
interface Register {
ssr: true
router: Awaited<ReturnType<typeof getRouter>>
}
}
16 changes: 16 additions & 0 deletions e2e-tests/test-applications/tanstack-start-test-app/src/router.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { createRouter } from '@tanstack/react-router';
import { routeTree } from '@/routeTree.gen';

export function getRouter() {
return createRouter({
routeTree,
defaultPreload: 'intent',
scrollRestoration: true,
});
}

declare module '@tanstack/react-router' {
interface Register {
router: ReturnType<typeof getRouter>;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import {
HeadContent,
Outlet,
Scripts,
createRootRoute,
} from '@tanstack/react-router';

export const Route = createRootRoute({
head: () => ({
meta: [
{ charSet: 'utf-8' },
{ name: 'viewport', content: 'width=device-width, initial-scale=1' },
],
}),
component: RootLayout,
});

function RootLayout() {
return (
<html>
<head>
<HeadContent />
</head>
<body>
<Outlet />
<Scripts />
</body>
</html>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { createFileRoute } from '@tanstack/react-router';

export const Route = createFileRoute('/')({
component: Home,
});

function Home() {
return <h1>Home</h1>;
}
20 changes: 20 additions & 0 deletions e2e-tests/test-applications/tanstack-start-test-app/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"include": ["**/*.ts", "**/*.tsx"],
"compilerOptions": {
"target": "ES2022",
"jsx": "react-jsx",
"module": "ESNext",
"lib": ["ES2022", "DOM", "DOM.Iterable"],
"types": ["vite/client"],
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"verbatimModuleSyntax": false,
"noEmit": true,
"skipLibCheck": true,
"strict": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
14 changes: 14 additions & 0 deletions e2e-tests/test-applications/tanstack-start-test-app/vite.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { tanstackStart } from '@tanstack/react-start/plugin/vite';
import { defineConfig } from 'vite';
import tsConfigPaths from 'vite-tsconfig-paths';
import viteReact from '@vitejs/plugin-react';
import { nitro } from 'nitro/vite';

export default defineConfig({
plugins: [
tsConfigPaths({ projects: ['./tsconfig.json'] }),
tanstackStart({ srcDirectory: 'src' }),
viteReact(),
nitro(),
],
});
2 changes: 1 addition & 1 deletion e2e-tests/tests/help-message.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ describe('--help command', () => {
env: SENTRY_WIZARD_INTEGRATION
[choices: "reactNative", "flutter", "ios", "android", "cordova", "angular",
"cloudflare", "electron", "nextjs", "nuxt", "remix", "reactRouter",
"sveltekit", "sourcemaps"]
"sveltekit", "tanstackStart", "sourcemaps"]
-p, --platform Choose platform(s)
env: SENTRY_WIZARD_PLATFORM
[array] [choices: "ios", "android"]
Expand Down
57 changes: 57 additions & 0 deletions e2e-tests/tests/tanstack-start.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import { Integration } from '../../lib/Constants';
import {
checkIfBuilds,
checkIfRunsOnDevMode,
checkIfRunsOnProdMode,
checkPackageJson,
createIsolatedTestEnv,
getWizardCommand,
} from '../utils';
import { afterAll, beforeAll, describe, expect, test } from 'vitest';

//@ts-expect-error - clifty is ESM only
import { KEYS, withEnv } from 'clifty';

describe('TanStack Start', () => {
let wizardExitCode: number;
const { projectDir, cleanup } = createIsolatedTestEnv(
'tanstack-start-test-app',
);

beforeAll(async () => {
wizardExitCode = await withEnv({ cwd: projectDir })
.defineInteraction()
.whenAsked('Please select your package manager.')
.respondWith(KEYS.DOWN, KEYS.ENTER)
.expectOutput('Installing @sentry/tanstackstart-react')
.expectOutput('Installed @sentry/tanstackstart-react', {
timeout: 240_000,
})
.expectOutput('Successfully installed the Sentry TanStack Start SDK!')
.run(getWizardCommand(Integration.tanstackStart));
});

afterAll(() => {
cleanup();
});

test('exits with exit code 0', () => {
expect(wizardExitCode).toBe(0);
});

test('package.json is updated correctly', () => {
checkPackageJson(projectDir, '@sentry/tanstackstart-react');
});

test('builds successfully', async () => {
await checkIfBuilds(projectDir);
});

test('runs on dev mode correctly', async () => {
await checkIfRunsOnDevMode(projectDir, 'ready in');
});

test('runs on prod mode correctly', async () => {
await checkIfRunsOnProdMode(projectDir, 'Listening on');
});
});
5 changes: 5 additions & 0 deletions lib/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export enum Integration {
remix = 'remix',
reactRouter = 'reactRouter',
sveltekit = 'sveltekit',
tanstackStart = 'tanstackStart',
sourcemaps = 'sourcemaps',
}

Expand Down Expand Up @@ -69,6 +70,8 @@ export function getIntegrationDescription(type: string): string {
return 'iOS';
case Integration.cloudflare:
return 'Cloudflare';
case Integration.tanstackStart:
return 'TanStack Start';
default:
return 'React Native';
}
Expand Down Expand Up @@ -100,6 +103,8 @@ export function mapIntegrationToPlatform(type: string): string | undefined {
return undefined;
case Integration.cloudflare:
return 'node-cloudflare-workers';
case Integration.tanstackStart:
return 'javascript-tanstack-start';
case Integration.ios:
return 'iOS';
default:
Expand Down
7 changes: 7 additions & 0 deletions src/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import { runSourcemapsWizard } from './sourcemaps/sourcemaps-wizard';
import { runSvelteKitWizard } from './sveltekit/sveltekit-wizard';
import { runReactRouterWizard } from './react-router/react-router-wizard';
import { runCloudflareWizard } from './cloudflare/cloudflare-wizard';
import { runTanstackStartWizard } from './tanstack-start/tanstack-start-wizard';
import { enableDebugLogs } from './utils/debug';
import type { PreselectedProject, WizardOptions } from './utils/types';
import { WIZARD_VERSION } from './version';
Expand All @@ -35,6 +36,7 @@ type WizardIntegration =
| 'reactRouter'
| 'sveltekit'
| 'cloudflare'
| 'tanstackStart'
| 'sourcemaps';

type Args = {
Expand Down Expand Up @@ -131,6 +133,7 @@ export async function run(argv: Args) {
{ value: 'reactRouter', label: 'React Router' },
{ value: 'sveltekit', label: 'SvelteKit' },
{ value: 'cloudflare', label: 'Cloudflare' },
{ value: 'tanstackStart', label: 'TanStack Start' },
{ value: 'sourcemaps', label: 'Configure Source Maps Upload' },
],
}),
Expand Down Expand Up @@ -206,6 +209,10 @@ export async function run(argv: Args) {
await runCloudflareWizard(wizardOptions);
break;

case 'tanstackStart':
await runTanstackStartWizard(wizardOptions);
break;

case 'sourcemaps':
await runSourcemapsWizard(wizardOptions);
break;
Expand Down
Loading
Loading