@tanstack/cli 0.0.8 → 0.48.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/bin.js +7 -0
  2. package/dist/cli.js +481 -0
  3. package/dist/command-line.js +174 -0
  4. package/dist/dev-watch.js +290 -0
  5. package/dist/file-syncer.js +148 -0
  6. package/dist/index.js +1 -0
  7. package/dist/mcp/api.js +31 -0
  8. package/dist/mcp/tools.js +250 -0
  9. package/dist/mcp/types.js +37 -0
  10. package/dist/mcp.js +121 -0
  11. package/dist/options.js +162 -0
  12. package/dist/types/bin.d.ts +2 -0
  13. package/dist/types/cli.d.ts +16 -0
  14. package/dist/types/command-line.d.ts +10 -0
  15. package/dist/types/dev-watch.d.ts +27 -0
  16. package/dist/types/file-syncer.d.ts +18 -0
  17. package/dist/types/index.d.ts +1 -0
  18. package/dist/types/mcp/api.d.ts +4 -0
  19. package/dist/types/mcp/tools.d.ts +2 -0
  20. package/dist/types/mcp/types.d.ts +217 -0
  21. package/dist/types/mcp.d.ts +6 -0
  22. package/dist/types/options.d.ts +8 -0
  23. package/dist/types/types.d.ts +25 -0
  24. package/dist/types/ui-environment.d.ts +2 -0
  25. package/dist/types/ui-prompts.d.ts +12 -0
  26. package/dist/types/utils.d.ts +8 -0
  27. package/dist/types.js +1 -0
  28. package/dist/ui-environment.js +52 -0
  29. package/dist/ui-prompts.js +244 -0
  30. package/dist/utils.js +30 -0
  31. package/package.json +46 -46
  32. package/src/bin.ts +6 -93
  33. package/src/cli.ts +692 -0
  34. package/src/command-line.ts +236 -0
  35. package/src/dev-watch.ts +430 -0
  36. package/src/file-syncer.ts +205 -0
  37. package/src/index.ts +1 -85
  38. package/src/mcp.ts +190 -0
  39. package/src/options.ts +260 -0
  40. package/src/types.ts +27 -0
  41. package/src/ui-environment.ts +74 -0
  42. package/src/ui-prompts.ts +322 -0
  43. package/src/utils.ts +38 -0
  44. package/tests/command-line.test.ts +304 -0
  45. package/tests/index.test.ts +9 -0
  46. package/tests/mcp.test.ts +225 -0
  47. package/tests/options.test.ts +304 -0
  48. package/tests/setupVitest.ts +6 -0
  49. package/tests/ui-environment.test.ts +97 -0
  50. package/tests/ui-prompts.test.ts +238 -0
  51. package/tsconfig.json +17 -0
  52. package/vitest.config.js +7 -0
  53. package/dist/bin.cjs +0 -769
  54. package/dist/bin.d.cts +0 -1
  55. package/dist/bin.d.mts +0 -1
  56. package/dist/bin.mjs +0 -768
  57. package/dist/fetch-CbFFGJEw.cjs +0 -3
  58. package/dist/fetch-DG5dLrsb.cjs +0 -522
  59. package/dist/fetch-DhlVXS6S.mjs +0 -390
  60. package/dist/fetch-I_OVg8JX.mjs +0 -3
  61. package/dist/index.cjs +0 -37
  62. package/dist/index.d.cts +0 -1172
  63. package/dist/index.d.mts +0 -1172
  64. package/dist/index.mjs +0 -4
  65. package/dist/template-Szi7-AZJ.mjs +0 -2202
  66. package/dist/template-lWrIZhCQ.cjs +0 -2314
  67. package/src/api/fetch.test.ts +0 -114
  68. package/src/api/fetch.ts +0 -278
  69. package/src/cache/index.ts +0 -89
  70. package/src/commands/create.ts +0 -470
  71. package/src/commands/mcp.test.ts +0 -152
  72. package/src/commands/mcp.ts +0 -211
  73. package/src/engine/compile-with-addons.test.ts +0 -302
  74. package/src/engine/compile.test.ts +0 -404
  75. package/src/engine/compile.ts +0 -569
  76. package/src/engine/config-file.test.ts +0 -118
  77. package/src/engine/config-file.ts +0 -61
  78. package/src/engine/custom-addons/integration.ts +0 -323
  79. package/src/engine/custom-addons/shared.test.ts +0 -98
  80. package/src/engine/custom-addons/shared.ts +0 -281
  81. package/src/engine/custom-addons/template.test.ts +0 -288
  82. package/src/engine/custom-addons/template.ts +0 -124
  83. package/src/engine/template.test.ts +0 -256
  84. package/src/engine/template.ts +0 -269
  85. package/src/engine/types.ts +0 -336
  86. package/src/parse-gitignore.d.ts +0 -5
  87. package/src/templates/base.ts +0 -883
