litestar-vite 0.1.1__py3-none-any.whl → 0.15.0rc2__py3-none-any.whl

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 (154) hide show
  1. litestar_vite/__init__.py +54 -4
  2. litestar_vite/__metadata__.py +12 -7
  3. litestar_vite/_codegen/__init__.py +26 -0
  4. litestar_vite/_codegen/inertia.py +407 -0
  5. litestar_vite/_codegen/openapi.py +233 -0
  6. litestar_vite/_codegen/routes.py +653 -0
  7. litestar_vite/_codegen/ts.py +235 -0
  8. litestar_vite/_handler/__init__.py +8 -0
  9. litestar_vite/_handler/app.py +524 -0
  10. litestar_vite/_handler/routing.py +130 -0
  11. litestar_vite/cli.py +1147 -10
  12. litestar_vite/codegen.py +39 -0
  13. litestar_vite/commands.py +79 -0
  14. litestar_vite/config.py +1594 -70
  15. litestar_vite/deploy.py +355 -0
  16. litestar_vite/doctor.py +1179 -0
  17. litestar_vite/exceptions.py +78 -0
  18. litestar_vite/executor.py +316 -0
  19. litestar_vite/handler.py +9 -0
  20. litestar_vite/html_transform.py +426 -0
  21. litestar_vite/inertia/__init__.py +53 -0
  22. litestar_vite/inertia/_utils.py +114 -0
  23. litestar_vite/inertia/exception_handler.py +172 -0
  24. litestar_vite/inertia/helpers.py +1043 -0
  25. litestar_vite/inertia/middleware.py +54 -0
  26. litestar_vite/inertia/plugin.py +133 -0
  27. litestar_vite/inertia/request.py +286 -0
  28. litestar_vite/inertia/response.py +706 -0
  29. litestar_vite/inertia/types.py +316 -0
  30. litestar_vite/loader.py +462 -121
  31. litestar_vite/plugin.py +2160 -21
  32. litestar_vite/py.typed +0 -0
  33. litestar_vite/scaffolding/__init__.py +20 -0
  34. litestar_vite/scaffolding/generator.py +270 -0
  35. litestar_vite/scaffolding/templates.py +437 -0
  36. litestar_vite/templates/__init__.py +0 -0
  37. litestar_vite/templates/addons/tailwindcss/tailwind.css.j2 +1 -0
  38. litestar_vite/templates/angular/index.html.j2 +12 -0
  39. litestar_vite/templates/angular/openapi-ts.config.ts.j2 +18 -0
  40. litestar_vite/templates/angular/package.json.j2 +35 -0
  41. litestar_vite/templates/angular/src/app/app.component.css.j2 +3 -0
  42. litestar_vite/templates/angular/src/app/app.component.html.j2 +1 -0
  43. litestar_vite/templates/angular/src/app/app.component.ts.j2 +9 -0
  44. litestar_vite/templates/angular/src/app/app.config.ts.j2 +5 -0
  45. litestar_vite/templates/angular/src/main.ts.j2 +9 -0
  46. litestar_vite/templates/angular/src/styles.css.j2 +9 -0
  47. litestar_vite/templates/angular/tsconfig.app.json.j2 +34 -0
  48. litestar_vite/templates/angular/tsconfig.json.j2 +20 -0
  49. litestar_vite/templates/angular/vite.config.ts.j2 +21 -0
  50. litestar_vite/templates/angular-cli/.postcssrc.json.j2 +5 -0
  51. litestar_vite/templates/angular-cli/angular.json.j2 +36 -0
  52. litestar_vite/templates/angular-cli/openapi-ts.config.ts.j2 +18 -0
  53. litestar_vite/templates/angular-cli/package.json.j2 +27 -0
  54. litestar_vite/templates/angular-cli/proxy.conf.json.j2 +18 -0
  55. litestar_vite/templates/angular-cli/src/app/app.component.css.j2 +3 -0
  56. litestar_vite/templates/angular-cli/src/app/app.component.html.j2 +1 -0
  57. litestar_vite/templates/angular-cli/src/app/app.component.ts.j2 +9 -0
  58. litestar_vite/templates/angular-cli/src/app/app.config.ts.j2 +5 -0
  59. litestar_vite/templates/angular-cli/src/index.html.j2 +13 -0
  60. litestar_vite/templates/angular-cli/src/main.ts.j2 +6 -0
  61. litestar_vite/templates/angular-cli/src/styles.css.j2 +10 -0
  62. litestar_vite/templates/angular-cli/tailwind.config.js.j2 +4 -0
  63. litestar_vite/templates/angular-cli/tsconfig.app.json.j2 +16 -0
  64. litestar_vite/templates/angular-cli/tsconfig.json.j2 +26 -0
  65. litestar_vite/templates/angular-cli/tsconfig.spec.json.j2 +9 -0
  66. litestar_vite/templates/astro/astro.config.mjs.j2 +28 -0
  67. litestar_vite/templates/astro/openapi-ts.config.ts.j2 +15 -0
  68. litestar_vite/templates/astro/src/layouts/Layout.astro.j2 +63 -0
  69. litestar_vite/templates/astro/src/pages/index.astro.j2 +36 -0
  70. litestar_vite/templates/astro/src/styles/global.css.j2 +1 -0
  71. litestar_vite/templates/base/.gitignore.j2 +42 -0
  72. litestar_vite/templates/base/openapi-ts.config.ts.j2 +15 -0
  73. litestar_vite/templates/base/package.json.j2 +38 -0
  74. litestar_vite/templates/base/resources/vite-env.d.ts.j2 +1 -0
  75. litestar_vite/templates/base/tsconfig.json.j2 +37 -0
  76. litestar_vite/templates/htmx/src/main.js.j2 +8 -0
  77. litestar_vite/templates/htmx/templates/base.html.j2.j2 +56 -0
  78. litestar_vite/templates/htmx/templates/index.html.j2.j2 +13 -0
  79. litestar_vite/templates/htmx/vite.config.ts.j2 +40 -0
  80. litestar_vite/templates/nuxt/app.vue.j2 +29 -0
  81. litestar_vite/templates/nuxt/composables/useApi.ts.j2 +33 -0
  82. litestar_vite/templates/nuxt/nuxt.config.ts.j2 +31 -0
  83. litestar_vite/templates/nuxt/openapi-ts.config.ts.j2 +15 -0
  84. litestar_vite/templates/nuxt/pages/index.vue.j2 +54 -0
  85. litestar_vite/templates/react/index.html.j2 +13 -0
  86. litestar_vite/templates/react/src/App.css.j2 +56 -0
  87. litestar_vite/templates/react/src/App.tsx.j2 +19 -0
  88. litestar_vite/templates/react/src/main.tsx.j2 +10 -0
  89. litestar_vite/templates/react/vite.config.ts.j2 +39 -0
  90. litestar_vite/templates/react-inertia/index.html.j2 +14 -0
  91. litestar_vite/templates/react-inertia/package.json.j2 +46 -0
  92. litestar_vite/templates/react-inertia/resources/App.css.j2 +68 -0
  93. litestar_vite/templates/react-inertia/resources/main.tsx.j2 +17 -0
  94. litestar_vite/templates/react-inertia/resources/pages/Home.tsx.j2 +18 -0
  95. litestar_vite/templates/react-inertia/resources/ssr.tsx.j2 +19 -0
  96. litestar_vite/templates/react-inertia/vite.config.ts.j2 +59 -0
  97. litestar_vite/templates/react-router/index.html.j2 +12 -0
  98. litestar_vite/templates/react-router/src/App.css.j2 +17 -0
  99. litestar_vite/templates/react-router/src/App.tsx.j2 +7 -0
  100. litestar_vite/templates/react-router/src/main.tsx.j2 +10 -0
  101. litestar_vite/templates/react-router/vite.config.ts.j2 +39 -0
  102. litestar_vite/templates/react-tanstack/index.html.j2 +12 -0
  103. litestar_vite/templates/react-tanstack/openapi-ts.config.ts.j2 +18 -0
  104. litestar_vite/templates/react-tanstack/src/App.css.j2 +17 -0
  105. litestar_vite/templates/react-tanstack/src/main.tsx.j2 +21 -0
  106. litestar_vite/templates/react-tanstack/src/routeTree.gen.ts.j2 +7 -0
  107. litestar_vite/templates/react-tanstack/src/routes/__root.tsx.j2 +9 -0
  108. litestar_vite/templates/react-tanstack/src/routes/books.tsx.j2 +9 -0
  109. litestar_vite/templates/react-tanstack/src/routes/index.tsx.j2 +9 -0
  110. litestar_vite/templates/react-tanstack/vite.config.ts.j2 +39 -0
  111. litestar_vite/templates/svelte/index.html.j2 +13 -0
  112. litestar_vite/templates/svelte/src/App.svelte.j2 +30 -0
  113. litestar_vite/templates/svelte/src/app.css.j2 +45 -0
  114. litestar_vite/templates/svelte/src/main.ts.j2 +8 -0
  115. litestar_vite/templates/svelte/src/vite-env.d.ts.j2 +2 -0
  116. litestar_vite/templates/svelte/svelte.config.js.j2 +5 -0
  117. litestar_vite/templates/svelte/vite.config.ts.j2 +39 -0
  118. litestar_vite/templates/svelte-inertia/index.html.j2 +14 -0
  119. litestar_vite/templates/svelte-inertia/resources/app.css.j2 +21 -0
  120. litestar_vite/templates/svelte-inertia/resources/main.ts.j2 +11 -0
  121. litestar_vite/templates/svelte-inertia/resources/pages/Home.svelte.j2 +43 -0
  122. litestar_vite/templates/svelte-inertia/resources/vite-env.d.ts.j2 +2 -0
  123. litestar_vite/templates/svelte-inertia/svelte.config.js.j2 +5 -0
  124. litestar_vite/templates/svelte-inertia/vite.config.ts.j2 +37 -0
  125. litestar_vite/templates/sveltekit/openapi-ts.config.ts.j2 +15 -0
  126. litestar_vite/templates/sveltekit/src/app.css.j2 +40 -0
  127. litestar_vite/templates/sveltekit/src/app.html.j2 +12 -0
  128. litestar_vite/templates/sveltekit/src/hooks.server.ts.j2 +55 -0
  129. litestar_vite/templates/sveltekit/src/routes/+layout.svelte.j2 +12 -0
  130. litestar_vite/templates/sveltekit/src/routes/+page.svelte.j2 +34 -0
  131. litestar_vite/templates/sveltekit/svelte.config.js.j2 +12 -0
  132. litestar_vite/templates/sveltekit/tsconfig.json.j2 +14 -0
  133. litestar_vite/templates/sveltekit/vite.config.ts.j2 +31 -0
  134. litestar_vite/templates/vue/env.d.ts.j2 +7 -0
  135. litestar_vite/templates/vue/index.html.j2 +13 -0
  136. litestar_vite/templates/vue/src/App.vue.j2 +28 -0
  137. litestar_vite/templates/vue/src/main.ts.j2 +5 -0
  138. litestar_vite/templates/vue/src/style.css.j2 +45 -0
  139. litestar_vite/templates/vue/vite.config.ts.j2 +39 -0
  140. litestar_vite/templates/vue-inertia/env.d.ts.j2 +7 -0
  141. litestar_vite/templates/vue-inertia/index.html.j2 +14 -0
  142. litestar_vite/templates/vue-inertia/package.json.j2 +49 -0
  143. litestar_vite/templates/vue-inertia/resources/main.ts.j2 +18 -0
  144. litestar_vite/templates/vue-inertia/resources/pages/Home.vue.j2 +22 -0
  145. litestar_vite/templates/vue-inertia/resources/ssr.ts.j2 +21 -0
  146. litestar_vite/templates/vue-inertia/resources/style.css.j2 +21 -0
  147. litestar_vite/templates/vue-inertia/vite.config.ts.j2 +59 -0
  148. litestar_vite-0.15.0rc2.dist-info/METADATA +230 -0
  149. litestar_vite-0.15.0rc2.dist-info/RECORD +151 -0
  150. {litestar_vite-0.1.1.dist-info → litestar_vite-0.15.0rc2.dist-info}/WHEEL +1 -1
  151. litestar_vite/template_engine.py +0 -103
  152. litestar_vite-0.1.1.dist-info/METADATA +0 -68
  153. litestar_vite-0.1.1.dist-info/RECORD +0 -11
  154. {litestar_vite-0.1.1.dist-info → litestar_vite-0.15.0rc2.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,437 @@
1
+ """Framework template definitions for scaffolding.
2
+
3
+ This module defines the available framework templates and their configurations.
4
+ """
5
+
6
+ from collections.abc import Callable
7
+ from dataclasses import dataclass, field
8
+ from enum import Enum
9
+
10
+
11
+ def _str_list_factory() -> list[str]:
12
+ return []
13
+
14
+
15
+ class FrameworkType(str, Enum):
16
+ """Supported frontend framework types."""
17
+
18
+ REACT = "react"
19
+ REACT_ROUTER = "react-router"
20
+ REACT_TANSTACK = "react-tanstack"
21
+ REACT_INERTIA = "react-inertia"
22
+ VUE = "vue"
23
+ VUE_INERTIA = "vue-inertia"
24
+ SVELTE = "svelte"
25
+ SVELTE_INERTIA = "svelte-inertia"
26
+ SVELTEKIT = "sveltekit"
27
+ NUXT = "nuxt"
28
+ ASTRO = "astro"
29
+ HTMX = "htmx"
30
+ ANGULAR = "angular"
31
+ ANGULAR_CLI = "angular-cli"
32
+
33
+
34
+ _ListStrFactory: Callable[[], list[str]] = _str_list_factory
35
+
36
+
37
+ @dataclass
38
+ class FrameworkTemplate:
39
+ """Configuration for a frontend framework template.
40
+
41
+ Attributes:
42
+ name: Display name for the template
43
+ type: Framework type enum
44
+ description: Brief description shown in selection UI
45
+ vite_plugin: Name of the Vite plugin import (if any)
46
+ dependencies: NPM dependencies to install
47
+ dev_dependencies: NPM dev dependencies to install
48
+ files: List of template files to generate
49
+ uses_typescript: Whether TypeScript is used by default
50
+ has_ssr: Whether SSR is supported
51
+ inertia_compatible: Whether it works with Inertia.js
52
+ uses_vite: Whether the template is Vite-based (skip base files when False)
53
+ resource_dir: Preferred source directory name for the framework
54
+ """
55
+
56
+ name: str
57
+ type: FrameworkType
58
+ description: str
59
+ vite_plugin: "str | None" = None
60
+ dependencies: list[str] = field(default_factory=_ListStrFactory)
61
+ dev_dependencies: list[str] = field(default_factory=_ListStrFactory)
62
+ files: list[str] = field(default_factory=_ListStrFactory)
63
+ uses_typescript: bool = True
64
+ has_ssr: bool = False
65
+ inertia_compatible: bool = False
66
+ uses_vite: bool = True
67
+ resource_dir: str = "resources"
68
+
69
+
70
+ FRAMEWORK_TEMPLATES: dict[FrameworkType, FrameworkTemplate] = {
71
+ FrameworkType.REACT: FrameworkTemplate(
72
+ name="React",
73
+ type=FrameworkType.REACT,
74
+ description="React 18+ with TypeScript and Vite",
75
+ vite_plugin="@vitejs/plugin-react",
76
+ dependencies=["react", "react-dom"],
77
+ dev_dependencies=["@vitejs/plugin-react", "@types/react", "@types/react-dom", "typescript"],
78
+ files=[
79
+ "vite.config.ts",
80
+ "tsconfig.json",
81
+ "package.json",
82
+ "index.html",
83
+ "src/main.tsx",
84
+ "src/App.tsx",
85
+ "src/App.css",
86
+ ],
87
+ uses_typescript=True,
88
+ has_ssr=False,
89
+ inertia_compatible=True,
90
+ resource_dir="src",
91
+ ),
92
+ FrameworkType.REACT_ROUTER: FrameworkTemplate(
93
+ name="React + React Router",
94
+ type=FrameworkType.REACT_ROUTER,
95
+ description="React 18+ with React Router for SPA routing",
96
+ vite_plugin="@vitejs/plugin-react",
97
+ dependencies=["react", "react-dom", "react-router-dom"],
98
+ dev_dependencies=["@vitejs/plugin-react", "@types/react", "@types/react-dom", "typescript"],
99
+ files=[
100
+ "vite.config.ts",
101
+ "tsconfig.json",
102
+ "package.json",
103
+ "index.html",
104
+ "src/main.tsx",
105
+ "src/App.tsx",
106
+ "src/App.css",
107
+ ],
108
+ uses_typescript=True,
109
+ has_ssr=False,
110
+ inertia_compatible=False,
111
+ resource_dir="src",
112
+ ),
113
+ FrameworkType.REACT_TANSTACK: FrameworkTemplate(
114
+ name="React + TanStack Router",
115
+ type=FrameworkType.REACT_TANSTACK,
116
+ description="React 18+ with TanStack Router (file-based), Zod, and API client",
117
+ vite_plugin="@vitejs/plugin-react",
118
+ dependencies=["react", "react-dom", "@tanstack/react-router", "zod"],
119
+ dev_dependencies=[
120
+ "@vitejs/plugin-react",
121
+ "@tanstack/router-plugin",
122
+ "@hey-api/openapi-ts",
123
+ "@types/react",
124
+ "@types/react-dom",
125
+ "typescript",
126
+ ],
127
+ files=[
128
+ "vite.config.ts",
129
+ "tsconfig.json",
130
+ "package.json",
131
+ "index.html",
132
+ "src/main.tsx",
133
+ "src/routes/__root.tsx",
134
+ "src/routes/index.tsx",
135
+ "src/routes/books.tsx",
136
+ "src/routeTree.gen.ts",
137
+ "src/App.css",
138
+ "openapi-ts.config.ts",
139
+ ],
140
+ uses_typescript=True,
141
+ has_ssr=False,
142
+ inertia_compatible=False,
143
+ resource_dir="src",
144
+ ),
145
+ FrameworkType.REACT_INERTIA: FrameworkTemplate(
146
+ name="React + Inertia.js",
147
+ type=FrameworkType.REACT_INERTIA,
148
+ description="React 18+ with Inertia.js for server-side routing",
149
+ vite_plugin="@vitejs/plugin-react",
150
+ dependencies=["react", "react-dom", "@inertiajs/react"],
151
+ dev_dependencies=["@vitejs/plugin-react", "@types/react", "@types/react-dom", "typescript", "vite"],
152
+ files=[
153
+ "vite.config.ts",
154
+ "tsconfig.json",
155
+ "package.json",
156
+ "index.html",
157
+ "resources/main.tsx",
158
+ "resources/ssr.tsx",
159
+ "resources/pages/Home.tsx",
160
+ "resources/App.css",
161
+ ],
162
+ uses_typescript=True,
163
+ has_ssr=True,
164
+ inertia_compatible=True,
165
+ resource_dir="resources",
166
+ ),
167
+ FrameworkType.VUE: FrameworkTemplate(
168
+ name="Vue 3",
169
+ type=FrameworkType.VUE,
170
+ description="Vue 3 with Composition API and TypeScript",
171
+ vite_plugin="@vitejs/plugin-vue",
172
+ dependencies=["vue"],
173
+ dev_dependencies=["@vitejs/plugin-vue", "vue-tsc", "typescript"],
174
+ files=[
175
+ "vite.config.ts",
176
+ "tsconfig.json",
177
+ "package.json",
178
+ "index.html",
179
+ "env.d.ts",
180
+ "src/main.ts",
181
+ "src/App.vue",
182
+ "src/style.css",
183
+ ],
184
+ uses_typescript=True,
185
+ has_ssr=False,
186
+ inertia_compatible=True,
187
+ resource_dir="src",
188
+ ),
189
+ FrameworkType.VUE_INERTIA: FrameworkTemplate(
190
+ name="Vue + Inertia.js",
191
+ type=FrameworkType.VUE_INERTIA,
192
+ description="Vue 3 with Inertia.js for server-side routing",
193
+ vite_plugin="@vitejs/plugin-vue",
194
+ dependencies=["vue", "@inertiajs/vue3"],
195
+ dev_dependencies=["@vitejs/plugin-vue", "vue-tsc", "typescript"],
196
+ files=[
197
+ "vite.config.ts",
198
+ "tsconfig.json",
199
+ "package.json",
200
+ "index.html",
201
+ "env.d.ts",
202
+ "resources/main.ts",
203
+ "resources/ssr.ts",
204
+ "resources/pages/Home.vue",
205
+ "resources/style.css",
206
+ ],
207
+ uses_typescript=True,
208
+ has_ssr=True,
209
+ inertia_compatible=True,
210
+ resource_dir="resources",
211
+ ),
212
+ FrameworkType.SVELTE: FrameworkTemplate(
213
+ name="Svelte 5",
214
+ type=FrameworkType.SVELTE,
215
+ description="Svelte 5 with runes and TypeScript",
216
+ vite_plugin="@sveltejs/vite-plugin-svelte",
217
+ dependencies=["svelte"],
218
+ dev_dependencies=["@sveltejs/vite-plugin-svelte", "svelte-check", "typescript", "tslib"],
219
+ files=[
220
+ "vite.config.ts",
221
+ "svelte.config.js",
222
+ "tsconfig.json",
223
+ "package.json",
224
+ "index.html",
225
+ "src/main.ts",
226
+ "src/App.svelte",
227
+ "src/app.css",
228
+ ],
229
+ uses_typescript=True,
230
+ has_ssr=False,
231
+ inertia_compatible=True,
232
+ resource_dir="src",
233
+ ),
234
+ FrameworkType.SVELTE_INERTIA: FrameworkTemplate(
235
+ name="Svelte + Inertia.js",
236
+ type=FrameworkType.SVELTE_INERTIA,
237
+ description="Svelte 5 with Inertia.js for server-side routing",
238
+ vite_plugin="@sveltejs/vite-plugin-svelte",
239
+ dependencies=["svelte", "@inertiajs/svelte"],
240
+ dev_dependencies=["@sveltejs/vite-plugin-svelte", "svelte-check", "typescript", "tslib"],
241
+ files=[
242
+ "vite.config.ts",
243
+ "svelte.config.js",
244
+ "tsconfig.json",
245
+ "package.json",
246
+ "index.html",
247
+ "resources/main.ts",
248
+ "resources/pages/Home.svelte",
249
+ "resources/app.css",
250
+ ],
251
+ uses_typescript=True,
252
+ has_ssr=False,
253
+ inertia_compatible=True,
254
+ resource_dir="resources",
255
+ ),
256
+ FrameworkType.SVELTEKIT: FrameworkTemplate(
257
+ name="SvelteKit",
258
+ type=FrameworkType.SVELTEKIT,
259
+ description="SvelteKit with Litestar API backend",
260
+ vite_plugin="litestar-vite-plugin/sveltekit",
261
+ dependencies=["svelte", "@sveltejs/kit"],
262
+ dev_dependencies=[
263
+ "@sveltejs/vite-plugin-svelte",
264
+ "@sveltejs/adapter-auto",
265
+ "svelte-check",
266
+ "typescript",
267
+ "tslib",
268
+ "litestar-vite-plugin",
269
+ ],
270
+ files=[
271
+ "vite.config.ts",
272
+ "svelte.config.js",
273
+ "tsconfig.json",
274
+ "src/app.html",
275
+ "src/app.css",
276
+ "src/hooks.server.ts",
277
+ "src/routes/+page.svelte",
278
+ "src/routes/+layout.svelte",
279
+ ],
280
+ uses_typescript=True,
281
+ has_ssr=True,
282
+ inertia_compatible=False,
283
+ ),
284
+ FrameworkType.NUXT: FrameworkTemplate(
285
+ name="Nuxt 3",
286
+ type=FrameworkType.NUXT,
287
+ description="Nuxt 3 with Litestar API backend",
288
+ vite_plugin=None,
289
+ dependencies=["nuxt", "vue"],
290
+ dev_dependencies=["typescript", "vue-tsc", "litestar-vite-plugin"],
291
+ files=["nuxt.config.ts", "app.vue", "pages/index.vue", "composables/useApi.ts"],
292
+ uses_typescript=True,
293
+ has_ssr=True,
294
+ inertia_compatible=False,
295
+ ),
296
+ FrameworkType.ASTRO: FrameworkTemplate(
297
+ name="Astro",
298
+ type=FrameworkType.ASTRO,
299
+ description="Astro with Litestar API backend",
300
+ vite_plugin="litestar-vite-plugin/astro",
301
+ dependencies=["astro"],
302
+ dev_dependencies=["typescript", "litestar-vite-plugin"],
303
+ files=["astro.config.mjs", "src/pages/index.astro", "src/layouts/Layout.astro", "src/styles/global.css"],
304
+ uses_typescript=True,
305
+ has_ssr=True,
306
+ inertia_compatible=False,
307
+ ),
308
+ FrameworkType.HTMX: FrameworkTemplate(
309
+ name="HTMX",
310
+ type=FrameworkType.HTMX,
311
+ description="Server-rendered HTML with HTMX",
312
+ vite_plugin=None,
313
+ dependencies=["htmx.org"],
314
+ dev_dependencies=["typescript"],
315
+ files=["vite.config.ts", "resources/main.js", "templates/base.html.j2", "templates/index.html.j2"],
316
+ uses_typescript=False,
317
+ has_ssr=False,
318
+ inertia_compatible=False,
319
+ resource_dir="resources",
320
+ ),
321
+ FrameworkType.ANGULAR: FrameworkTemplate(
322
+ name="Angular (Vite)",
323
+ type=FrameworkType.ANGULAR,
324
+ description="Angular 21+ with Vite (zoneless signals)",
325
+ vite_plugin="@analogjs/vite-plugin-angular",
326
+ dependencies=[
327
+ "@angular/animations",
328
+ "@angular/common",
329
+ "@angular/compiler",
330
+ "@angular/core",
331
+ "@angular/forms",
332
+ "@angular/platform-browser",
333
+ "rxjs",
334
+ ],
335
+ dev_dependencies=[
336
+ "@analogjs/vite-plugin-angular",
337
+ "@angular/build",
338
+ "@angular/compiler-cli",
339
+ "@angular/platform-browser-dynamic",
340
+ "typescript",
341
+ "@types/node",
342
+ ],
343
+ files=[
344
+ "vite.config.ts",
345
+ "tsconfig.json",
346
+ "tsconfig.app.json",
347
+ "package.json",
348
+ "index.html",
349
+ "src/main.ts",
350
+ "src/styles.css",
351
+ "src/app/app.component.ts",
352
+ "src/app/app.component.html",
353
+ "src/app/app.component.css",
354
+ "src/app/app.config.ts",
355
+ ],
356
+ uses_typescript=True,
357
+ has_ssr=False,
358
+ inertia_compatible=False,
359
+ uses_vite=True,
360
+ resource_dir="src",
361
+ ),
362
+ FrameworkType.ANGULAR_CLI: FrameworkTemplate(
363
+ name="Angular CLI",
364
+ type=FrameworkType.ANGULAR_CLI,
365
+ description="Angular 21+ with zoneless signals and TailwindCSS (Angular CLI)",
366
+ vite_plugin=None,
367
+ dependencies=[
368
+ "@angular/animations",
369
+ "@angular/common",
370
+ "@angular/compiler",
371
+ "@angular/core",
372
+ "@angular/forms",
373
+ "@angular/platform-browser",
374
+ "@angular/platform-browser-dynamic",
375
+ "rxjs",
376
+ "@tailwindcss/postcss",
377
+ "tailwindcss",
378
+ ],
379
+ dev_dependencies=[
380
+ "@angular-devkit/build-angular",
381
+ "@angular/cli",
382
+ "@angular/compiler-cli",
383
+ "@types/node",
384
+ "typescript",
385
+ "postcss",
386
+ "autoprefixer",
387
+ ],
388
+ files=[
389
+ "angular.json",
390
+ "tsconfig.json",
391
+ "tsconfig.app.json",
392
+ "tsconfig.spec.json",
393
+ "package.json",
394
+ "proxy.conf.json",
395
+ ".postcssrc.json",
396
+ "tailwind.config.js",
397
+ "src/index.html",
398
+ "src/main.ts",
399
+ "src/styles.css",
400
+ "src/app/app.component.ts",
401
+ "src/app/app.component.html",
402
+ "src/app/app.component.css",
403
+ "src/app/app.config.ts",
404
+ ],
405
+ uses_typescript=True,
406
+ has_ssr=False,
407
+ inertia_compatible=False,
408
+ uses_vite=False,
409
+ resource_dir="src",
410
+ ),
411
+ }
412
+
413
+
414
+ def get_available_templates() -> list[FrameworkTemplate]:
415
+ """Get all available framework templates.
416
+
417
+ Returns:
418
+ List of available FrameworkTemplate instances.
419
+ """
420
+ return list(FRAMEWORK_TEMPLATES.values())
421
+
422
+
423
+ def get_template(framework_type: "FrameworkType | str") -> "FrameworkTemplate | None":
424
+ """Get a specific framework template.
425
+
426
+ Args:
427
+ framework_type: The framework type (enum or string).
428
+
429
+ Returns:
430
+ The FrameworkTemplate if found, None otherwise.
431
+ """
432
+ if isinstance(framework_type, FrameworkType):
433
+ return FRAMEWORK_TEMPLATES.get(framework_type)
434
+ try:
435
+ return FRAMEWORK_TEMPLATES.get(FrameworkType(framework_type))
436
+ except ValueError:
437
+ return None
File without changes
@@ -0,0 +1 @@
1
+ @import "tailwindcss";
@@ -0,0 +1,12 @@
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
+ <title>{{ project_name }}</title>
7
+ </head>
8
+ <body>
9
+ <app-root></app-root>
10
+ <script type="module" src="/{{ resource_dir }}/main.ts"></script>
11
+ </body>
12
+ </html>
@@ -0,0 +1,18 @@
1
+ import { defineConfig } from "@hey-api/openapi-ts";
2
+
3
+ export default defineConfig({
4
+ input: "./{{ resource_dir }}/generated/openapi.json",
5
+ output: "./{{ resource_dir }}/generated/api",
6
+ plugins: [
7
+ "@hey-api/typescript",
8
+ "@hey-api/schemas",
9
+ {
10
+ name: "@hey-api/sdk",
11
+ asClass: true,
12
+ },
13
+ "@hey-api/client-angular",
14
+ {%- if generate_zod %}
15
+ "zod",
16
+ {%- endif %}
17
+ ],
18
+ });
@@ -0,0 +1,35 @@
1
+ {
2
+ "name": "{{ project_name }}",
3
+ "private": true,
4
+ "type": "module",
5
+ "scripts": {
6
+ "dev": "vite",
7
+ "build": "vite build",
8
+ "preview": "vite preview",
9
+ "serve": "vite preview",
10
+ "watch": "npm run serve"{% if generate_client %},
11
+ "generate-types": "openapi-ts"{% endif %}
12
+ },
13
+ "dependencies": {
14
+ {%- for dep in dependencies %}
15
+ "{{ dep }}": "latest"{% if not loop.last or generate_zod %},{% endif %}
16
+ {%- endfor %}
17
+ {%- if generate_zod %}
18
+ "zod": "^4.1.13"
19
+ {%- endif %}
20
+ },
21
+ "devDependencies": {
22
+ {%- for dep in dev_dependencies %}
23
+ "{{ dep }}": "latest",
24
+ {%- endfor %}
25
+ {%- if use_tailwind %}
26
+ "@tailwindcss/vite": "^4.1.17",
27
+ "tailwindcss": "^4.1.17",
28
+ {%- endif %}
29
+ {%- if generate_client %}
30
+ "@hey-api/openapi-ts": "^0.88.0",
31
+ {%- endif %}
32
+ "litestar-vite-plugin": "latest",
33
+ "vite": "^7.2.6"
34
+ }
35
+ }
@@ -0,0 +1,3 @@
1
+ :host {
2
+ display: block;
3
+ }
@@ -0,0 +1 @@
1
+ <main></main>
@@ -0,0 +1,9 @@
1
+ import { Component } from "@angular/core";
2
+
3
+ @Component({
4
+ selector: "app-root",
5
+ standalone: true,
6
+ templateUrl: "./app.component.html",
7
+ styleUrl: "./app.component.css",
8
+ })
9
+ export class AppComponent {}
@@ -0,0 +1,5 @@
1
+ import type { ApplicationConfig } from "@angular/core";
2
+
3
+ export const appConfig: ApplicationConfig = {
4
+ providers: [],
5
+ };
@@ -0,0 +1,9 @@
1
+ import { bootstrapApplication } from "@angular/platform-browser";
2
+
3
+ import { AppComponent } from "./app/app.component";
4
+ import { appConfig } from "./app/app.config";
5
+ {% if use_tailwind %}import "./styles.css";{% endif %}
6
+
7
+ bootstrapApplication(AppComponent, appConfig).catch((err) =>
8
+ console.error("Bootstrap failed:", err)
9
+ );
@@ -0,0 +1,9 @@
1
+ {% if use_tailwind %}@import "tailwindcss";
2
+
3
+ {% endif %}:root {
4
+ font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
5
+ line-height: 1.5;
6
+ color: #0f172a;
7
+ background: #f8fafc;
8
+ min-height: 100vh;
9
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "extends": "./tsconfig.json",
3
+ "compileOnSave": false,
4
+ "compilerOptions": {
5
+ "baseUrl": "./",
6
+ "outDir": "./dist/out-tsc",
7
+ "forceConsistentCasingInFileNames": true,
8
+ "strict": true,
9
+ "noImplicitOverride": true,
10
+ "noPropertyAccessFromIndexSignature": true,
11
+ "noImplicitReturns": true,
12
+ "noFallthroughCasesInSwitch": true,
13
+ "sourceMap": true,
14
+ "declaration": false,
15
+ "downlevelIteration": true,
16
+ "experimentalDecorators": true,
17
+ "moduleResolution": "bundler",
18
+ "importHelpers": true,
19
+ "noEmit": false,
20
+ "target": "ES2022",
21
+ "module": "ESNext",
22
+ "lib": ["ES2022", "dom"],
23
+ "skipLibCheck": true
24
+ },
25
+ "angularCompilerOptions": {
26
+ "enableI18nLegacyMessageIdFormat": false,
27
+ "strictInjectionParameters": true,
28
+ "strictInputAccessModifiers": true,
29
+ "strictTemplates": true
30
+ },
31
+ "files": ["{{ resource_dir }}/main.ts"],
32
+ "include": ["{{ resource_dir }}/**/*.ts"],
33
+ "exclude": ["{{ resource_dir }}/generated/**"]
34
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "useDefineForClassFields": false,
5
+ "module": "ESNext",
6
+ "moduleResolution": "Bundler",
7
+ "types": ["vite/client"],
8
+ "allowImportingTsExtensions": true,
9
+ "noEmit": true,
10
+ "strict": true,
11
+ "skipLibCheck": true,
12
+ "forceConsistentCasingInFileNames": true,
13
+ "resolveJsonModule": true,
14
+ "baseUrl": ".",
15
+ "paths": {
16
+ "@/*": ["./{{ resource_dir }}/*"]
17
+ }
18
+ },
19
+ "include": ["{{ resource_dir }}/**/*.ts"]
20
+ }
@@ -0,0 +1,21 @@
1
+ import angular from "@analogjs/vite-plugin-angular";
2
+ {% if use_tailwind %}import tailwindcss from "@tailwindcss/vite";
3
+ {% endif %}import litestar from "litestar-vite-plugin";
4
+ import { defineConfig } from "vite";
5
+
6
+ export default defineConfig({
7
+ resolve: {
8
+ mainFields: ["module"],
9
+ alias: {
10
+ "@": "/{{ resource_dir }}",
11
+ },
12
+ },
13
+ plugins: [
14
+ // Angular plugin must be first
15
+ angular(),
16
+ {% if use_tailwind %} tailwindcss(),
17
+ {% endif %} litestar({
18
+ input: ["{{ resource_dir }}/main.ts"{% if use_tailwind %}, "{{ resource_dir }}/styles.css"{% endif %}],
19
+ }),
20
+ ],
21
+ });
@@ -0,0 +1,5 @@
1
+ {
2
+ "plugins": {
3
+ "@tailwindcss/postcss": {}
4
+ }
5
+ }
@@ -0,0 +1,36 @@
1
+ {
2
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
3
+ "version": 1,
4
+ "projects": {
5
+ "{{ project_name }}": {
6
+ "projectType": "application",
7
+ "root": "",
8
+ "sourceRoot": "src",
9
+ "prefix": "app",
10
+ "architect": {
11
+ "build": {
12
+ "builder": "@angular-devkit/build-angular:application",
13
+ "options": {
14
+ "outputPath": "dist",
15
+ "index": "src/index.html",
16
+ "browser": "src/main.ts",
17
+ "tsConfig": "tsconfig.app.json",
18
+ "assets": [
19
+ { "glob": "**/*", "input": "src/assets", "output": "/assets" },
20
+ { "glob": "**/*", "input": "{{ resource_dir }}/generated", "output": "/{{ resource_dir }}/generated" }
21
+ ],
22
+ "styles": ["src/styles.css"],
23
+ "scripts": []
24
+ }
25
+ },
26
+ "serve": {
27
+ "builder": "@angular-devkit/build-angular:dev-server",
28
+ "options": {
29
+ "buildTarget": "{{ project_name }}:build",
30
+ "proxyConfig": "proxy.conf.json"
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }