@tanstack/cta-engine 0.14.3 → 0.15.0

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 (343) hide show
  1. package/dist/add-ons.js +5 -91
  2. package/dist/add-to-app.js +171 -0
  3. package/dist/config-file.js +34 -11
  4. package/dist/constants.js +0 -2
  5. package/dist/create-app.js +142 -451
  6. package/dist/custom-add-ons/add-on.js +175 -0
  7. package/dist/custom-add-ons/shared.js +116 -0
  8. package/dist/custom-add-ons/starter.js +84 -0
  9. package/dist/environment.js +67 -44
  10. package/dist/file-helpers.js +165 -0
  11. package/dist/frameworks.js +92 -0
  12. package/dist/index.js +18 -1
  13. package/dist/integrations/git.js +4 -0
  14. package/dist/integrations/shadcn.js +33 -0
  15. package/dist/options.js +9 -333
  16. package/dist/package-json.js +48 -0
  17. package/dist/package-manager.js +51 -6
  18. package/dist/registry.js +56 -0
  19. package/dist/special-steps/index.js +24 -0
  20. package/dist/special-steps/rimraf-node-modules.js +16 -0
  21. package/dist/template-file.js +112 -0
  22. package/dist/types/add-ons.d.ts +3 -8
  23. package/dist/types/add-to-app.d.ts +17 -0
  24. package/dist/types/config-file.d.ts +7 -4
  25. package/dist/types/constants.d.ts +0 -3
  26. package/dist/types/create-app.d.ts +1 -7
  27. package/dist/types/custom-add-ons/add-on.d.ts +69 -0
  28. package/dist/types/custom-add-ons/shared.d.ts +15 -0
  29. package/dist/types/custom-add-ons/starter.d.ts +7 -0
  30. package/dist/types/environment.d.ts +2 -1
  31. package/dist/types/file-helpers.d.ts +15 -0
  32. package/dist/types/frameworks.d.ts +7 -0
  33. package/dist/types/index.d.ts +21 -1
  34. package/dist/types/integrations/git.d.ts +2 -0
  35. package/dist/types/integrations/shadcn.d.ts +2 -0
  36. package/dist/types/options.d.ts +2 -6
  37. package/dist/types/package-json.d.ts +7 -0
  38. package/dist/types/package-manager.d.ts +18 -1
  39. package/dist/types/registry.d.ts +25 -0
  40. package/dist/types/special-steps/index.d.ts +2 -0
  41. package/dist/types/special-steps/rimraf-node-modules.d.ts +2 -0
  42. package/dist/types/template-file.d.ts +2 -0
  43. package/dist/types/types.d.ts +788 -85
  44. package/dist/types/utils.d.ts +5 -0
  45. package/dist/types.js +65 -1
  46. package/dist/utils.js +9 -0
  47. package/package.json +9 -12
  48. package/src/add-ons.ts +7 -123
  49. package/src/add-to-app.ts +276 -0
  50. package/src/config-file.ts +51 -20
  51. package/src/constants.ts +0 -5
  52. package/src/create-app.ts +180 -730
  53. package/src/custom-add-ons/add-on.ts +261 -0
  54. package/src/custom-add-ons/shared.ts +160 -0
  55. package/src/custom-add-ons/starter.ts +126 -0
  56. package/src/environment.ts +80 -45
  57. package/src/file-helpers.ts +235 -0
  58. package/src/frameworks.ts +134 -0
  59. package/src/index.ts +85 -1
  60. package/src/integrations/git.ts +7 -0
  61. package/src/integrations/shadcn.ts +54 -0
  62. package/src/options.ts +8 -409
  63. package/src/package-json.ts +69 -0
  64. package/src/package-manager.ts +80 -9
  65. package/src/registry.ts +92 -0
  66. package/src/special-steps/index.ts +36 -0
  67. package/src/special-steps/rimraf-node-modules.ts +25 -0
  68. package/src/template-file.ts +150 -0
  69. package/src/types.ts +175 -87
  70. package/src/utils.ts +17 -0
  71. package/tests/add-ons.test.ts +67 -0
  72. package/tests/add-to-app.test.ts +358 -0
  73. package/tests/config-file.test.ts +105 -0
  74. package/tests/create-app.test.ts +120 -0
  75. package/tests/custom-add-ons/add-on.test.ts +12 -0
  76. package/tests/custom-add-ons/shared.test.ts +253 -0
  77. package/tests/custom-add-ons/starter.test.ts +58 -0
  78. package/tests/environment.test.ts +115 -0
  79. package/tests/file-helper.test.ts +90 -0
  80. package/tests/frameworks.test.ts +95 -0
  81. package/tests/index.test.ts +9 -0
  82. package/tests/integrations/git.test.ts +20 -0
  83. package/tests/integrations/shadcn.test.ts +91 -0
  84. package/tests/options.test.ts +42 -0
  85. package/tests/package-json.test.ts +63 -0
  86. package/tests/package-manager.test.ts +154 -0
  87. package/tests/setupVitest.ts +6 -0
  88. package/tests/template-file.test.ts +178 -0
  89. package/tests/utils.test.ts +23 -0
  90. package/vitest.config.ts +21 -0
  91. package/dist/add.js +0 -125
  92. package/dist/cli.js +0 -132
  93. package/dist/custom-add-on.js +0 -254
  94. package/dist/file-helper.js +0 -18
  95. package/dist/mcp.js +0 -229
  96. package/dist/templates.js +0 -6
  97. package/dist/toolchain.js +0 -6
  98. package/dist/types/add.d.ts +0 -3
  99. package/dist/types/cli.d.ts +0 -7
  100. package/dist/types/custom-add-on.d.ts +0 -3
  101. package/dist/types/file-helper.d.ts +0 -2
  102. package/dist/types/mcp.d.ts +0 -7
  103. package/dist/types/templates.d.ts +0 -1
  104. package/dist/types/toolchain.d.ts +0 -3
  105. package/src/add.ts +0 -186
  106. package/src/cli.ts +0 -210
  107. package/src/custom-add-on.ts +0 -325
  108. package/src/file-helper.ts +0 -20
  109. package/src/mcp.ts +0 -302
  110. package/src/templates.ts +0 -7
  111. package/src/toolchain.ts +0 -7
  112. package/templates/react/add-on/clerk/README.md +0 -3
  113. package/templates/react/add-on/clerk/assets/_dot_env.local.append +0 -2
  114. package/templates/react/add-on/clerk/assets/src/integrations/clerk/header-user.tsx +0 -19
  115. package/templates/react/add-on/clerk/assets/src/integrations/clerk/provider.tsx +0 -18
  116. package/templates/react/add-on/clerk/assets/src/routes/demo.clerk.tsx +0 -20
  117. package/templates/react/add-on/clerk/info.json +0 -13
  118. package/templates/react/add-on/clerk/package.json +0 -5
  119. package/templates/react/add-on/convex/README.md +0 -4
  120. package/templates/react/add-on/convex/assets/_dot_cursorrules.append +0 -93
  121. package/templates/react/add-on/convex/assets/_dot_env.local.append +0 -3
  122. package/templates/react/add-on/convex/assets/convex/products.ts +0 -8
  123. package/templates/react/add-on/convex/assets/convex/schema.ts +0 -10
  124. package/templates/react/add-on/convex/assets/src/integrations/convex/provider.tsx +0 -20
  125. package/templates/react/add-on/convex/assets/src/routes/demo.convex.tsx +0 -33
  126. package/templates/react/add-on/convex/info.json +0 -13
  127. package/templates/react/add-on/convex/package.json +0 -6
  128. package/templates/react/add-on/form/assets/src/components/demo.FormComponents.tsx.ejs +0 -300
  129. package/templates/react/add-on/form/assets/src/hooks/demo.form-context.ts +0 -4
  130. package/templates/react/add-on/form/assets/src/hooks/demo.form.ts +0 -22
  131. package/templates/react/add-on/form/assets/src/routes/demo.form.address.tsx.ejs +0 -213
  132. package/templates/react/add-on/form/assets/src/routes/demo.form.simple.tsx.ejs +0 -77
  133. package/templates/react/add-on/form/info.json +0 -26
  134. package/templates/react/add-on/form/package.json +0 -6
  135. package/templates/react/add-on/module-federation/assets/module-federation.config.js.ejs +0 -31
  136. package/templates/react/add-on/module-federation/assets/src/demo-mf-component.tsx +0 -3
  137. package/templates/react/add-on/module-federation/assets/src/demo-mf-self-contained.tsx +0 -11
  138. package/templates/react/add-on/module-federation/info.json +0 -7
  139. package/templates/react/add-on/module-federation/package.json +0 -5
  140. package/templates/react/add-on/netlify/README.md +0 -11
  141. package/templates/react/add-on/netlify/info.json +0 -7
  142. package/templates/react/add-on/sentry/assets/_dot_cursorrules.append +0 -22
  143. package/templates/react/add-on/sentry/assets/_dot_env.local.append +0 -11
  144. package/templates/react/add-on/sentry/assets/src/app/global-middleware.ts +0 -11
  145. package/templates/react/add-on/sentry/assets/src/routes/demo.sentry.testing.tsx +0 -489
  146. package/templates/react/add-on/sentry/info.json +0 -14
  147. package/templates/react/add-on/sentry/package.json +0 -5
  148. package/templates/react/add-on/shadcn/README.md +0 -7
  149. package/templates/react/add-on/shadcn/assets/_dot_cursorrules.append +0 -7
  150. package/templates/react/add-on/shadcn/assets/components.json +0 -21
  151. package/templates/react/add-on/shadcn/assets/src/lib/utils.ts +0 -6
  152. package/templates/react/add-on/shadcn/assets/src/styles.css +0 -138
  153. package/templates/react/add-on/shadcn/info.json +0 -7
  154. package/templates/react/add-on/shadcn/package.json +0 -9
  155. package/templates/react/add-on/start/assets/_dot_gitignore.append +0 -2
  156. package/templates/react/add-on/start/assets/app.config.ts.ejs +0 -32
  157. package/templates/react/add-on/start/assets/src/api.ts +0 -6
  158. package/templates/react/add-on/start/assets/src/client.tsx.ejs +0 -33
  159. package/templates/react/add-on/start/assets/src/router.tsx.ejs +0 -48
  160. package/templates/react/add-on/start/assets/src/routes/api.demo-names.ts +0 -11
  161. package/templates/react/add-on/start/assets/src/routes/demo.start.api-request.tsx.ejs +0 -33
  162. package/templates/react/add-on/start/assets/src/routes/demo.start.server-funcs.tsx +0 -50
  163. package/templates/react/add-on/start/assets/src/ssr.tsx.ejs +0 -30
  164. package/templates/react/add-on/start/info.json +0 -18
  165. package/templates/react/add-on/start/package.json +0 -13
  166. package/templates/react/add-on/store/assets/src/lib/demo-store.ts +0 -13
  167. package/templates/react/add-on/store/assets/src/routes/demo.store.tsx.ejs +0 -75
  168. package/templates/react/add-on/store/info.json +0 -13
  169. package/templates/react/add-on/store/package.json +0 -6
  170. package/templates/react/add-on/t3env/README.md +0 -16
  171. package/templates/react/add-on/t3env/assets/src/env.ts +0 -39
  172. package/templates/react/add-on/t3env/info.json +0 -10
  173. package/templates/react/add-on/t3env/package.json +0 -6
  174. package/templates/react/add-on/tRPC/assets/src/integrations/trpc/init.ts +0 -9
  175. package/templates/react/add-on/tRPC/assets/src/integrations/trpc/react.ts +0 -4
  176. package/templates/react/add-on/tRPC/assets/src/integrations/trpc/router.ts +0 -18
  177. package/templates/react/add-on/tRPC/assets/src/routes/api.trpc.$.tsx +0 -16
  178. package/templates/react/add-on/tRPC/info.json +0 -9
  179. package/templates/react/add-on/tRPC/package.json +0 -9
  180. package/templates/react/add-on/table/assets/src/data/demo-table-data.ts +0 -50
  181. package/templates/react/add-on/table/assets/src/routes/demo.table.tsx.ejs +0 -373
  182. package/templates/react/add-on/table/info.json +0 -13
  183. package/templates/react/add-on/table/package.json +0 -7
  184. package/templates/react/add-on/tanstack-query/assets/src/integrations/tanstack-query/layout.tsx +0 -5
  185. package/templates/react/add-on/tanstack-query/assets/src/integrations/tanstack-query/root-provider.tsx.ejs +0 -70
  186. package/templates/react/add-on/tanstack-query/assets/src/routes/demo.tanstack-query.tsx.ejs +0 -53
  187. package/templates/react/add-on/tanstack-query/info.json +0 -13
  188. package/templates/react/add-on/tanstack-query/package.json +0 -6
  189. package/templates/react/base/README.md.ejs +0 -558
  190. package/templates/react/base/_dot_gitignore +0 -5
  191. package/templates/react/base/_dot_vscode/settings.biome.json +0 -38
  192. package/templates/react/base/_dot_vscode/settings.json +0 -11
  193. package/templates/react/base/index.html.ejs +0 -20
  194. package/templates/react/base/package.biome.json +0 -10
  195. package/templates/react/base/package.eslintprettier.json +0 -11
  196. package/templates/react/base/package.json +0 -30
  197. package/templates/react/base/package.ts.json +0 -7
  198. package/templates/react/base/package.tw.json +0 -6
  199. package/templates/react/base/public/favicon.ico +0 -0
  200. package/templates/react/base/public/logo192.png +0 -0
  201. package/templates/react/base/public/logo512.png +0 -0
  202. package/templates/react/base/public/manifest.json +0 -25
  203. package/templates/react/base/public/robots.txt +0 -3
  204. package/templates/react/base/src/App.css +0 -38
  205. package/templates/react/base/src/App.test.tsx.ejs +0 -10
  206. package/templates/react/base/src/App.tsx.ejs +0 -74
  207. package/templates/react/base/src/components/Header.tsx.ejs +0 -27
  208. package/templates/react/base/src/logo.svg +0 -44
  209. package/templates/react/base/src/reportWebVitals.ts.ejs +0 -28
  210. package/templates/react/base/src/styles.css.ejs +0 -15
  211. package/templates/react/base/toolchain/.prettierignore +0 -3
  212. package/templates/react/base/toolchain/biome.json +0 -31
  213. package/templates/react/base/toolchain/eslint.config.js +0 -5
  214. package/templates/react/base/toolchain/prettier.config.js +0 -10
  215. package/templates/react/base/tsconfig.json.ejs +0 -29
  216. package/templates/react/base/vite.config.js.ejs +0 -23
  217. package/templates/react/code-router/src/main.tsx.ejs +0 -92
  218. package/templates/react/example/tanchat/README.md +0 -37
  219. package/templates/react/example/tanchat/assets/_dot_env.local.append +0 -2
  220. package/templates/react/example/tanchat/assets/public/example-guitar-flowers.jpg +0 -0
  221. package/templates/react/example/tanchat/assets/public/example-guitar-motherboard.jpg +0 -0
  222. package/templates/react/example/tanchat/assets/public/example-guitar-racing.jpg +0 -0
  223. package/templates/react/example/tanchat/assets/public/example-guitar-steamer-trunk.jpg +0 -0
  224. package/templates/react/example/tanchat/assets/public/example-guitar-superhero.jpg +0 -0
  225. package/templates/react/example/tanchat/assets/public/example-guitar-traveling.jpg +0 -0
  226. package/templates/react/example/tanchat/assets/public/example-guitar-video-games.jpg +0 -0
  227. package/templates/react/example/tanchat/assets/src/components/example-AIAssistant.tsx +0 -173
  228. package/templates/react/example/tanchat/assets/src/components/example-GuitarRecommendation.tsx +0 -47
  229. package/templates/react/example/tanchat/assets/src/data/example-guitars.ts +0 -83
  230. package/templates/react/example/tanchat/assets/src/demo.index.css +0 -220
  231. package/templates/react/example/tanchat/assets/src/integrations/tanchat/header-user.tsx +0 -5
  232. package/templates/react/example/tanchat/assets/src/routes/api.messages.ts +0 -24
  233. package/templates/react/example/tanchat/assets/src/routes/api.sse.ts +0 -23
  234. package/templates/react/example/tanchat/assets/src/routes/example.chat.tsx +0 -159
  235. package/templates/react/example/tanchat/assets/src/routes/example.guitars/$guitarId.tsx +0 -50
  236. package/templates/react/example/tanchat/assets/src/routes/example.guitars/index.tsx +0 -54
  237. package/templates/react/example/tanchat/assets/src/store/example-assistant.ts +0 -3
  238. package/templates/react/example/tanchat/assets/src/utils/demo.ai.ts +0 -62
  239. package/templates/react/example/tanchat/assets/src/utils/demo.sse.ts +0 -31
  240. package/templates/react/example/tanchat/assets/src/utils/demo.tools.ts +0 -47
  241. package/templates/react/example/tanchat/info.json +0 -19
  242. package/templates/react/example/tanchat/package.json +0 -16
  243. package/templates/react/file-router/package.fr.json +0 -5
  244. package/templates/react/file-router/src/main.tsx.ejs +0 -55
  245. package/templates/react/file-router/src/routes/__root.tsx.ejs +0 -82
  246. package/templates/solid/add-on/form/assets/src/routes/demo.form.tsx.ejs +0 -352
  247. package/templates/solid/add-on/form/info.json +0 -13
  248. package/templates/solid/add-on/form/package.json +0 -5
  249. package/templates/solid/add-on/module-federation/assets/module-federation.config.js.ejs +0 -27
  250. package/templates/solid/add-on/module-federation/assets/src/demo-mf-component.tsx +0 -3
  251. package/templates/solid/add-on/module-federation/assets/src/demo-mf-self-contained.tsx +0 -9
  252. package/templates/solid/add-on/module-federation/info.json +0 -7
  253. package/templates/solid/add-on/module-federation/package.json +0 -5
  254. package/templates/solid/add-on/sentry/assets/_dot_cursorrules.append +0 -22
  255. package/templates/solid/add-on/sentry/assets/_dot_env.local.append +0 -2
  256. package/templates/solid/add-on/sentry/assets/src/routes/demo.sentry.bad-event-handler.tsx +0 -20
  257. package/templates/solid/add-on/sentry/info.json +0 -13
  258. package/templates/solid/add-on/sentry/package.json +0 -5
  259. package/templates/solid/add-on/solid-ui/README.md +0 -9
  260. package/templates/solid/add-on/solid-ui/assets/src/lib/utils.ts +0 -6
  261. package/templates/solid/add-on/solid-ui/assets/src/styles.css +0 -138
  262. package/templates/solid/add-on/solid-ui/assets/ui.config.json +0 -13
  263. package/templates/solid/add-on/solid-ui/info.json +0 -11
  264. package/templates/solid/add-on/solid-ui/package.json +0 -9
  265. package/templates/solid/add-on/start/assets/app.config.ts +0 -16
  266. package/templates/solid/add-on/start/assets/src/api.ts +0 -6
  267. package/templates/solid/add-on/start/assets/src/client.tsx +0 -7
  268. package/templates/solid/add-on/start/assets/src/router.tsx.ejs +0 -24
  269. package/templates/solid/add-on/start/assets/src/routes/demo.start.server-funcs.tsx +0 -49
  270. package/templates/solid/add-on/start/assets/src/ssr.tsx +0 -12
  271. package/templates/solid/add-on/start/info.json +0 -14
  272. package/templates/solid/add-on/start/package.json +0 -12
  273. package/templates/solid/add-on/store/assets/src/lib/demo-store.ts +0 -13
  274. package/templates/solid/add-on/store/assets/src/routes/demo.store.tsx.ejs +0 -77
  275. package/templates/solid/add-on/store/info.json +0 -13
  276. package/templates/solid/add-on/store/package.json +0 -6
  277. package/templates/solid/add-on/t3env/README.md +0 -16
  278. package/templates/solid/add-on/t3env/assets/src/env.ts +0 -39
  279. package/templates/solid/add-on/t3env/info.json +0 -10
  280. package/templates/solid/add-on/t3env/package.json +0 -6
  281. package/templates/solid/add-on/tanstack-query/assets/src/integrations/tanstack-query/header-user.tsx +0 -5
  282. package/templates/solid/add-on/tanstack-query/assets/src/integrations/tanstack-query/provider.tsx +0 -15
  283. package/templates/solid/add-on/tanstack-query/assets/src/routes/demo.tanstack-query.tsx +0 -30
  284. package/templates/solid/add-on/tanstack-query/info.json +0 -13
  285. package/templates/solid/add-on/tanstack-query/package.json +0 -6
  286. package/templates/solid/base/README.md.ejs +0 -215
  287. package/templates/solid/base/_dot_cursorrules.append +0 -35
  288. package/templates/solid/base/_dot_gitignore +0 -5
  289. package/templates/solid/base/_dot_vscode/settings.biome.json +0 -38
  290. package/templates/solid/base/_dot_vscode/settings.json +0 -11
  291. package/templates/solid/base/index.html.ejs +0 -20
  292. package/templates/solid/base/package.biome.json +0 -10
  293. package/templates/solid/base/package.eslintprettier.json +0 -11
  294. package/templates/solid/base/package.json +0 -23
  295. package/templates/solid/base/package.ts.json +0 -5
  296. package/templates/solid/base/package.tw.json +0 -6
  297. package/templates/solid/base/public/favicon.ico +0 -0
  298. package/templates/solid/base/public/logo192.png +0 -0
  299. package/templates/solid/base/public/logo512.png +0 -0
  300. package/templates/solid/base/public/manifest.json +0 -25
  301. package/templates/solid/base/public/robots.txt +0 -3
  302. package/templates/solid/base/src/App.css +0 -0
  303. package/templates/solid/base/src/App.tsx.ejs +0 -47
  304. package/templates/solid/base/src/components/Header.tsx.ejs +0 -26
  305. package/templates/solid/base/src/logo.svg +0 -120
  306. package/templates/solid/base/src/styles.css.ejs +0 -15
  307. package/templates/solid/base/toolchain/.prettierignore +0 -3
  308. package/templates/solid/base/toolchain/biome.json +0 -31
  309. package/templates/solid/base/toolchain/eslint.config.js +0 -5
  310. package/templates/solid/base/toolchain/prettier.config.js +0 -10
  311. package/templates/solid/base/tsconfig.json.ejs +0 -31
  312. package/templates/solid/base/vite.config.js.ejs +0 -22
  313. package/templates/solid/code-router/src/main.tsx.ejs +0 -71
  314. package/templates/solid/example/tanchat/README.md +0 -52
  315. package/templates/solid/example/tanchat/assets/ai-streaming-server/README.md +0 -110
  316. package/templates/solid/example/tanchat/assets/ai-streaming-server/_dot_env.example +0 -1
  317. package/templates/solid/example/tanchat/assets/ai-streaming-server/package.json +0 -26
  318. package/templates/solid/example/tanchat/assets/ai-streaming-server/src/index.ts +0 -102
  319. package/templates/solid/example/tanchat/assets/ai-streaming-server/tsconfig.json +0 -15
  320. package/templates/solid/example/tanchat/assets/src/components/demo.SettingsDialog.tsx +0 -149
  321. package/templates/solid/example/tanchat/assets/src/demo.index.css +0 -227
  322. package/templates/solid/example/tanchat/assets/src/lib/demo-store.ts +0 -13
  323. package/templates/solid/example/tanchat/assets/src/routes/example.chat.tsx +0 -435
  324. package/templates/solid/example/tanchat/assets/src/store/demo.hooks.ts +0 -17
  325. package/templates/solid/example/tanchat/assets/src/store/demo.store.ts +0 -133
  326. package/templates/solid/example/tanchat/info.json +0 -14
  327. package/templates/solid/example/tanchat/package.json +0 -7
  328. package/templates/solid/file-router/package.fr.json +0 -5
  329. package/templates/solid/file-router/src/main.tsx.ejs +0 -47
  330. package/templates/solid/file-router/src/routes/__root.tsx.ejs +0 -41
  331. package/templates/solid/file-router/src/routes/index.tsx +0 -43
  332. package/tests/cra.test.ts +0 -293
  333. package/tests/snapshots/cra/cr-js-npm.json +0 -33
  334. package/tests/snapshots/cra/cr-ts-npm.json +0 -34
  335. package/tests/snapshots/cra/cr-ts-start-npm.json +0 -38
  336. package/tests/snapshots/cra/fr-ts-npm.json +0 -34
  337. package/tests/snapshots/cra/fr-ts-tw-npm.json +0 -33
  338. package/tests/snapshots/cra/solid-cr-js-npm.json +0 -31
  339. package/tests/snapshots/cra/solid-cr-ts-npm.json +0 -32
  340. package/tests/snapshots/cra/solid-cr-ts-start-npm.json +0 -36
  341. package/tests/snapshots/cra/solid-fr-ts-npm.json +0 -33
  342. package/tests/snapshots/cra/solid-fr-ts-tw-npm.json +0 -32
  343. package/tests/test-utilities.ts +0 -87