@@ -1,883 +0,0 @@
1
- /**
2
- * Base TanStack Start template files
3
- * These provide the foundation for every project
4
- */
5
-
6
- import { relativePath } from '../engine/template.js'
7
- import type { CompileOptions, Hook } from '../engine/types.js'
8
-
9
- /**
10
- * Hook with integration source tracking
11
- */
12
- export type TrackedHook = Hook & { integrationId: string }
13
-
14
- /**
15
- * Gitignore pattern with integration source tracking
16
- */
17
- type TrackedGitignorePattern = { pattern: string; integrationId: string }
18
-
19
- /**
20
- * Collect all hooks from integrations, grouped by type
21
- */
22
- export function collectHooks(options: CompileOptions): {
23
- vitePlugins: Array<TrackedHook>
24
- rootProviders: Array<TrackedHook>
25
- devtoolsPlugins: Array<TrackedHook>
26
- entryClientInits: Array<TrackedHook>
27
- } {
28
- const hooks: Array<TrackedHook> = []
29
- for (const integration of options.chosenIntegrations) {
30
- if (integration.hooks) {
31
- for (const hook of integration.hooks) {
32
- hooks.push({ ...hook, integrationId: integration.id })
33
- }
34
- }
35
- }
36
-
37
- return {
38
- vitePlugins: hooks.filter((i) => i.type === 'vite-plugin'),
39
- rootProviders: hooks.filter((i) => i.type === 'root-provider'),
40
- devtoolsPlugins: hooks.filter((i) => i.type === 'devtools'),
41
- entryClientInits: hooks.filter((i) => i.type === 'entry-client'),
42
- }
43
- }
44
-
45
- /**
46
- * Generate vite.config.ts content with line attribution
47
- */
48
- export function generateViteConfig(
49
- options: CompileOptions,
50
- vitePlugins: Array<TrackedHook>,
51
- ): { content: string; lineAttributions: Array<{ line: number; integrationId: string }> } {
52
- const { tailwind } = options
53
- const lines: Array<{ text: string; integrationId: string }> = []
54
-
55
- // Base imports
56
- lines.push({ text: `import { defineConfig } from 'vite'`, integrationId: 'base' })
57
- lines.push({ text: `import { tanstackStart } from '@tanstack/react-start/plugin/vite'`, integrationId: 'base' })
58
- lines.push({ text: `import viteReact from '@vitejs/plugin-react'`, integrationId: 'base' })
59
- lines.push({ text: `import viteTsConfigPaths from 'vite-tsconfig-paths'`, integrationId: 'base' })
60
-
61
- if (tailwind) {
62
- lines.push({ text: `import tailwindcss from '@tailwindcss/vite'`, integrationId: 'base' })
63
- }
64
-
65
- // Plugin imports
66
- for (const plugin of vitePlugins) {
67
- // Use custom import if provided, otherwise generate one
68
- if (plugin.import) {
69
- lines.push({ text: plugin.import, integrationId: plugin.integrationId })
70
- } else {
71
- const importPath = relativePath(
72
- 'vite.config.ts',
73
- plugin.path || `src/integrations/${plugin.integrationId}/vite-plugin.ts`,
74
- true,
75
- )
76
- lines.push({ text: `import ${plugin.jsName} from '${importPath}'`, integrationId: plugin.integrationId })
77
- }
78
- }
79
-
80
- lines.push({ text: '', integrationId: 'base' })
81
- lines.push({ text: `export default defineConfig({`, integrationId: 'base' })
82
- lines.push({ text: ` plugins: [`, integrationId: 'base' })
83
- lines.push({ text: ` viteTsConfigPaths({`, integrationId: 'base' })
84
- lines.push({ text: ` projects: ['./tsconfig.json'],`, integrationId: 'base' })
85
- lines.push({ text: ` }),`, integrationId: 'base' })
86
-
87
- if (tailwind) {
88
- lines.push({ text: ` tailwindcss(),`, integrationId: 'base' })
89
- }
90
-
91
- lines.push({ text: ` tanstackStart(),`, integrationId: 'base' })
92
- lines.push({ text: ` viteReact(),`, integrationId: 'base' })
93
-
94
- // Plugin calls
95
- for (const plugin of vitePlugins) {
96
- // Use custom code if provided, otherwise call jsName()
97
- const pluginCall = plugin.code || `${plugin.jsName}()`
98
- lines.push({ text: ` ${pluginCall},`, integrationId: plugin.integrationId })
99
- }
100
-
101
- lines.push({ text: ` ],`, integrationId: 'base' })
102
- lines.push({ text: `})`, integrationId: 'base' })
103
-
104
- const content = lines.map((l) => l.text).join('\n')
105
- const lineAttributions = lines.map((l, i) => ({ line: i + 1, integrationId: l.integrationId }))
106
-
107
- return { content, lineAttributions }
108
- }
109
-
110
- /**
111
- * Generate entry-client.tsx content with line attribution
112
- */
113
- export function generateEntryClient(
114
- _options: CompileOptions,
115
- entryClientInits: Array<TrackedHook>,
116
- ): { content: string; lineAttributions: Array<{ line: number; integrationId: string }> } {
117
- const lines: Array<{ text: string; integrationId: string }> = []
118
-
119
- lines.push({ text: `import { hydrateRoot } from 'react-dom/client'`, integrationId: 'base' })
120
- lines.push({ text: `import { StartClient } from '@tanstack/react-start'`, integrationId: 'base' })
121
- lines.push({ text: `import { getRouter } from './router'`, integrationId: 'base' })
122
-
123
- // Hook imports
124
- for (const init of entryClientInits) {
125
- const importPath = relativePath(
126
- 'src/entry-client.tsx',
127
- init.path || `src/integrations/${init.integrationId}/client.ts`,
128
- true,
129
- )
130
- lines.push({ text: `import { ${init.jsName} } from '${importPath}'`, integrationId: init.integrationId })
131
- }
132
-
133
- lines.push({ text: '', integrationId: 'base' })
134
-
135
- // Hook calls
136
- if (entryClientInits.length > 0) {
137
- lines.push({ text: `// Initialize integrations`, integrationId: 'base' })
138
- for (const init of entryClientInits) {
139
- lines.push({ text: `${init.jsName}()`, integrationId: init.integrationId })
140
- }
141
- lines.push({ text: '', integrationId: 'base' })
142
- }
143
-
144
- lines.push({ text: `const router = getRouter()`, integrationId: 'base' })
145
- lines.push({ text: '', integrationId: 'base' })
146
- lines.push({ text: `hydrateRoot(document.getElementById('root')!, <StartClient router={router} />)`, integrationId: 'base' })
147
-
148
- const content = lines.map((l) => l.text).join('\n')
149
- const lineAttributions = lines.map((l, i) => ({ line: i + 1, integrationId: l.integrationId }))
150
-
151
- return { content, lineAttributions }
152
- }
153
-
154
- /**
155
- * Generate __root.tsx content with line attribution
156
- * This generates a full document route with shellComponent for proper SSR
157
- */
158
- export function generateRootRoute(
159
- options: CompileOptions,
160
- rootProviders: Array<TrackedHook>,
161
- devtoolsPlugins: Array<TrackedHook>,
162
- ): { content: string; lineAttributions: Array<{ line: number; integrationId: string }> } {
163
- const lines: Array<{ text: string; integrationId: string }> = []
164
- const hasHeader = options.chosenIntegrations.length > 0
165
-
166
- lines.push({ text: `import { HeadContent, Scripts, createRootRoute } from '@tanstack/react-router'`, integrationId: 'base' })
167
- lines.push({ text: `import { TanStackDevtools } from '@tanstack/react-devtools'`, integrationId: 'base' })
168
- lines.push({ text: `import { TanStackRouterDevtoolsPanel } from '@tanstack/react-router-devtools'`, integrationId: 'base' })
169
-
170
- lines.push({ text: `import appCss from '../styles.css?url'`, integrationId: 'base' })
171
- if (hasHeader) {
172
- lines.push({ text: `import { Header } from '../components/Header'`, integrationId: 'base' })
173
- }
174
-
175
- // Provider imports
176
- for (const provider of rootProviders) {
177
- const importPath = relativePath(
178
- 'src/routes/__root.tsx',
179
- provider.path || `src/integrations/${provider.integrationId}/provider.tsx`,
180
- true,
181
- )
182
- lines.push({ text: `import { ${provider.jsName} } from '${importPath}'`, integrationId: provider.integrationId })
183
- }
184
-
185
- // Devtools imports
186
- for (const devtools of devtoolsPlugins) {
187
- const importPath = relativePath(
188
- 'src/routes/__root.tsx',
189
- devtools.path || `src/integrations/${devtools.integrationId}/devtools.tsx`,
190
- true,
191
- )
192
- lines.push({ text: `import { ${devtools.jsName} } from '${importPath}'`, integrationId: devtools.integrationId })
193
- }
194
-
195
- lines.push({ text: '', integrationId: 'base' })
196
- lines.push({ text: `export const Route = createRootRoute({`, integrationId: 'base' })
197
- lines.push({ text: ` head: () => ({`, integrationId: 'base' })
198
- lines.push({ text: ` meta: [`, integrationId: 'base' })
199
- lines.push({ text: ` { charSet: 'utf-8' },`, integrationId: 'base' })
200
- lines.push({ text: ` { name: 'viewport', content: 'width=device-width, initial-scale=1' },`, integrationId: 'base' })
201
- lines.push({ text: ` { title: 'TanStack Start Starter' },`, integrationId: 'base' })
202
- lines.push({ text: ` ],`, integrationId: 'base' })
203
- lines.push({ text: ` links: [{ rel: 'stylesheet', href: appCss }],`, integrationId: 'base' })
204
- lines.push({ text: ` }),`, integrationId: 'base' })
205
- lines.push({ text: ` shellComponent: RootDocument,`, integrationId: 'base' })
206
- lines.push({ text: `})`, integrationId: 'base' })
207
- lines.push({ text: '', integrationId: 'base' })
208
- lines.push({ text: `function RootDocument({ children }: { children: React.ReactNode }) {`, integrationId: 'base' })
209
- lines.push({ text: ` return (`, integrationId: 'base' })
210
- lines.push({ text: ` <html lang="en">`, integrationId: 'base' })
211
- lines.push({ text: ` <head>`, integrationId: 'base' })
212
- lines.push({ text: ` <HeadContent />`, integrationId: 'base' })
213
- lines.push({ text: ` </head>`, integrationId: 'base' })
214
- lines.push({ text: ` <body>`, integrationId: 'base' })
215
-
216
- // Build provider tree
217
- const indent = ' '
218
- let currentIndent = indent
219
- for (const provider of rootProviders) {
220
- lines.push({ text: `${currentIndent}<${provider.jsName}>`, integrationId: provider.integrationId })
221
- currentIndent += ' '
222
- }
223
-
224
- if (hasHeader) {
225
- lines.push({ text: `${currentIndent}<Header />`, integrationId: 'base' })
226
- }
227
- lines.push({ text: `${currentIndent}{children}`, integrationId: 'base' })
228
-
229
- // TanStack unified devtools with plugins
230
- lines.push({ text: `${currentIndent}<TanStackDevtools`, integrationId: 'base' })
231
- lines.push({ text: `${currentIndent} config={{ position: 'bottom-right' }}`, integrationId: 'base' })
232
- lines.push({ text: `${currentIndent} plugins={[`, integrationId: 'base' })
233
- lines.push({ text: `${currentIndent} { name: 'TanStack Router', render: <TanStackRouterDevtoolsPanel /> },`, integrationId: 'base' })
234
- for (const devtools of devtoolsPlugins) {
235
- lines.push({ text: `${currentIndent} ${devtools.jsName},`, integrationId: devtools.integrationId })
236
- }
237
- lines.push({ text: `${currentIndent} ]}`, integrationId: 'base' })
238
- lines.push({ text: `${currentIndent}/>`, integrationId: 'base' })
239
-
240
- for (const provider of [...rootProviders].reverse()) {
241
- currentIndent = currentIndent.slice(0, -2)
242
- lines.push({ text: `${currentIndent}</${provider.jsName}>`, integrationId: provider.integrationId })
243
- }
244
-
245
- lines.push({ text: ` <Scripts />`, integrationId: 'base' })
246
- lines.push({ text: ` </body>`, integrationId: 'base' })
247
- lines.push({ text: ` </html>`, integrationId: 'base' })
248
- lines.push({ text: ` )`, integrationId: 'base' })
249
- lines.push({ text: `}`, integrationId: 'base' })
250
-
251
- const content = lines.map((l) => l.text).join('\n')
252
- const lineAttributions = lines.map((l, i) => ({ line: i + 1, integrationId: l.integrationId }))
253
-
254
- return { content, lineAttributions }
255
- }
256
-
257
- /**
258
- * Collect routes from integrations for navigation
259
- */
260
- function collectRoutes(options: CompileOptions): Array<{ url: string; name: string; icon: string }> {
261
- const routes: Array<{ url: string; name: string; icon: string }> = []
262
- for (const integration of options.chosenIntegrations) {
263
- if (integration.routes) {
264
- for (const route of integration.routes) {
265
- if (route.url && route.name) {
266
- routes.push({
267
- url: route.url,
268
- name: route.name,
269
- icon: route.icon || 'Globe',
270
- })
271
- }
272
- }
273
- }
274
- }
275
- return routes
276
- }
277
-
278
- /**
279
- * Generate Header component with slide-out drawer navigation
280
- */
281
- export function generateHeader(
282
- options: CompileOptions,
283
- ): { content: string; lineAttributions: Array<{ line: number; integrationId: string }> } {
284
- const lines: Array<{ text: string; integrationId: string }> = []
285
- const routes = collectRoutes(options)
286
-
287
- // Collect unique icons
288
- const icons = new Set(['Menu', 'X', 'Home'])
289
- for (const route of routes) {
290
- icons.add(route.icon)
291
- }
292
-
293
- lines.push({ text: `import { useState } from 'react'`, integrationId: 'base' })
294
- lines.push({ text: `import { Link } from '@tanstack/react-router'`, integrationId: 'base' })
295
- lines.push({ text: `import { ${Array.from(icons).sort().join(', ')} } from 'lucide-react'`, integrationId: 'base' })
296
- lines.push({ text: '', integrationId: 'base' })
297
- lines.push({ text: `export function Header() {`, integrationId: 'base' })
298
- lines.push({ text: ` const [isOpen, setIsOpen] = useState(false)`, integrationId: 'base' })
299
- lines.push({ text: '', integrationId: 'base' })
300
- lines.push({ text: ` return (`, integrationId: 'base' })
301
- lines.push({ text: ` <>`, integrationId: 'base' })
302
- lines.push({ text: ` <header className="p-4 flex items-center bg-gray-800 text-white shadow-lg">`, integrationId: 'base' })
303
- lines.push({ text: ` <button`, integrationId: 'base' })
304
- lines.push({ text: ` onClick={() => setIsOpen(true)}`, integrationId: 'base' })
305
- lines.push({ text: ` className="p-2 hover:bg-gray-700 rounded-lg transition-colors"`, integrationId: 'base' })
306
- lines.push({ text: ` aria-label="Open menu"`, integrationId: 'base' })
307
- lines.push({ text: ` >`, integrationId: 'base' })
308
- lines.push({ text: ` <Menu size={24} />`, integrationId: 'base' })
309
- lines.push({ text: ` </button>`, integrationId: 'base' })
310
- lines.push({ text: ` <h1 className="ml-4 text-xl font-semibold">`, integrationId: 'base' })
311
- lines.push({ text: ` <Link to="/">`, integrationId: 'base' })
312
- lines.push({ text: ` <img`, integrationId: 'base' })
313
- lines.push({ text: ` src="/tanstack-logo-light.svg"`, integrationId: 'base' })
314
- lines.push({ text: ` alt="TanStack Logo"`, integrationId: 'base' })
315
- lines.push({ text: ` className="h-10"`, integrationId: 'base' })
316
- lines.push({ text: ` />`, integrationId: 'base' })
317
- lines.push({ text: ` </Link>`, integrationId: 'base' })
318
- lines.push({ text: ` </h1>`, integrationId: 'base' })
319
- lines.push({ text: ` </header>`, integrationId: 'base' })
320
- lines.push({ text: '', integrationId: 'base' })
321
- lines.push({ text: ` <aside`, integrationId: 'base' })
322
- lines.push({ text: ` className={\`fixed top-0 left-0 h-full w-80 bg-gray-900 text-white shadow-2xl z-50 transform transition-transform duration-300 ease-in-out flex flex-col \${`, integrationId: 'base' })
323
- lines.push({ text: ` isOpen ? 'translate-x-0' : '-translate-x-full'`, integrationId: 'base' })
324
- lines.push({ text: ` }\`}`, integrationId: 'base' })
325
- lines.push({ text: ` >`, integrationId: 'base' })
326
- lines.push({ text: ` <div className="flex items-center justify-between p-4 border-b border-gray-700">`, integrationId: 'base' })
327
- lines.push({ text: ` <h2 className="text-xl font-bold">Navigation</h2>`, integrationId: 'base' })
328
- lines.push({ text: ` <button`, integrationId: 'base' })
329
- lines.push({ text: ` onClick={() => setIsOpen(false)}`, integrationId: 'base' })
330
- lines.push({ text: ` className="p-2 hover:bg-gray-800 rounded-lg transition-colors"`, integrationId: 'base' })
331
- lines.push({ text: ` aria-label="Close menu"`, integrationId: 'base' })
332
- lines.push({ text: ` >`, integrationId: 'base' })
333
- lines.push({ text: ` <X size={24} />`, integrationId: 'base' })
334
- lines.push({ text: ` </button>`, integrationId: 'base' })
335
- lines.push({ text: ` </div>`, integrationId: 'base' })
336
- lines.push({ text: '', integrationId: 'base' })
337
- lines.push({ text: ` <nav className="flex-1 p-4 overflow-y-auto">`, integrationId: 'base' })
338
- lines.push({ text: ` <Link`, integrationId: 'base' })
339
- lines.push({ text: ` to="/"`, integrationId: 'base' })
340
- lines.push({ text: ` onClick={() => setIsOpen(false)}`, integrationId: 'base' })
341
- lines.push({ text: ` className="flex items-center gap-3 p-3 rounded-lg hover:bg-gray-800 transition-colors mb-2"`, integrationId: 'base' })
342
- lines.push({ text: ` activeProps={{`, integrationId: 'base' })
343
- lines.push({ text: ` className: 'flex items-center gap-3 p-3 rounded-lg bg-cyan-600 hover:bg-cyan-700 transition-colors mb-2',`, integrationId: 'base' })
344
- lines.push({ text: ` }}`, integrationId: 'base' })
345
- lines.push({ text: ` >`, integrationId: 'base' })
346
- lines.push({ text: ` <Home size={20} />`, integrationId: 'base' })
347
- lines.push({ text: ` <span className="font-medium">Home</span>`, integrationId: 'base' })
348
- lines.push({ text: ` </Link>`, integrationId: 'base' })
349
-
350
- // Add integration routes
351
- for (const route of routes) {
352
- const integrationId = options.chosenIntegrations.find(i =>
353
- i.routes?.some(r => r.url === route.url)
354
- )?.id || 'base'
355
-
356
- lines.push({ text: '', integrationId })
357
- lines.push({ text: ` <Link`, integrationId })
358
- lines.push({ text: ` to="${route.url}"`, integrationId })
359
- lines.push({ text: ` onClick={() => setIsOpen(false)}`, integrationId })
360
- lines.push({ text: ` className="flex items-center gap-3 p-3 rounded-lg hover:bg-gray-800 transition-colors mb-2"`, integrationId })
361
- lines.push({ text: ` activeProps={{`, integrationId })
362
- lines.push({ text: ` className: 'flex items-center gap-3 p-3 rounded-lg bg-cyan-600 hover:bg-cyan-700 transition-colors mb-2',`, integrationId })
363
- lines.push({ text: ` }}`, integrationId })
364
- lines.push({ text: ` >`, integrationId })
365
- lines.push({ text: ` <${route.icon} size={20} />`, integrationId })
366
- lines.push({ text: ` <span className="font-medium">${route.name}</span>`, integrationId })
367
- lines.push({ text: ` </Link>`, integrationId })
368
- }
369
-
370
- lines.push({ text: ` </nav>`, integrationId: 'base' })
371
- lines.push({ text: ` </aside>`, integrationId: 'base' })
372
- lines.push({ text: '', integrationId: 'base' })
373
- lines.push({ text: ` {isOpen && (`, integrationId: 'base' })
374
- lines.push({ text: ` <div`, integrationId: 'base' })
375
- lines.push({ text: ` className="fixed inset-0 bg-black/50 z-40"`, integrationId: 'base' })
376
- lines.push({ text: ` onClick={() => setIsOpen(false)}`, integrationId: 'base' })
377
- lines.push({ text: ` />`, integrationId: 'base' })
378
- lines.push({ text: ` )}`, integrationId: 'base' })
379
- lines.push({ text: ` </>`, integrationId: 'base' })
380
- lines.push({ text: ` )`, integrationId: 'base' })
381
- lines.push({ text: `}`, integrationId: 'base' })
382
-
383
- const content = lines.map((l) => l.text).join('\n')
384
- const lineAttributions = lines.map((l, i) => ({ line: i + 1, integrationId: l.integrationId }))
385
-
386
- return { content, lineAttributions }
387
- }
388
-
389
- /**
390
- * Generate .gitignore content with line attribution
391
- */
392
- export function generateGitignore(
393
- integrationPatterns: Array<TrackedGitignorePattern>,
394
- ): { content: string; lineAttributions: Array<{ line: number; integrationId: string }> } {
395
- const lines: Array<{ text: string; integrationId: string }> = []
396
-
397
- // Dependencies
398
- lines.push({ text: '# Dependencies', integrationId: 'base' })
399
- lines.push({ text: 'node_modules/', integrationId: 'base' })
400
- lines.push({ text: '.pnpm-store/', integrationId: 'base' })
401
- lines.push({ text: '', integrationId: 'base' })
402
-
403
- // Build outputs
404
- lines.push({ text: '# Build outputs', integrationId: 'base' })
405
- lines.push({ text: 'dist/', integrationId: 'base' })
406
- lines.push({ text: '.output/', integrationId: 'base' })
407
- lines.push({ text: '.vinxi/', integrationId: 'base' })
408
- lines.push({ text: '.vercel/', integrationId: 'base' })
409
- lines.push({ text: '.netlify/', integrationId: 'base' })
410
- lines.push({ text: '', integrationId: 'base' })
411
-
412
- // Environment
413
- lines.push({ text: '# Environment', integrationId: 'base' })
414
- lines.push({ text: '.env', integrationId: 'base' })
415
- lines.push({ text: '.env.*', integrationId: 'base' })
416
- lines.push({ text: '!.env.example', integrationId: 'base' })
417
- lines.push({ text: '', integrationId: 'base' })
418
-
419
- // IDE
420
- lines.push({ text: '# IDE', integrationId: 'base' })
421
- lines.push({ text: '.idea/', integrationId: 'base' })
422
- lines.push({ text: '.vscode/', integrationId: 'base' })
423
- lines.push({ text: '*.swp', integrationId: 'base' })
424
- lines.push({ text: '*.swo', integrationId: 'base' })
425
- lines.push({ text: '', integrationId: 'base' })
426
-
427
- // OS
428
- lines.push({ text: '# OS', integrationId: 'base' })
429
- lines.push({ text: '.DS_Store', integrationId: 'base' })
430
- lines.push({ text: 'Thumbs.db', integrationId: 'base' })
431
- lines.push({ text: '', integrationId: 'base' })
432
-
433
- // Logs
434
- lines.push({ text: '# Logs', integrationId: 'base' })
435
- lines.push({ text: '*.log', integrationId: 'base' })
436
- lines.push({ text: 'npm-debug.log*', integrationId: 'base' })
437
- lines.push({ text: 'pnpm-debug.log*', integrationId: 'base' })
438
- lines.push({ text: '', integrationId: 'base' })
439
-
440
- // Generated
441
- lines.push({ text: '# Generated', integrationId: 'base' })
442
- lines.push({ text: 'src/routeTree.gen.ts', integrationId: 'base' })
443
-
444
- // Integration patterns
445
- if (integrationPatterns.length > 0) {
446
- lines.push({ text: '', integrationId: 'base' })
447
- lines.push({ text: '# Integration-specific', integrationId: 'base' })
448
- for (const { pattern, integrationId } of integrationPatterns) {
449
- lines.push({ text: pattern, integrationId })
450
- }
451
- }
452
-
453
- const content = lines.map((l) => l.text).join('\n')
454
- const lineAttributions = lines.map((l, i) => ({ line: i + 1, integrationId: l.integrationId }))
455
-
456
- return { content, lineAttributions }
457
- }
458
-
459
- /**
460
- * Get base template files (static files without hook injection)
461
- */
462
- export function getBaseFiles(options: CompileOptions): Record<string, string> {
463
- const { projectName, typescript, tailwind, packageManager } = options
464
-
465
- const files: Record<string, string> = {}
466
-
467
- // Collect hooks
468
- const { vitePlugins, rootProviders, devtoolsPlugins, entryClientInits } =
469
- collectHooks(options)
470
-
471
- // tsconfig.json
472
- if (typescript) {
473
- files['tsconfig.json'] = JSON.stringify(
474
- {
475
- compilerOptions: {
476
- target: 'ES2022',
477
- lib: ['ES2022', 'DOM', 'DOM.Iterable'],
478
- module: 'ESNext',
479
- skipLibCheck: true,
480
- moduleResolution: 'bundler',
481
- allowImportingTsExtensions: true,
482
- resolveJsonModule: true,
483
- isolatedModules: true,
484
- moduleDetection: 'force',
485
- noEmit: true,
486
- jsx: 'react-jsx',
487
- strict: true,
488
- noUnusedLocals: true,
489
- noUnusedParameters: true,
490
- noFallthroughCasesInSwitch: true,
491
- noUncheckedIndexedAccess: true,
492
- paths: {
493
- '~/*': ['./src/*'],
494
- },
495
- },
496
- include: ['src'],
497
- },
498
- null,
499
- 2,
500
- )
501
- }
502
-
503
- // vite.config.ts (with hooks)
504
- const viteConfig = generateViteConfig(options, vitePlugins)
505
- files[typescript ? 'vite.config.ts' : 'vite.config.js'] = viteConfig.content
506
-
507
- // Note: index.html is NOT needed - TanStack Start generates it automatically
508
-
509
- // src/entry-client.tsx - only if there are hooks that need it
510
- if (entryClientInits.length > 0) {
511
- const entryClient = generateEntryClient(options, entryClientInits)
512
- files[`src/entry-client.${typescript ? 'tsx' : 'jsx'}`] = entryClient.content
513
- }
514
-
515
- // src/router.tsx - required by TanStack Start
516
- files[`src/router.${typescript ? 'tsx' : 'jsx'}`] = `import { createRouter as createTanStackRouter } from '@tanstack/react-router'
517
- import { routeTree } from './routeTree.gen'
518
-
519
- export function getRouter() {
520
- const router = createTanStackRouter({
521
- routeTree,
522
- defaultPreload: 'intent',
523
- scrollRestoration: true,
524
- })
525
-
526
- return router
527
- }
528
-
529
- declare module '@tanstack/react-router' {
530
- interface Register {
531
- router: ReturnType<typeof getRouter>
532
- }
533
- }
534
- `
535
-
536
- // src/routes/__root.tsx (with hooks)
537
- const rootRoute = generateRootRoute(options, rootProviders, devtoolsPlugins)
538
- files[`src/routes/__root.${typescript ? 'tsx' : 'jsx'}`] = rootRoute.content
539
-
540
- // src/components/Header.tsx - only when there are integrations
541
- const hasHeader = options.chosenIntegrations.length > 0
542
- if (hasHeader && tailwind) {
543
- const header = generateHeader(options)
544
- files[`src/components/Header.${typescript ? 'tsx' : 'jsx'}`] = header.content
545
- }
546
-
547
- // src/routes/index.tsx
548
- // When there's a header, we need to account for its height
549
- const indexRouteWithHeader = `import { createFileRoute } from '@tanstack/react-router'
550
-
551
- export const Route = createFileRoute('/')({
552
- component: Home,
553
- })
554
-
555
- function Home() {
556
- return (
557
- <div className="min-h-[calc(100vh-72px)] bg-gradient-to-br from-gray-900 to-gray-800 flex items-center justify-center">
558
- <div className="text-center px-4">
559
- <img
560
- src="/tanstack-logo-dark.svg"
561
- alt="TanStack Logo"
562
- className="h-24 mx-auto mb-8"
563
- />
564
- <h1 className="text-5xl font-bold text-white mb-4">
565
- Welcome to TanStack Start
566
- </h1>
567
- <p className="text-xl text-gray-300 mb-8">
568
- Full-stack React framework powered by TanStack Router
569
- </p>
570
- <div className="flex gap-4 justify-center flex-wrap">
571
- <a
572
- href="https://tanstack.com/start"
573
- target="_blank"
574
- rel="noopener noreferrer"
575
- className="px-6 py-3 bg-cyan-500 text-white rounded-lg font-medium hover:bg-cyan-600 transition-colors"
576
- >
577
- Documentation
578
- </a>
579
- <a
580
- href="https://github.com/tanstack/router"
581
- target="_blank"
582
- rel="noopener noreferrer"
583
- className="px-6 py-3 bg-gray-700 text-white rounded-lg font-medium hover:bg-gray-600 transition-colors"
584
- >
585
- GitHub
586
- </a>
587
- </div>
588
- </div>
589
- </div>
590
- )
591
- }
592
- `
593
-
594
- const indexRouteNoHeader = `import { createFileRoute } from '@tanstack/react-router'
595
-
596
- export const Route = createFileRoute('/')({
597
- component: Home,
598
- })
599
-
600
- function Home() {
601
- return (
602
- <div className="min-h-screen bg-gradient-to-br from-gray-900 to-gray-800 flex items-center justify-center">
603
- <div className="text-center px-4">
604
- <img
605
- src="/tanstack-logo-dark.svg"
606
- alt="TanStack Logo"
607
- className="h-24 mx-auto mb-8"
608
- />
609
- <h1 className="text-5xl font-bold text-white mb-4">
610
- Welcome to TanStack Start
611
- </h1>
612
- <p className="text-xl text-gray-300 mb-8">
613
- Full-stack React framework powered by TanStack Router
614
- </p>
615
- <div className="flex gap-4 justify-center flex-wrap">
616
- <a
617
- href="https://tanstack.com/start"
618
- target="_blank"
619
- rel="noopener noreferrer"
620
- className="px-6 py-3 bg-cyan-500 text-white rounded-lg font-medium hover:bg-cyan-600 transition-colors"
621
- >
622
- Documentation
623
- </a>
624
- <a
625
- href="https://github.com/tanstack/router"
626
- target="_blank"
627
- rel="noopener noreferrer"
628
- className="px-6 py-3 bg-gray-700 text-white rounded-lg font-medium hover:bg-gray-600 transition-colors"
629
- >
630
- GitHub
631
- </a>
632
- </div>
633
- </div>
634
- </div>
635
- )
636
- }
637
- `
638
-
639
- const indexRouteNoTailwind = `import { createFileRoute } from '@tanstack/react-router'
640
-
641
- export const Route = createFileRoute('/')({
642
- component: Home,
643
- })
644
-
645
- function Home() {
646
- return (
647
- <div style={styles.container}>
648
- <div style={styles.content}>
649
- <img
650
- src="/tanstack-logo-dark.svg"
651
- alt="TanStack Logo"
652
- style={styles.logo}
653
- />
654
- <h1 style={styles.title}>Welcome to TanStack Start</h1>
655
- <p style={styles.subtitle}>
656
- Full-stack React framework powered by TanStack Router
657
- </p>
658
- <div style={styles.buttons}>
659
- <a
660
- href="https://tanstack.com/start"
661
- target="_blank"
662
- rel="noopener noreferrer"
663
- style={styles.primaryButton}
664
- >
665
- Documentation
666
- </a>
667
- <a
668
- href="https://github.com/tanstack/router"
669
- target="_blank"
670
- rel="noopener noreferrer"
671
- style={styles.secondaryButton}
672
- >
673
- GitHub
674
- </a>
675
- </div>
676
- </div>
677
- </div>
678
- )
679
- }
680
-
681
- const styles = {
682
- container: {
683
- minHeight: '100vh',
684
- background: 'linear-gradient(to bottom right, #111827, #1f2937)',
685
- display: 'flex',
686
- alignItems: 'center',
687
- justifyContent: 'center',
688
- },
689
- content: {
690
- textAlign: 'center' as const,
691
- padding: '0 1rem',
692
- },
693
- logo: {
694
- height: '6rem',
695
- marginBottom: '2rem',
696
- },
697
- title: {
698
- fontSize: '3rem',
699
- fontWeight: 'bold',
700
- color: 'white',
701
- marginBottom: '1rem',
702
- },
703
- subtitle: {
704
- fontSize: '1.25rem',
705
- color: '#d1d5db',
706
- marginBottom: '2rem',
707
- },
708
- buttons: {
709
- display: 'flex',
710
- gap: '1rem',
711
- justifyContent: 'center',
712
- flexWrap: 'wrap' as const,
713
- },
714
- primaryButton: {
715
- padding: '0.75rem 1.5rem',
716
- backgroundColor: '#06b6d4',
717
- color: 'white',
718
- borderRadius: '0.5rem',
719
- fontWeight: 500,
720
- textDecoration: 'none',
721
- },
722
- secondaryButton: {
723
- padding: '0.75rem 1.5rem',
724
- backgroundColor: '#374151',
725
- color: 'white',
726
- borderRadius: '0.5rem',
727
- fontWeight: 500,
728
- textDecoration: 'none',
729
- },
730
- }
731
- `
732
-
733
- if (tailwind) {
734
- files[`src/routes/index.${typescript ? 'tsx' : 'jsx'}`] = hasHeader
735
- ? indexRouteWithHeader
736
- : indexRouteNoHeader
737
- } else {
738
- files[`src/routes/index.${typescript ? 'tsx' : 'jsx'}`] = indexRouteNoTailwind
739
- }
740
-
741
- // styles.css
742
- if (tailwind) {
743
- files['src/styles.css'] = `@import 'tailwindcss';
744
-
745
- body {
746
- @apply m-0;
747
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
748
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
749
- sans-serif;
750
- -webkit-font-smoothing: antialiased;
751
- -moz-osx-font-smoothing: grayscale;
752
- }
753
-
754
- code {
755
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
756
- monospace;
757
- }
758
- `
759
- } else {
760
- files['src/styles.css'] = `* {
761
- box-sizing: border-box;
762
- margin: 0;
763
- padding: 0;
764
- }
765
-
766
- body {
767
- font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
768
- 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
769
- sans-serif;
770
- -webkit-font-smoothing: antialiased;
771
- -moz-osx-font-smoothing: grayscale;
772
- line-height: 1.5;
773
- }
774
-
775
- code {
776
- font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
777
- monospace;
778
- }
779
- `
780
- }
781
-
782
- // Public assets - TanStack logos
783
- // Light version (white fill) for dark backgrounds like header
784
- files['public/tanstack-logo-light.svg'] = `<svg height="660" viewBox="0 0 663 660" width="663" xmlns="http://www.w3.org/2000/svg"><path d="m305.114318.62443771c8.717817-1.14462121 17.926803-.36545135 26.712694-.36545135 32.548987 0 64.505987 5.05339923 95.64868 14.63098274 39.74418 12.2236582 76.762804 31.7666864 109.435876 57.477568 40.046637 31.5132839 73.228974 72.8472109 94.520714 119.2362609 39.836383 86.790386 39.544267 191.973146-1.268422 278.398081-26.388695 55.880442-68.724007 102.650458-119.964986 136.75724-41.808813 27.828603-90.706831 44.862601-140.45707 50.89341-63.325458 7.677926-131.784923-3.541603-188.712259-32.729444-106.868873-54.795293-179.52309291-165.076271-180.9604082-285.932068-.27660564-23.300971.08616998-46.74071 4.69884909-69.814998 7.51316071-37.57857 20.61272131-73.903917 40.28618971-106.877282 21.2814003-35.670293 48.7704861-67.1473767 81.6882804-92.5255597 38.602429-29.7610135 83.467691-51.1674988 130.978372-62.05777669 11.473831-2.62966514 22.9946-4.0869914 34.57273-5.4964306l3.658171-.44480576c3.050084-.37153079 6.104217-.74794222 9.162589-1.14972654zm-110.555861 549.44131429c-14.716752 1.577863-30.238964 4.25635-42.869928 12.522173 2.84343.683658 6.102369.004954 9.068638 0 7.124652-.011559 14.317732-.279903 21.434964.032202 17.817402.781913 36.381729 3.63214 53.58741 8.350042 22.029372 6.040631 41.432961 17.928687 62.656049 25.945156 22.389644 8.456554 44.67706 11.084675 68.427 11.084675 11.96813 0 23.845573-.035504 35.450133-3.302696-6.056202-3.225083-14.72582-2.619864-21.434964-3.963236-14.556814-2.915455-28.868774-6.474936-42.869928-11.470264-10.304996-3.676672-20.230803-8.214291-30.11097-12.848661l-6.348531-2.985046c-9.1705-4.309263-18.363277-8.560752-27.845391-12.142608-24.932161-9.418465-52.560181-14.071964-79.144482-11.221737zm22.259385-62.614168c-29.163917 0-58.660076 5.137344-84.915434 18.369597-6.361238 3.206092-12.407546 7.02566-18.137277 11.258891-1.746125 1.290529-4.841829 2.948483-5.487351 5.191839-.654591 2.275558 1.685942 4.182039 3.014086 5.637703 6.562396-3.497556 12.797498-7.199878 19.78612-9.855246 45.19892-17.169893 99.992458-13.570779 145.098218 2.172348 22.494346 7.851335 43.219483 19.592421 65.129314 28.800338 24.503461 10.297807 49.53043 16.975034 75.846795 20.399104 31.04195 4.037546 66.433549.7654 94.808495-13.242161 9.970556-4.921843 23.814245-12.422267 28.030337-23.320339-5.207047.454947-9.892236 2.685918-14.83959 4.224149-7.866632 2.445646-15.827248 4.51974-23.908229 6.138887-27.388113 5.486604-56.512458 6.619429-84.091013 1.639788-25.991939-4.693152-50.142596-14.119246-74.179513-24.03502l-3.068058-1.268177c-2.045137-.846788-4.089983-1.695816-6.135603-2.544467l-3.069142-1.272366c-12.279956-5.085721-24.606928-10.110797-37.210937-14.51024-24.485325-8.546552-50.726667-13.784628-76.671218-13.784628zm51.114145-447.9909432c-34.959602 7.7225298-66.276908 22.7605319-96.457338 41.7180089-17.521434 11.0054099-34.281927 22.2799893-49.465301 36.4444283-22.5792616 21.065423-39.8360564 46.668751-54.8866988 73.411509-15.507372 27.55357-25.4498976 59.665686-30.2554517 90.824149-4.7140432 30.568106-5.4906485 62.70747-.0906864 93.301172 6.7503648 38.248526 19.5989769 74.140579 39.8896436 107.337631 6.8187918-3.184625 11.659796-10.445603 17.3128555-15.336896 11.4149428-9.875888 23.3995608-19.029311 36.2745548-26.928535 4.765981-2.923712 9.662222-5.194315 14.83959-7.275014 1.953055-.785216 5.14604-1.502727 6.06527-3.647828 1.460876-3.406732-1.240754-9.335897-1.704904-12.865654-1.324845-10.095517-2.124534-20.362774-1.874735-30.549941.725492-29.668947 6.269727-59.751557 16.825623-87.521453 7.954845-20.924233 20.10682-39.922168 34.502872-56.971512 4.884699-5.785498 10.077731-11.170545 15.437296-16.512656 3.167428-3.157378 7.098271-5.858983 9.068639-9.908915-10.336599.006606-20.674847 2.987289-30.503603 6.013385-21.174447 6.519522-41.801477 16.19312-59.358362 29.841512-8.008432 6.226409-13.873368 14.387371-21.44733 20.939921-2.32322 2.010516-6.484901 4.704691-9.695199 3.187928-4.8500728-2.29042-4.1014979-11.835213-4.6571581-16.222019-2.1369011-16.873476 4.2548401-38.216325 12.3778671-52.843142 13.039878-23.479694 37.150915-43.528712 65.467327-42.82854 12.228647.302197 22.934587 4.551115 34.625711 7.324555-2.964621-4.211764-6.939158-7.28162-10.717482-10.733763-9.257431-8.459031-19.382979-16.184864-30.503603-22.028985-4.474136-2.350694-9.291232-3.77911-14.015169-5.506421-2.375159-.867783-5.36616-2.062533-6.259834-4.702213-1.654614-4.888817 7.148561-9.416813 10.381943-11.478522 12.499882-7.969406 27.826705-14.525258 42.869928-14.894334 23.509209-.577147 46.479246 12.467678 56.162903 34.665926 3.404469 7.803171 4.411273 16.054969 5.079109 24.382907l.121749 1.56229.174325 2.345587c.01913.260708.038244.521433.057403.782164l.11601 1.56437.120128 1.563971c7.38352-6.019164 12.576553-14.876995 19.78612-21.323859 16.861073-15.07846 39.936636-21.7722 61.831627-14.984333 19.786945 6.133107 36.984382 19.788105 47.105807 37.959541 2.648042 4.754231 10.035685 16.373942 4.698379 21.109183-4.177345 3.707277-9.475079.818243-13.880788-.719162-3.33605-1.16376-6.782939-1.90214-10.241828-2.585698l-1.887262-.369639c-.629089-.122886-1.257979-.246187-1.886079-.372129-11.980496-2.401886-25.91652-2.152533-37.923398-.041284-7.762754 1.364839-15.349083 4.127545-23.083807 5.271929v1.651348c21.149714.175043 41.608563 12.240618 52.043268 30.549941 4.323267 7.585468 6.482428 16.267431 8.138691 24.770223 2.047864 10.50918.608423 21.958802-2.263037 32.201289-.962925 3.433979-2.710699 9.255807-6.817143 10.046802-2.902789.558982-5.36781-2.330878-7.024898-4.279468-4.343878-5.10762-8.475879-9.96341-13.573278-14.374161-12.895604-11.157333-26.530715-21.449361-40.396663-31.373138-7.362086-5.269452-15.425755-12.12007-23.908229-15.340199 2.385052 5.745041 4.721463 11.086326 5.532694 17.339156 2.385876 18.392716-5.314223 35.704625-16.87179 49.540445-3.526876 4.222498-7.29943 8.475545-11.744712 11.755948-1.843407 1.360711-4.156734 3.137561-6.595373 2.752797-7.645687-1.207961-8.555849-12.73272-9.728176-18.637115-3.970415-19.998652-2.375984-39.861068 3.132802-59.448534-4.901187 2.485279-8.443727 7.923994-11.521293 12.385111-6.770975 9.816439-12.645804 20.199291-16.858599 31.375615-16.777806 44.519521-16.616219 96.664142 5.118834 139.523233 2.427098 4.786433 6.110614 4.144058 10.894733 4.144058.720854 0 1.44257-.004515 2.164851-.010924l2.168232-.022283c4.338648-.045438 8.686803-.064635 12.979772.508795 2.227588.297243 5.320818.032202 7.084256 1.673642 2.111344 1.966755.986008 5.338808.4996 7.758859-1.358647 6.765574-1.812904 12.914369-1.812904 19.816178 9.02412-1.398692 11.525415-15.866153 14.724172-23.118874 3.624982-8.216283 7.313444-16.440823 10.667192-24.770223 1.648843-4.093692 3.854171-8.671229 3.275427-13.210785-.649644-5.10184-4.335633-10.510831-6.904531-14.862134-4.86244-8.234447-10.389363-16.70834-13.969002-25.595896-2.861567-7.104926-.197036-15.983399 7.871579-18.521521 4.450228-1.400344 9.198073 1.345848 12.094266 4.562675 6.07269 6.74328 9.992815 16.777697 14.401823 24.692609l34.394873 61.925556c2.920926 5.243856 5.848447 10.481933 8.836976 15.687808 1.165732 2.031158 2.352075 5.167068 4.740424 6.0332 2.127008.77118 5.033095-.325315 7.148561-.748886 5.492297-1.099798 10.97635-2.287117 16.488434-3.28288 6.605266-1.193099 16.673928-.969342 21.434964-6.129805-6.963066-2.205375-15.011895-2.074919-22.259386-1.577863-4.352947.298894-9.178287 1.856116-13.178381-.686135-5.953149-3.783239-9.910373-12.522173-13.552668-18.377854-8.980425-14.439388-17.441465-29.095929-26.041008-43.760726l-1.376261-2.335014-2.765943-4.665258c-1.380597-2.334387-2.750786-4.67476-4.079753-7.036188-1.02723-1.826391-2.549937-4.233231-1.078344-6.24705 1.545791-2.114476 4.91472-2.239146 7.956473-2.243117l.603351.000261c1.195428.001526 2.315572.002427 3.222811-.11692 12.27399-1.615019 24.718635-2.952611 37.098976-2.952611-.963749-3.352237-3.719791-7.141255-2.838484-10.73046 1.972017-8.030506 13.526287-10.543033 18.899867-4.780653 3.60767 3.868283 5.704174 9.192229 8.051303 13.859765 3.097352 6.162006 6.624228 12.118418 9.940876 18.16483 5.805578 10.585967 12.146205 20.881297 18.116667 31.375615.49237.865561.999687 1.726685 1.512269 2.587098l.771613 1.290552c2.577138 4.303168 5.164895 8.635123 6.553094 13.461506-20.735854-.9487-36.30176-25.018751-45.343193-41.283704-.721369 2.604176.450959 4.928448 1.388326 7.431066 1.948109 5.197619 4.276275 10.147535 7.20627 14.862134 4.184765 6.732546 8.982075 13.665732 15.313633 18.553722 11.236043 8.673707 26.05255 8.721596 39.572241 7.794364 8.669619-.595311 19.50252-4.542034 28.030338-1.864372 8.513803 2.673532 11.940924 12.063098 6.884745 19.276187-3.787393 5.403211-8.842747 7.443452-15.128962 8.257566 4.445282 9.53571 10.268996 18.385285 14.490036 28.072919 1.758491 4.035895 3.59118 10.22102 7.8048 12.350433 2.805507 1.416857 6.824562.09743 9.85761.034678-3.043765-8.053625-8.742992-14.887729-11.541904-23.118874 8.533589.390544 16.786875 4.843404 24.732651 7.685374 15.630376 5.590144 31.063836 11.701854 46.475333 17.86913l7.112077 2.848685c6.338978 2.538947 12.71588 5.052299 18.961699 7.812528 2.285297 1.009799 5.449427 3.370401 7.975455 1.917215 2.061054-1.186494 3.394144-4.015253 4.665403-5.931643 3.55573-5.361927 6.775921-10.928622 9.965609-16.513481 12.774414-22.36586 22.143967-46.872692 28.402976-71.833646 20.645168-82.323009 2.934117-173.156241-46.677107-241.922507-19.061454-26.420745-43.033164-49.262193-69.46165-68.1783861-66.13923-47.336721-152.911262-66.294198-232.486917-48.7172481zm135.205158 410.5292842c-17.532977 4.570931-35.601827 8.714164-53.58741 11.040088 2.365265 8.052799 8.145286 15.885969 12.376218 23.118874 1.635653 2.796558 3.3859 6.541816 6.618457 7.755557 3.651364 1.370619 8.063669-.853747 11.508927-1.975838-1.595256-4.364513-4.279573-8.292245-6.476657-12.385112-.905215-1.687677-2.305907-3.685809-1.559805-5.68972 1.410585-3.786541 7.266452-3.563609 10.509727-4.221671 8.54678-1.733916 17.004522-3.898008 25.557073-5.611281 3.150939-.631641 7.538512-2.342438 10.705115-1.285575 2.371037.791232 3.800147 2.744743 5.152304 4.781948l.606196.918752c.80912 1.222827 1.637246 2.41754 2.671212 3.351165 3.457625 3.121874 8.628398 3.60159 13.017619 4.453686-2.678546-6.027421-7.130424-11.301001-9.984571-17.339156-1.659561-3.511592-3.023155-8.677834-6.656381-10.707341-5.005064-2.795733-15.341663 2.461334-20.458024 3.795624zm-110.472507-40.151706c-.825246 10.467897-4.036369 18.984725-9.068639 28.072919 5.76683.729896 11.649079.989984 17.312856 2.39363 4.244947 1.051908 8.156828 3.058296 12.366325 4.211763-2.250671-6.157877-6.426367-11.651913-9.661398-17.339156-3.266358-5.740912-6.189758-12.717032-10.949144-17.339156z" fill="#fff" transform="translate(.9778)"/></svg>`
785
-
786
- // Dark version (dark fill) for light backgrounds like landing page
787
- files['public/tanstack-logo-dark.svg'] = `<svg height="660" viewBox="0 0 663 660" width="663" xmlns="http://www.w3.org/2000/svg"><path d="m305.114318.62443771c8.717817-1.14462121 17.926803-.36545135 26.712694-.36545135 32.548987 0 64.505987 5.05339923 95.64868 14.63098274 39.74418 12.2236582 76.762804 31.7666864 109.435876 57.477568 40.046637 31.5132839 73.228974 72.8472109 94.520714 119.2362609 39.836383 86.790386 39.544267 191.973146-1.268422 278.398081-26.388695 55.880442-68.724007 102.650458-119.964986 136.75724-41.808813 27.828603-90.706831 44.862601-140.45707 50.89341-63.325458 7.677926-131.784923-3.541603-188.712259-32.729444-106.868873-54.795293-179.52309291-165.076271-180.9604082-285.932068-.27660564-23.300971.08616998-46.74071 4.69884909-69.814998 7.51316071-37.57857 20.61272131-73.903917 40.28618971-106.877282 21.2814003-35.670293 48.7704861-67.1473767 81.6882804-92.5255597 38.602429-29.7610135 83.467691-51.1674988 130.978372-62.05777669 11.473831-2.62966514 22.9946-4.0869914 34.57273-5.4964306l3.658171-.44480576c3.050084-.37153079 6.104217-.74794222 9.162589-1.14972654zm-110.555861 549.44131429c-14.716752 1.577863-30.238964 4.25635-42.869928 12.522173 2.84343.683658 6.102369.004954 9.068638 0 7.124652-.011559 14.317732-.279903 21.434964.032202 17.817402.781913 36.381729 3.63214 53.58741 8.350042 22.029372 6.040631 41.432961 17.928687 62.656049 25.945156 22.389644 8.456554 44.67706 11.084675 68.427 11.084675 11.96813 0 23.845573-.035504 35.450133-3.302696-6.056202-3.225083-14.72582-2.619864-21.434964-3.963236-14.556814-2.915455-28.868774-6.474936-42.869928-11.470264-10.304996-3.676672-20.230803-8.214291-30.11097-12.848661l-6.348531-2.985046c-9.1705-4.309263-18.363277-8.560752-27.845391-12.142608-24.932161-9.418465-52.560181-14.071964-79.144482-11.221737zm22.259385-62.614168c-29.163917 0-58.660076 5.137344-84.915434 18.369597-6.361238 3.206092-12.407546 7.02566-18.137277 11.258891-1.746125 1.290529-4.841829 2.948483-5.487351 5.191839-.654591 2.275558 1.685942 4.182039 3.014086 5.637703 6.562396-3.497556 12.797498-7.199878 19.78612-9.855246 45.19892-17.169893 99.992458-13.570779 145.098218 2.172348 22.494346 7.851335 43.219483 19.592421 65.129314 28.800338 24.503461 10.297807 49.53043 16.975034 75.846795 20.399104 31.04195 4.037546 66.433549.7654 94.808495-13.242161 9.970556-4.921843 23.814245-12.422267 28.030337-23.320339-5.207047.454947-9.892236 2.685918-14.83959 4.224149-7.866632 2.445646-15.827248 4.51974-23.908229 6.138887-27.388113 5.486604-56.512458 6.619429-84.091013 1.639788-25.991939-4.693152-50.142596-14.119246-74.179513-24.03502l-3.068058-1.268177c-2.045137-.846788-4.089983-1.695816-6.135603-2.544467l-3.069142-1.272366c-12.279956-5.085721-24.606928-10.110797-37.210937-14.51024-24.485325-8.546552-50.726667-13.784628-76.671218-13.784628zm51.114145-447.9909432c-34.959602 7.7225298-66.276908 22.7605319-96.457338 41.7180089-17.521434 11.0054099-34.281927 22.2799893-49.465301 36.4444283-22.5792616 21.065423-39.8360564 46.668751-54.8866988 73.411509-15.507372 27.55357-25.4498976 59.665686-30.2554517 90.824149-4.7140432 30.568106-5.4906485 62.70747-.0906864 93.301172 6.7503648 38.248526 19.5989769 74.140579 39.8896436 107.337631 6.8187918-3.184625 11.659796-10.445603 17.3128555-15.336896 11.4149428-9.875888 23.3995608-19.029311 36.2745548-26.928535 4.765981-2.923712 9.662222-5.194315 14.83959-7.275014 1.953055-.785216 5.14604-1.502727 6.06527-3.647828 1.460876-3.406732-1.240754-9.335897-1.704904-12.865654-1.324845-10.095517-2.124534-20.362774-1.874735-30.549941.725492-29.668947 6.269727-59.751557 16.825623-87.521453 7.954845-20.924233 20.10682-39.922168 34.502872-56.971512 4.884699-5.785498 10.077731-11.170545 15.437296-16.512656 3.167428-3.157378 7.098271-5.858983 9.068639-9.908915-10.336599.006606-20.674847 2.987289-30.503603 6.013385-21.174447 6.519522-41.801477 16.19312-59.358362 29.841512-8.008432 6.226409-13.873368 14.387371-21.44733 20.939921-2.32322 2.010516-6.484901 4.704691-9.695199 3.187928-4.8500728-2.29042-4.1014979-11.835213-4.6571581-16.222019-2.1369011-16.873476 4.2548401-38.216325 12.3778671-52.843142 13.039878-23.479694 37.150915-43.528712 65.467327-42.82854 12.228647.302197 22.934587 4.551115 34.625711 7.324555-2.964621-4.211764-6.939158-7.28162-10.717482-10.733763-9.257431-8.459031-19.382979-16.184864-30.503603-22.028985-4.474136-2.350694-9.291232-3.77911-14.015169-5.506421-2.375159-.867783-5.36616-2.062533-6.259834-4.702213-1.654614-4.888817 7.148561-9.416813 10.381943-11.478522 12.499882-7.969406 27.826705-14.525258 42.869928-14.894334 23.509209-.577147 46.479246 12.467678 56.162903 34.665926 3.404469 7.803171 4.411273 16.054969 5.079109 24.382907l.121749 1.56229.174325 2.345587c.01913.260708.038244.521433.057403.782164l.11601 1.56437.120128 1.563971c7.38352-6.019164 12.576553-14.876995 19.78612-21.323859 16.861073-15.07846 39.936636-21.7722 61.831627-14.984333 19.786945 6.133107 36.984382 19.788105 47.105807 37.959541 2.648042 4.754231 10.035685 16.373942 4.698379 21.109183-4.177345 3.707277-9.475079.818243-13.880788-.719162-3.33605-1.16376-6.782939-1.90214-10.241828-2.585698l-1.887262-.369639c-.629089-.122886-1.257979-.246187-1.886079-.372129-11.980496-2.401886-25.91652-2.152533-37.923398-.041284-7.762754 1.364839-15.349083 4.127545-23.083807 5.271929v1.651348c21.149714.175043 41.608563 12.240618 52.043268 30.549941 4.323267 7.585468 6.482428 16.267431 8.138691 24.770223 2.047864 10.50918.608423 21.958802-2.263037 32.201289-.962925 3.433979-2.710699 9.255807-6.817143 10.046802-2.902789.558982-5.36781-2.330878-7.024898-4.279468-4.343878-5.10762-8.475879-9.96341-13.573278-14.374161-12.895604-11.157333-26.530715-21.449361-40.396663-31.373138-7.362086-5.269452-15.425755-12.12007-23.908229-15.340199 2.385052 5.745041 4.721463 11.086326 5.532694 17.339156 2.385876 18.392716-5.314223 35.704625-16.87179 49.540445-3.526876 4.222498-7.29943 8.475545-11.744712 11.755948-1.843407 1.360711-4.156734 3.137561-6.595373 2.752797-7.645687-1.207961-8.555849-12.73272-9.728176-18.637115-3.970415-19.998652-2.375984-39.861068 3.132802-59.448534-4.901187 2.485279-8.443727 7.923994-11.521293 12.385111-6.770975 9.816439-12.645804 20.199291-16.858599 31.375615-16.777806 44.519521-16.616219 96.664142 5.118834 139.523233 2.427098 4.786433 6.110614 4.144058 10.894733 4.144058.720854 0 1.44257-.004515 2.164851-.010924l2.168232-.022283c4.338648-.045438 8.686803-.064635 12.979772.508795 2.227588.297243 5.320818.032202 7.084256 1.673642 2.111344 1.966755.986008 5.338808.4996 7.758859-1.358647 6.765574-1.812904 12.914369-1.812904 19.816178 9.02412-1.398692 11.525415-15.866153 14.724172-23.118874 3.624982-8.216283 7.313444-16.440823 10.667192-24.770223 1.648843-4.093692 3.854171-8.671229 3.275427-13.210785-.649644-5.10184-4.335633-10.510831-6.904531-14.862134-4.86244-8.234447-10.389363-16.70834-13.969002-25.595896-2.861567-7.104926-.197036-15.983399 7.871579-18.521521 4.450228-1.400344 9.198073 1.345848 12.094266 4.562675 6.07269 6.74328 9.992815 16.777697 14.401823 24.692609l34.394873 61.925556c2.920926 5.243856 5.848447 10.481933 8.836976 15.687808 1.165732 2.031158 2.352075 5.167068 4.740424 6.0332 2.127008.77118 5.033095-.325315 7.148561-.748886 5.492297-1.099798 10.97635-2.287117 16.488434-3.28288 6.605266-1.193099 16.673928-.969342 21.434964-6.129805-6.963066-2.205375-15.011895-2.074919-22.259386-1.577863-4.352947.298894-9.178287 1.856116-13.178381-.686135-5.953149-3.783239-9.910373-12.522173-13.552668-18.377854-8.980425-14.439388-17.441465-29.095929-26.041008-43.760726l-1.376261-2.335014-2.765943-4.665258c-1.380597-2.334387-2.750786-4.67476-4.079753-7.036188-1.02723-1.826391-2.549937-4.233231-1.078344-6.24705 1.545791-2.114476 4.91472-2.239146 7.956473-2.243117l.603351.000261c1.195428.001526 2.315572.002427 3.222811-.11692 12.27399-1.615019 24.718635-2.952611 37.098976-2.952611-.963749-3.352237-3.719791-7.141255-2.838484-10.73046 1.972017-8.030506 13.526287-10.543033 18.899867-4.780653 3.60767 3.868283 5.704174 9.192229 8.051303 13.859765 3.097352 6.162006 6.624228 12.118418 9.940876 18.16483 5.805578 10.585967 12.146205 20.881297 18.116667 31.375615.49237.865561.999687 1.726685 1.512269 2.587098l.771613 1.290552c2.577138 4.303168 5.164895 8.635123 6.553094 13.461506-20.735854-.9487-36.30176-25.018751-45.343193-41.283704-.721369 2.604176.450959 4.928448 1.388326 7.431066 1.948109 5.197619 4.276275 10.147535 7.20627 14.862134 4.184765 6.732546 8.982075 13.665732 15.313633 18.553722 11.236043 8.673707 26.05255 8.721596 39.572241 7.794364 8.669619-.595311 19.50252-4.542034 28.030338-1.864372 8.513803 2.673532 11.940924 12.063098 6.884745 19.276187-3.787393 5.403211-8.842747 7.443452-15.128962 8.257566 4.445282 9.53571 10.268996 18.385285 14.490036 28.072919 1.758491 4.035895 3.59118 10.22102 7.8048 12.350433 2.805507 1.416857 6.824562.09743 9.85761.034678-3.043765-8.053625-8.742992-14.887729-11.541904-23.118874 8.533589.390544 16.786875 4.843404 24.732651 7.685374 15.630376 5.590144 31.063836 11.701854 46.475333 17.86913l7.112077 2.848685c6.338978 2.538947 12.71588 5.052299 18.961699 7.812528 2.285297 1.009799 5.449427 3.370401 7.975455 1.917215 2.061054-1.186494 3.394144-4.015253 4.665403-5.931643 3.55573-5.361927 6.775921-10.928622 9.965609-16.513481 12.774414-22.36586 22.143967-46.872692 28.402976-71.833646 20.645168-82.323009 2.934117-173.156241-46.677107-241.922507-19.061454-26.420745-43.033164-49.262193-69.46165-68.1783861-66.13923-47.336721-152.911262-66.294198-232.486917-48.7172481zm135.205158 410.5292842c-17.532977 4.570931-35.601827 8.714164-53.58741 11.040088 2.365265 8.052799 8.145286 15.885969 12.376218 23.118874 1.635653 2.796558 3.3859 6.541816 6.618457 7.755557 3.651364 1.370619 8.063669-.853747 11.508927-1.975838-1.595256-4.364513-4.279573-8.292245-6.476657-12.385112-.905215-1.687677-2.305907-3.685809-1.559805-5.68972 1.410585-3.786541 7.266452-3.563609 10.509727-4.221671 8.54678-1.733916 17.004522-3.898008 25.557073-5.611281 3.150939-.631641 7.538512-2.342438 10.705115-1.285575 2.371037.791232 3.800147 2.744743 5.152304 4.781948l.606196.918752c.80912 1.222827 1.637246 2.41754 2.671212 3.351165 3.457625 3.121874 8.628398 3.60159 13.017619 4.453686-2.678546-6.027421-7.130424-11.301001-9.984571-17.339156-1.659561-3.511592-3.023155-8.677834-6.656381-10.707341-5.005064-2.795733-15.341663 2.461334-20.458024 3.795624zm-110.472507-40.151706c-.825246 10.467897-4.036369 18.984725-9.068639 28.072919 5.76683.729896 11.649079.989984 17.312856 2.39363 4.244947 1.051908 8.156828 3.058296 12.366325 4.211763-2.250671-6.157877-6.426367-11.651913-9.661398-17.339156-3.266358-5.740912-6.189758-12.717032-10.949144-17.339156z" fill="#1f2937" transform="translate(.9778)"/></svg>`
788
-
789
- // .gitignore - collect integration patterns
790
- const gitignorePatterns: Array<TrackedGitignorePattern> = []
791
- for (const integration of options.chosenIntegrations) {
792
- if (integration.gitignorePatterns) {
793
- for (const pattern of integration.gitignorePatterns) {
794
- gitignorePatterns.push({ pattern, integrationId: integration.id })
795
- }
796
- }
797
- }
798
- const gitignore = generateGitignore(gitignorePatterns)
799
- files['.gitignore'] = gitignore.content
800
-
801
- // .env.example
802
- files['.env.example'] = `# Add your environment variables here
803
- # Copy this file to .env.local and fill in your values
804
-
805
- # Example:
806
- # DATABASE_URL=postgresql://user:password@localhost:5432/db
807
- `
808
-
809
- // README.md
810
- files['README.md'] = `# ${projectName}
811
-
812
- A full-stack React application built with [TanStack Start](https://tanstack.com/start).
813
-
814
- ## Getting Started
815
-
816
- \`\`\`bash
817
- # Install dependencies
818
- ${packageManager} install
819
-
820
- # Start development server
821
- ${packageManager}${packageManager === 'npm' ? ' run' : ''} dev
822
- \`\`\`
823
-
824
- ## Scripts
825
-
826
- - \`dev\` - Start development server
827
- - \`build\` - Build for production
828
- - \`start\` - Start production server
829
-
830
- ## Learn More
831
-
832
- - [TanStack Start Documentation](https://tanstack.com/start)
833
- - [TanStack Router Documentation](https://tanstack.com/router)
834
- `
835
-
836
- // .nvmrc - Node version (TanStack Start requires >=22.12.0)
837
- files['.nvmrc'] = '22.12.0'
838
-
839
- return files
840
- }
841
-
842
- /**
843
- * Get base files WITH line-by-line attribution for files that have hooks
844
- */
845
- export function getBaseFilesWithAttribution(options: CompileOptions): {
846
- files: Record<string, string>
847
- attributions: Record<string, Array<{ line: number; integrationId: string }>>
848
- } {
849
- const { typescript } = options
850
- const files = getBaseFiles(options)
851
- const attributions: Record<string, Array<{ line: number; integrationId: string }>> = {}
852
-
853
- // Collect hooks
854
- const { vitePlugins, rootProviders, devtoolsPlugins, entryClientInits } =
855
- collectHooks(options)
856
-
857
- // Generate attributed versions
858
- const viteConfig = generateViteConfig(options, vitePlugins)
859
- attributions[typescript ? 'vite.config.ts' : 'vite.config.js'] = viteConfig.lineAttributions
860
-
861
- // Only attribute entry-client if it was generated
862
- if (entryClientInits.length > 0) {
863
- const entryClient = generateEntryClient(options, entryClientInits)
864
- attributions[`src/entry-client.${typescript ? 'tsx' : 'jsx'}`] = entryClient.lineAttributions
865
- }
866
-
867
- const rootRoute = generateRootRoute(options, rootProviders, devtoolsPlugins)
868
- attributions[`src/routes/__root.${typescript ? 'tsx' : 'jsx'}`] = rootRoute.lineAttributions
869
-
870
- // Gitignore attribution
871
- const gitignorePatterns: Array<TrackedGitignorePattern> = []
872
- for (const integration of options.chosenIntegrations) {
873
- if (integration.gitignorePatterns) {
874
- for (const pattern of integration.gitignorePatterns) {
875
- gitignorePatterns.push({ pattern, integrationId: integration.id })
876
- }
877
- }
878
- }
879
- const gitignore = generateGitignore(gitignorePatterns)
880
- attributions['.gitignore'] = gitignore.lineAttributions
881
-
882
- return { files, attributions }
883
- }