@@ -1,558 +0,0 @@
1
- Welcome to your new TanStack app!
2
-
3
- # Getting Started
4
-
5
- To run this application:
6
-
7
- ```bash
8
- <%= packageManager %> install
9
- <%= getPackageManagerRunScript('start') %>
10
- ```
11
-
12
- # Building For Production
13
-
14
- To build this application for production:
15
-
16
- ```bash
17
- <%= getPackageManagerRunScript('build') %>
18
- ```
19
-
20
- ## Testing
21
-
22
- This project uses [Vitest](https://vitest.dev/) for testing. You can run the tests with:
23
-
24
- ```bash
25
- <%= getPackageManagerRunScript('test') %>
26
- ```
27
-
28
- ## Styling
29
- <% if (tailwind) { %>
30
- This project uses [Tailwind CSS](https://tailwindcss.com/) for styling.
31
- <% } else { %>
32
- This project uses CSS for styling.
33
- <% } %>
34
- <% if (toolchain && toolchain !== 'none') { %>
35
- ## Linting & Formatting
36
- <% if (toolchain === 'biome') { %>
37
- This project uses [Biome](https://biomejs.dev/) for linting and formatting. The following scripts are available:
38
- <% } %>
39
- <% if (toolchain === 'eslint+prettier') { %>
40
- This project uses [eslint](https://eslint.org/) and [prettier](https://prettier.io/) for linting and formatting. Eslint is configured using [tanstack/eslint-config](https://tanstack.com/config/latest/docs/eslint). The following scripts are available:
41
- <% } %>
42
- ```bash
43
- <%= getPackageManagerRunScript('lint') %>
44
- <%= getPackageManagerRunScript('format') %>
45
- <%= getPackageManagerRunScript('check') %>
46
- ```
47
- <% } %>
48
- <% for(const addon of addOns.filter(addon => addon.readme)) { %>
49
- <%- addon.readme %>
50
- <% } %>
51
-
52
- ## Routing
53
- <% if (fileRouter) { %>This project uses [TanStack Router](https://tanstack.com/router). The initial setup is a file based router. Which means that the routes are managed as files in `src/routes`.<% } else { %>This project uses [TanStack Router](https://tanstack.com/router). The initial setup is a code based router. Which means that the routes are defined in code (in the `./src/main.<%= jsx %>` file). If you like you can also use a file based routing setup by following the [File Based Routing](https://tanstack.com/router/latest/docs/framework/react/guide/file-based-routing) guide.<% } %>
54
-
55
- ### Adding A Route
56
- <% if (fileRouter) { %>
57
- To add a new route to your application just add another a new file in the `./src/routes` directory.
58
-
59
- TanStack will automatically generate the content of the route file for you.
60
- <% } else { %>
61
- To add a new route to your application just add another `createRoute` call to the `./src/main.<%= jsx %>` file. The example below adds a new `/about`route to the root route.
62
-
63
- ```tsx
64
- const aboutRoute = createRoute({
65
- getParentRoute: () => rootRoute,
66
- path: "/about",
67
- component: () => <h1>About</h1>,
68
- });
69
- ```
70
-
71
- You will also need to add the route to the `routeTree` in the `./src/main.<%= jsx %>` file.
72
-
73
- ```tsx
74
- const routeTree = rootRoute.addChildren([indexRoute, aboutRoute]);
75
- ```
76
-
77
- With this set up you should be able to navigate to `/about` and see the about page.
78
-
79
- Of course you don't need to implement the About page in the `main.<%= jsx %>` file. You can create that component in another file and import it into the `main.<%= jsx %>` file, then use it in the `component` property of the `createRoute` call, like so:
80
-
81
- ```tsx
82
- import About from "./components/About.<%= jsx %>";
83
-
84
- const aboutRoute = createRoute({
85
- getParentRoute: () => rootRoute,
86
- path: "/about",
87
- component: About,
88
- });
89
- ```
90
-
91
- That is how we have the `App` component set up with the home page.
92
-
93
- For more information on the options you have when you are creating code based routes check out the [Code Based Routing](https://tanstack.com/router/latest/docs/framework/react/guide/code-based-routing) documentation.
94
- <% } %>
95
- Now that you have two routes you can use a `Link` component to navigate between them.
96
-
97
- ### Adding Links
98
-
99
- To use SPA (Single Page Application) navigation you will need to import the `Link` component from `@tanstack/react-router`.
100
-
101
- ```tsx
102
- import { Link } from "@tanstack/react-router";
103
- ```
104
-
105
- Then anywhere in your JSX you can use it like so:
106
-
107
- ```tsx
108
- <Link to="/about">About</Link>
109
- ```
110
-
111
- This will create a link that will navigate to the `/about` route.
112
-
113
- More information on the `Link` component can be found in the [Link documentation](https://tanstack.com/router/v1/docs/framework/react/api/router/linkComponent).
114
-
115
- ### Using A Layout
116
-
117
- <% if (codeRouter) { %>
118
- Layouts can be used to wrap the contents of the routes in menus, headers, footers, etc.
119
-
120
- There is already a layout in the `src/main.<%= jsx %>` file:
121
-
122
- ```tsx
123
- const rootRoute = createRootRoute({
124
- component: () => (
125
- <>
126
- <Outlet />
127
- <TanStackRouterDevtools />
128
- </>
129
- ),
130
- });
131
- ```
132
-
133
- You can use the React component specified in the `component` property of the `rootRoute` to wrap the contents of the routes. The `<Outlet />` component is used to render the current route within the body of the layout. For example you could add a header to the layout like so:
134
-
135
- ```tsx
136
- import { Link } from "@tanstack/react-router";
137
-
138
- const rootRoute = createRootRoute({
139
- component: () => (
140
- <>
141
- <header>
142
- <nav>
143
- <Link to="/">Home</Link>
144
- <Link to="/about">About</Link>
145
- </nav>
146
- </header>
147
- <Outlet />
148
- <TanStackRouterDevtools />
149
- </>
150
- ),
151
- });
152
- ```
153
- <% } else { %>In the File Based Routing setup the layout is located in `src/routes/__root.tsx`. Anything you add to the root route will appear in all the routes. The route content will appear in the JSX where you use the `<Outlet />` component.
154
-
155
- Here is an example layout that includes a header:
156
-
157
- ```tsx
158
- import { Outlet, createRootRoute } from '@tanstack/react-router'
159
- import { TanStackRouterDevtools } from '@tanstack/react-router-devtools'
160
-
161
- import { Link } from "@tanstack/react-router";
162
-
163
- export const Route = createRootRoute({
164
- component: () => (
165
- <>
166
- <header>
167
- <nav>
168
- <Link to="/">Home</Link>
169
- <Link to="/about">About</Link>
170
- </nav>
171
- </header>
172
- <Outlet />
173
- <TanStackRouterDevtools />
174
- </>
175
- ),
176
- })
177
- ```
178
- <% } %>
179
- The `<TanStackRouterDevtools />` component is not required so you can remove it if you don't want it in your layout.
180
-
181
- More information on layouts can be found in the [Layouts documentation](https://tanstack.com/router/latest/docs/framework/react/guide/routing-concepts#layouts).
182
-
183
- <% if (codeRouter) { %>
184
- ### Migrating To File Base Routing
185
-
186
- First you need to add the Vite plugin for Tanstack Router:
187
-
188
- ```bash
189
- <%= getPackageManagerAddScript("@tanstack/router-plugin", true) %>
190
- ```
191
-
192
- From there you need to update your `vite.config.js` file to use the plugin:
193
-
194
- ```ts
195
- import { defineConfig } from "vite";
196
- import viteReact from "@vitejs/plugin-react";
197
- import { TanStackRouterVite } from "@tanstack/router-plugin/vite";<% if (tailwind) { %>
198
- import tailwindcss from "@tailwindcss/vite";
199
- <% } %>
200
-
201
- // https://vitejs.dev/config/
202
- export default defineConfig({
203
- plugins: [
204
- TanStackRouterVite(),
205
- viteReact()<% if (tailwind) { %>,
206
- tailwindcss()<% } %>
207
- ],
208
- });
209
- ```
210
-
211
- Now you'll need to rearrange your files a little bit. That starts with creating a `routes` directory in the `src` directory:
212
-
213
- ```bash
214
- mkdir src/routes
215
- ```
216
-
217
- Then you'll need to create a `src/routes/__root.<%= jsx %>` file with the contents of the root route that was in `main.<%= jsx %>`.
218
-
219
- ```tsx
220
- import { Outlet, createRootRoute } from "@tanstack/react-router";
221
- import { TanStackRouterDevtools } from "@tanstack/react-router-devtools";
222
-
223
- export const Route = createRootRoute({
224
- component: () => (
225
- <>
226
- <Outlet />
227
- <TanStackRouterDevtools />
228
- </>
229
- ),
230
- });
231
- ```
232
-
233
- Next up you'll need to move your home route code into `src/routes/index.<%= jsx %>`
234
-
235
- ```tsx
236
- import { createFileRoute } from "@tanstack/react-router";
237
-
238
- import logo from "../logo.svg";
239
- import "../App.css";
240
-
241
- export const Route = createFileRoute("/")({
242
- component: App,
243
- });
244
-
245
- function App() {
246
- return (<% if (tailwind) { %>
247
- <div className="text-center">
248
- <header className="min-h-screen flex flex-col items-center justify-center bg-[#282c34] text-white text-[calc(10px+2vmin)]">
249
- <img
250
- src={logo}
251
- className="h-[40vmin] pointer-events-none animate-[spin_20s_linear_infinite]"
252
- alt="logo"
253
- />
254
- <p>
255
- Edit <code>src/App.tsx</code> and save to reload.
256
- </p>
257
- <a
258
- className="text-[#61dafb] hover:underline"
259
- href="https://reactjs.org"
260
- target="_blank"
261
- rel="noopener noreferrer"
262
- >
263
- Learn React
264
- </a>
265
- <a
266
- className="text-[#61dafb] hover:underline"
267
- href="https://tanstack.com"
268
- target="_blank"
269
- rel="noopener noreferrer"
270
- >
271
- Learn TanStack
272
- </a>
273
- </header>
274
- </div>
275
- <% } else { %>
276
- <div className="App">
277
- <header className="App-header">
278
- <img src={logo} className="App-logo" alt="logo" />
279
- <p>
280
- Edit <code>src/App.tsx</code> and save to reload.
281
- </p>
282
- <a
283
- className="App-link"
284
- href="https://reactjs.org"
285
- target="_blank"
286
- rel="noopener noreferrer"
287
- >
288
- Learn React
289
- </a>
290
- <a
291
- className="App-link"
292
- href="https://tanstack.com"
293
- target="_blank"
294
- rel="noopener noreferrer"
295
- >
296
- Learn TanStack
297
- </a>
298
- </header>
299
- </div>
300
- <% } %> );
301
- }
302
- ```
303
-
304
- At this point you can delete `src/App.<%= jsx %>`, you will no longer need it as the contents have moved into `src/routes/index.<%= jsx %>`.
305
-
306
- The only additional code is the `createFileRoute` function that tells TanStack Router where to render the route. Helpfully the Vite plugin will keep the path argument that goes to `createFileRoute` automatically in sync with the file system.
307
-
308
- Finally the `src/main.<%= jsx %>` file can be simplified down to this:
309
-
310
- ```tsx
311
- import { StrictMode } from "react";
312
- import ReactDOM from "react-dom/client";
313
- import { RouterProvider, createRouter } from "@tanstack/react-router";
314
-
315
- // Import the generated route tree
316
- import { routeTree } from "./routeTree.gen";
317
-
318
- import "./styles.css";
319
- import reportWebVitals from "./reportWebVitals.<%= js %>";
320
-
321
- // Create a new router instance
322
- const router = createRouter({
323
- routeTree,
324
- defaultPreload: "intent",
325
- defaultPreloadStaleTime: 0,
326
- scrollRestoration: true,
327
- defaultStructuralSharing: true
328
- });
329
- <% if (typescript) { %>
330
- // Register the router instance for type safety
331
- declare module "@tanstack/react-router" {
332
- interface Register {
333
- router: typeof router;
334
- }
335
- }
336
-
337
- // Render the app
338
- const rootElement = document.getElementById("app")!;
339
- <% } else { %>
340
- // Render the app
341
- const rootElement = document.getElementById("app");
342
- <% } %>if (!rootElement.innerHTML) {
343
- const root = ReactDOM.createRoot(rootElement);
344
- root.render(
345
- <StrictMode>
346
- <RouterProvider router={router} />
347
- </StrictMode>
348
- );
349
- }
350
-
351
- // If you want to start measuring performance in your app, pass a function
352
- // to log results (for example: reportWebVitals(console.log))
353
- // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
354
- reportWebVitals();
355
- ```
356
-
357
- Now you've got a file based routing setup in your project! Let's have some fun with it! Just create a file in `about.<%= jsx %>` in `src/routes` and it if the application is running TanStack will automatically add contents to the file and you'll have the start of your `/about` route ready to go with no additional work. You can see why folks find File Based Routing so easy to use.
358
-
359
- You can find out everything you need to know on how to use file based routing in the [File Based Routing](https://tanstack.com/router/latest/docs/framework/react/guide/file-based-routing) documentation.
360
- <% } %>
361
- ## Data Fetching
362
-
363
- There are multiple ways to fetch data in your application. You can use TanStack Query to fetch data from a server. But you can also use the `loader` functionality built into TanStack Router to load the data for a route before it's rendered.
364
-
365
- For example:
366
-
367
- ```tsx
368
- const peopleRoute = createRoute({
369
- getParentRoute: () => rootRoute,
370
- path: "/people",
371
- loader: async () => {
372
- const response = await fetch("https://swapi.dev/api/people");<% if (typescript) { %>
373
- return response.json() as Promise<{
374
- results: {
375
- name: string;
376
- }[];
377
- }>;
378
- <% } else { %>
379
- return response.json();
380
- <% } %> },
381
- component: () => {
382
- const data = peopleRoute.useLoaderData();
383
- return (
384
- <ul>
385
- {data.results.map((person) => (
386
- <li key={person.name}>{person.name}</li>
387
- ))}
388
- </ul>
389
- );
390
- },
391
- });
392
- ```
393
-
394
- Loaders simplify your data fetching logic dramatically. Check out more information in the [Loader documentation](https://tanstack.com/router/latest/docs/framework/react/guide/data-loading#loader-parameters).
395
-
396
- ### React-Query
397
-
398
- React-Query is an excellent addition or alternative to route loading and integrating it into you application is a breeze.
399
-
400
- First add your dependencies:
401
-
402
- ```bash
403
- <%= getPackageManagerAddScript("@tanstack/react-query @tanstack/react-query-devtools") %>
404
- ```
405
-
406
- Next we'll need to create a query client and provider. We recommend putting those in `main.<%= jsx %>`.
407
-
408
- ```tsx
409
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
410
-
411
- // ...
412
-
413
- const queryClient = new QueryClient();
414
-
415
- // ...
416
-
417
- if (!rootElement.innerHTML) {
418
- const root = ReactDOM.createRoot(rootElement);
419
-
420
- root.render(
421
- <QueryClientProvider client={queryClient}>
422
- <RouterProvider router={router} />
423
- </QueryClientProvider>
424
- );
425
- }
426
- ```
427
-
428
- You can also add TanStack Query Devtools to the root route (optional).
429
-
430
- ```tsx
431
- import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
432
-
433
- const rootRoute = createRootRoute({
434
- component: () => (
435
- <>
436
- <Outlet />
437
- <ReactQueryDevtools buttonPosition="top-right" />
438
- <TanStackRouterDevtools />
439
- </>
440
- ),
441
- });
442
- ```
443
-
444
- Now you can use `useQuery` to fetch your data.
445
-
446
- ```tsx
447
- import { useQuery } from "@tanstack/react-query";
448
-
449
- import "./App.css";
450
-
451
- function App() {
452
- const { data } = useQuery({
453
- queryKey: ["people"],
454
- queryFn: () =>
455
- fetch("https://swapi.dev/api/people")
456
- .then((res) => res.json())<% if (typescript) { %>
457
- .then((data) => data.results as { name: string }[]),
458
- <% } else { %>
459
- .then((data) => data.results),
460
- <% } %> initialData: [],
461
- });
462
-
463
- return (
464
- <div>
465
- <ul>
466
- {data.map((person) => (
467
- <li key={person.name}>{person.name}</li>
468
- ))}
469
- </ul>
470
- </div>
471
- );
472
- }
473
-
474
- export default App;
475
- ```
476
-
477
- You can find out everything you need to know on how to use React-Query in the [React-Query documentation](https://tanstack.com/query/latest/docs/framework/react/overview).
478
-
479
- ## State Management
480
-
481
- Another common requirement for React applications is state management. There are many options for state management in React. TanStack Store provides a great starting point for your project.
482
-
483
- First you need to add TanStack Store as a dependency:
484
-
485
- ```bash
486
- <%= getPackageManagerAddScript("@tanstack/store") %>
487
- ```
488
-
489
- Now let's create a simple counter in the `src/App.<%= jsx %>` file as a demonstration.
490
-
491
- ```tsx
492
- import { useStore } from "@tanstack/react-store";
493
- import { Store } from "@tanstack/store";
494
- import "./App.css";
495
-
496
- const countStore = new Store(0);
497
-
498
- function App() {
499
- const count = useStore(countStore);
500
- return (
501
- <div>
502
- <button onClick={() => countStore.setState((n) => n + 1)}>
503
- Increment - {count}
504
- </button>
505
- </div>
506
- );
507
- }
508
-
509
- export default App;
510
- ```
511
-
512
- One of the many nice features of TanStack Store is the ability to derive state from other state. That derived state will update when the base state updates.
513
-
514
- Let's check this out by doubling the count using derived state.
515
-
516
- ```tsx
517
- import { useStore } from "@tanstack/react-store";
518
- import { Store, Derived } from "@tanstack/store";
519
- import "./App.css";
520
-
521
- const countStore = new Store(0);
522
-
523
- const doubledStore = new Derived({
524
- fn: () => countStore.state * 2,
525
- deps: [countStore],
526
- });
527
- doubledStore.mount();
528
-
529
- function App() {
530
- const count = useStore(countStore);
531
- const doubledCount = useStore(doubledStore);
532
-
533
- return (
534
- <div>
535
- <button onClick={() => countStore.setState((n) => n + 1)}>
536
- Increment - {count}
537
- </button>
538
- <div>Doubled - {doubledCount}</div>
539
- </div>
540
- );
541
- }
542
-
543
- export default App;
544
- ```
545
-
546
- We use the `Derived` class to create a new store that is derived from another store. The `Derived` class has a `mount` method that will start the derived store updating.
547
-
548
- Once we've created the derived store we can use it in the `App` component just like we would any other store using the `useStore` hook.
549
-
550
- You can find out everything you need to know on how to use TanStack Store in the [TanStack Store documentation](https://tanstack.com/store/latest).
551
-
552
- # Demo files
553
-
554
- Files prefixed with `demo` can be safely deleted. They are there to provide a starting point for you to play around with the features you've installed.
555
-
556
- # Learn More
557
-
558
- You can learn more about all of the offerings from TanStack in the [TanStack documentation](https://tanstack.com).
@@ -1,5 +0,0 @@
1
- node_modules
2
- .DS_Store
3
- dist
4
- dist-ssr
5
- *.local
@@ -1,38 +0,0 @@
1
- {
2
- "files.watcherExclude": {
3
- "**/routeTree.gen.ts": true
4
- },
5
- "search.exclude": {
6
- "**/routeTree.gen.ts": true
7
- },
8
- "files.readonlyInclude": {
9
- "**/routeTree.gen.ts": true
10
- },
11
- "[javascript]": {
12
- "editor.defaultFormatter": "biomejs.biome"
13
- },
14
- "[javascriptreact]": {
15
- "editor.defaultFormatter": "biomejs.biome"
16
- },
17
- "[typescript]": {
18
- "editor.defaultFormatter": "biomejs.biome"
19
- },
20
- "[typescriptreact]": {
21
- "editor.defaultFormatter": "biomejs.biome"
22
- },
23
- "[json]": {
24
- "editor.defaultFormatter": "biomejs.biome"
25
- },
26
- "[jsonc]": {
27
- "editor.defaultFormatter": "biomejs.biome"
28
- },
29
- "[html]": {
30
- "editor.defaultFormatter": "biomejs.biome"
31
- },
32
- "[css]": {
33
- "editor.defaultFormatter": "biomejs.biome"
34
- },
35
- "editor.codeActionsOnSave": {
36
- "source.organizeImports.biome": "explicit"
37
- }
38
- }
@@ -1,11 +0,0 @@
1
- {
2
- "files.watcherExclude": {
3
- "**/routeTree.gen.ts": true
4
- },
5
- "search.exclude": {
6
- "**/routeTree.gen.ts": true
7
- },
8
- "files.readonlyInclude": {
9
- "**/routeTree.gen.ts": true
10
- }
11
- }
@@ -1,20 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8" />
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
6
- <link rel="icon" href="/favicon.ico" />
7
- <meta name="theme-color" content="#000000" />
8
- <meta
9
- name="description"
10
- content="Web site created using create-tsrouter-app"
11
- />
12
- <link rel="apple-touch-icon" href="/logo192.png" />
13
- <link rel="manifest" href="/manifest.json" />
14
- <title>Create TanStack App - <%= projectName %></title>
15
- </head>
16
- <body>
17
- <div id="app"></div>
18
- <script type="module" src="/src/main.<%= jsx %>"></script>
19
- </body>
20
- </html>
@@ -1,10 +0,0 @@
1
- {
2
- "scripts": {
3
- "format": "biome format",
4
- "lint": "biome lint",
5
- "check": "biome check"
6
- },
7
- "devDependencies": {
8
- "@biomejs/biome": "1.9.4"
9
- }
10
- }
@@ -1,11 +0,0 @@
1
- {
2
- "scripts": {
3
- "lint": "eslint",
4
- "format": "prettier",
5
- "check": "prettier --write . && eslint --fix"
6
- },
7
- "devDependencies": {
8
- "@tanstack/eslint-config": "^0.1.0",
9
- "prettier": "^3.5.3"
10
- }
11
- }
@@ -1,30 +0,0 @@
1
- {
2
- "name": "",
3
- "private": true,
4
- "type": "module",
5
- "scripts": {
6
- "dev": "vite --port 3000",
7
- "start": "vite --port 3000",
8
- "build": "vite build && tsc",
9
- "serve": "vite preview",
10
- "test": "vitest run"
11
- },
12
- "dependencies": {
13
- "@tanstack/react-router": "^1.114.3",
14
- "@tanstack/react-router-devtools": "^1.114.3",
15
- "react": "^19.0.0",
16
- "react-dom": "^19.0.0"
17
- },
18
- "devDependencies": {
19
- "@testing-library/dom": "^10.4.0",
20
- "@testing-library/react": "^16.2.0",
21
- "@types/react": "^19.0.8",
22
- "@types/react-dom": "^19.0.3",
23
- "@vitejs/plugin-react": "^4.3.4",
24
- "jsdom": "^26.0.0",
25
- "typescript": "^5.7.2",
26
- "vite": "^6.1.0",
27
- "vitest": "^3.0.5",
28
- "web-vitals": "^4.2.4"
29
- }
30
- }
@@ -1,7 +0,0 @@
1
- {
2
- "devDependencies": {
3
- "@types/react": "^19.0.8",
4
- "@types/react-dom": "^19.0.3",
5
- "typescript": "^5.7.2"
6
- }
7
- }