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.
- litestar_vite/__init__.py +54 -4
- litestar_vite/__metadata__.py +12 -7
- litestar_vite/_codegen/__init__.py +26 -0
- litestar_vite/_codegen/inertia.py +407 -0
- litestar_vite/_codegen/openapi.py +233 -0
- litestar_vite/_codegen/routes.py +653 -0
- litestar_vite/_codegen/ts.py +235 -0
- litestar_vite/_handler/__init__.py +8 -0
- litestar_vite/_handler/app.py +524 -0
- litestar_vite/_handler/routing.py +130 -0
- litestar_vite/cli.py +1147 -10
- litestar_vite/codegen.py +39 -0
- litestar_vite/commands.py +79 -0
- litestar_vite/config.py +1594 -70
- litestar_vite/deploy.py +355 -0
- litestar_vite/doctor.py +1179 -0
- litestar_vite/exceptions.py +78 -0
- litestar_vite/executor.py +316 -0
- litestar_vite/handler.py +9 -0
- litestar_vite/html_transform.py +426 -0
- litestar_vite/inertia/__init__.py +53 -0
- litestar_vite/inertia/_utils.py +114 -0
- litestar_vite/inertia/exception_handler.py +172 -0
- litestar_vite/inertia/helpers.py +1043 -0
- litestar_vite/inertia/middleware.py +54 -0
- litestar_vite/inertia/plugin.py +133 -0
- litestar_vite/inertia/request.py +286 -0
- litestar_vite/inertia/response.py +706 -0
- litestar_vite/inertia/types.py +316 -0
- litestar_vite/loader.py +462 -121
- litestar_vite/plugin.py +2160 -21
- litestar_vite/py.typed +0 -0
- litestar_vite/scaffolding/__init__.py +20 -0
- litestar_vite/scaffolding/generator.py +270 -0
- litestar_vite/scaffolding/templates.py +437 -0
- litestar_vite/templates/__init__.py +0 -0
- litestar_vite/templates/addons/tailwindcss/tailwind.css.j2 +1 -0
- litestar_vite/templates/angular/index.html.j2 +12 -0
- litestar_vite/templates/angular/openapi-ts.config.ts.j2 +18 -0
- litestar_vite/templates/angular/package.json.j2 +35 -0
- litestar_vite/templates/angular/src/app/app.component.css.j2 +3 -0
- litestar_vite/templates/angular/src/app/app.component.html.j2 +1 -0
- litestar_vite/templates/angular/src/app/app.component.ts.j2 +9 -0
- litestar_vite/templates/angular/src/app/app.config.ts.j2 +5 -0
- litestar_vite/templates/angular/src/main.ts.j2 +9 -0
- litestar_vite/templates/angular/src/styles.css.j2 +9 -0
- litestar_vite/templates/angular/tsconfig.app.json.j2 +34 -0
- litestar_vite/templates/angular/tsconfig.json.j2 +20 -0
- litestar_vite/templates/angular/vite.config.ts.j2 +21 -0
- litestar_vite/templates/angular-cli/.postcssrc.json.j2 +5 -0
- litestar_vite/templates/angular-cli/angular.json.j2 +36 -0
- litestar_vite/templates/angular-cli/openapi-ts.config.ts.j2 +18 -0
- litestar_vite/templates/angular-cli/package.json.j2 +27 -0
- litestar_vite/templates/angular-cli/proxy.conf.json.j2 +18 -0
- litestar_vite/templates/angular-cli/src/app/app.component.css.j2 +3 -0
- litestar_vite/templates/angular-cli/src/app/app.component.html.j2 +1 -0
- litestar_vite/templates/angular-cli/src/app/app.component.ts.j2 +9 -0
- litestar_vite/templates/angular-cli/src/app/app.config.ts.j2 +5 -0
- litestar_vite/templates/angular-cli/src/index.html.j2 +13 -0
- litestar_vite/templates/angular-cli/src/main.ts.j2 +6 -0
- litestar_vite/templates/angular-cli/src/styles.css.j2 +10 -0
- litestar_vite/templates/angular-cli/tailwind.config.js.j2 +4 -0
- litestar_vite/templates/angular-cli/tsconfig.app.json.j2 +16 -0
- litestar_vite/templates/angular-cli/tsconfig.json.j2 +26 -0
- litestar_vite/templates/angular-cli/tsconfig.spec.json.j2 +9 -0
- litestar_vite/templates/astro/astro.config.mjs.j2 +28 -0
- litestar_vite/templates/astro/openapi-ts.config.ts.j2 +15 -0
- litestar_vite/templates/astro/src/layouts/Layout.astro.j2 +63 -0
- litestar_vite/templates/astro/src/pages/index.astro.j2 +36 -0
- litestar_vite/templates/astro/src/styles/global.css.j2 +1 -0
- litestar_vite/templates/base/.gitignore.j2 +42 -0
- litestar_vite/templates/base/openapi-ts.config.ts.j2 +15 -0
- litestar_vite/templates/base/package.json.j2 +38 -0
- litestar_vite/templates/base/resources/vite-env.d.ts.j2 +1 -0
- litestar_vite/templates/base/tsconfig.json.j2 +37 -0
- litestar_vite/templates/htmx/src/main.js.j2 +8 -0
- litestar_vite/templates/htmx/templates/base.html.j2.j2 +56 -0
- litestar_vite/templates/htmx/templates/index.html.j2.j2 +13 -0
- litestar_vite/templates/htmx/vite.config.ts.j2 +40 -0
- litestar_vite/templates/nuxt/app.vue.j2 +29 -0
- litestar_vite/templates/nuxt/composables/useApi.ts.j2 +33 -0
- litestar_vite/templates/nuxt/nuxt.config.ts.j2 +31 -0
- litestar_vite/templates/nuxt/openapi-ts.config.ts.j2 +15 -0
- litestar_vite/templates/nuxt/pages/index.vue.j2 +54 -0
- litestar_vite/templates/react/index.html.j2 +13 -0
- litestar_vite/templates/react/src/App.css.j2 +56 -0
- litestar_vite/templates/react/src/App.tsx.j2 +19 -0
- litestar_vite/templates/react/src/main.tsx.j2 +10 -0
- litestar_vite/templates/react/vite.config.ts.j2 +39 -0
- litestar_vite/templates/react-inertia/index.html.j2 +14 -0
- litestar_vite/templates/react-inertia/package.json.j2 +46 -0
- litestar_vite/templates/react-inertia/resources/App.css.j2 +68 -0
- litestar_vite/templates/react-inertia/resources/main.tsx.j2 +17 -0
- litestar_vite/templates/react-inertia/resources/pages/Home.tsx.j2 +18 -0
- litestar_vite/templates/react-inertia/resources/ssr.tsx.j2 +19 -0
- litestar_vite/templates/react-inertia/vite.config.ts.j2 +59 -0
- litestar_vite/templates/react-router/index.html.j2 +12 -0
- litestar_vite/templates/react-router/src/App.css.j2 +17 -0
- litestar_vite/templates/react-router/src/App.tsx.j2 +7 -0
- litestar_vite/templates/react-router/src/main.tsx.j2 +10 -0
- litestar_vite/templates/react-router/vite.config.ts.j2 +39 -0
- litestar_vite/templates/react-tanstack/index.html.j2 +12 -0
- litestar_vite/templates/react-tanstack/openapi-ts.config.ts.j2 +18 -0
- litestar_vite/templates/react-tanstack/src/App.css.j2 +17 -0
- litestar_vite/templates/react-tanstack/src/main.tsx.j2 +21 -0
- litestar_vite/templates/react-tanstack/src/routeTree.gen.ts.j2 +7 -0
- litestar_vite/templates/react-tanstack/src/routes/__root.tsx.j2 +9 -0
- litestar_vite/templates/react-tanstack/src/routes/books.tsx.j2 +9 -0
- litestar_vite/templates/react-tanstack/src/routes/index.tsx.j2 +9 -0
- litestar_vite/templates/react-tanstack/vite.config.ts.j2 +39 -0
- litestar_vite/templates/svelte/index.html.j2 +13 -0
- litestar_vite/templates/svelte/src/App.svelte.j2 +30 -0
- litestar_vite/templates/svelte/src/app.css.j2 +45 -0
- litestar_vite/templates/svelte/src/main.ts.j2 +8 -0
- litestar_vite/templates/svelte/src/vite-env.d.ts.j2 +2 -0
- litestar_vite/templates/svelte/svelte.config.js.j2 +5 -0
- litestar_vite/templates/svelte/vite.config.ts.j2 +39 -0
- litestar_vite/templates/svelte-inertia/index.html.j2 +14 -0
- litestar_vite/templates/svelte-inertia/resources/app.css.j2 +21 -0
- litestar_vite/templates/svelte-inertia/resources/main.ts.j2 +11 -0
- litestar_vite/templates/svelte-inertia/resources/pages/Home.svelte.j2 +43 -0
- litestar_vite/templates/svelte-inertia/resources/vite-env.d.ts.j2 +2 -0
- litestar_vite/templates/svelte-inertia/svelte.config.js.j2 +5 -0
- litestar_vite/templates/svelte-inertia/vite.config.ts.j2 +37 -0
- litestar_vite/templates/sveltekit/openapi-ts.config.ts.j2 +15 -0
- litestar_vite/templates/sveltekit/src/app.css.j2 +40 -0
- litestar_vite/templates/sveltekit/src/app.html.j2 +12 -0
- litestar_vite/templates/sveltekit/src/hooks.server.ts.j2 +55 -0
- litestar_vite/templates/sveltekit/src/routes/+layout.svelte.j2 +12 -0
- litestar_vite/templates/sveltekit/src/routes/+page.svelte.j2 +34 -0
- litestar_vite/templates/sveltekit/svelte.config.js.j2 +12 -0
- litestar_vite/templates/sveltekit/tsconfig.json.j2 +14 -0
- litestar_vite/templates/sveltekit/vite.config.ts.j2 +31 -0
- litestar_vite/templates/vue/env.d.ts.j2 +7 -0
- litestar_vite/templates/vue/index.html.j2 +13 -0
- litestar_vite/templates/vue/src/App.vue.j2 +28 -0
- litestar_vite/templates/vue/src/main.ts.j2 +5 -0
- litestar_vite/templates/vue/src/style.css.j2 +45 -0
- litestar_vite/templates/vue/vite.config.ts.j2 +39 -0
- litestar_vite/templates/vue-inertia/env.d.ts.j2 +7 -0
- litestar_vite/templates/vue-inertia/index.html.j2 +14 -0
- litestar_vite/templates/vue-inertia/package.json.j2 +49 -0
- litestar_vite/templates/vue-inertia/resources/main.ts.j2 +18 -0
- litestar_vite/templates/vue-inertia/resources/pages/Home.vue.j2 +22 -0
- litestar_vite/templates/vue-inertia/resources/ssr.ts.j2 +21 -0
- litestar_vite/templates/vue-inertia/resources/style.css.j2 +21 -0
- litestar_vite/templates/vue-inertia/vite.config.ts.j2 +59 -0
- litestar_vite-0.15.0rc2.dist-info/METADATA +230 -0
- litestar_vite-0.15.0rc2.dist-info/RECORD +151 -0
- {litestar_vite-0.1.1.dist-info → litestar_vite-0.15.0rc2.dist-info}/WHEEL +1 -1
- litestar_vite/template_engine.py +0 -103
- litestar_vite-0.1.1.dist-info/METADATA +0 -68
- litestar_vite-0.1.1.dist-info/RECORD +0 -11
- {litestar_vite-0.1.1.dist-info → litestar_vite-0.15.0rc2.dist-info}/licenses/LICENSE +0 -0
|
@@ -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,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{ project_name }}",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"ng": "ng",
|
|
8
|
+
"start": "ng serve --proxy-config proxy.conf.json",
|
|
9
|
+
"build": "ng build",
|
|
10
|
+
"serve": "npx serve dist/{{ project_name }}/browser",
|
|
11
|
+
"watch": "npm run serve"
|
|
12
|
+
},
|
|
13
|
+
"dependencies": {
|
|
14
|
+
{%- for dep in dependencies %}
|
|
15
|
+
"{{ dep }}": "latest"{% if not loop.last %},{% endif %}
|
|
16
|
+
{%- endfor %}
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
{%- for dep in dev_dependencies %}
|
|
20
|
+
"{{ dep }}": "latest",
|
|
21
|
+
{%- endfor %}
|
|
22
|
+
{%- if generate_client %}
|
|
23
|
+
"@hey-api/openapi-ts": "^0.88.0",
|
|
24
|
+
{%- endif %}
|
|
25
|
+
"@types/jasmine": "latest"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"/api": {
|
|
3
|
+
"target": "http://localhost:8000",
|
|
4
|
+
"secure": false,
|
|
5
|
+
"changeOrigin": true,
|
|
6
|
+
"ws": true
|
|
7
|
+
},
|
|
8
|
+
"/openapi.json": {
|
|
9
|
+
"target": "http://localhost:8000",
|
|
10
|
+
"secure": false,
|
|
11
|
+
"changeOrigin": true
|
|
12
|
+
},
|
|
13
|
+
"/static": {
|
|
14
|
+
"target": "http://localhost:8000",
|
|
15
|
+
"secure": false,
|
|
16
|
+
"changeOrigin": true
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<main></main>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>{{ project_name }}</title>
|
|
6
|
+
<base href="/" />
|
|
7
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
8
|
+
<link rel="icon" type="image/x-icon" href="favicon.ico" />
|
|
9
|
+
</head>
|
|
10
|
+
<body>
|
|
11
|
+
<app-root></app-root>
|
|
12
|
+
</body>
|
|
13
|
+
</html>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"outDir": "./dist/out-tsc/app",
|
|
5
|
+
"types": []
|
|
6
|
+
},
|
|
7
|
+
"files": ["src/main.ts"],
|
|
8
|
+
"include": ["src/**/*.ts"],
|
|
9
|
+
"exclude": ["src/**/*.spec.ts", "src/generated/**"],
|
|
10
|
+
"angularCompilerOptions": {
|
|
11
|
+
"enableI18nLegacyMessageIdFormat": false,
|
|
12
|
+
"strictInjectionParameters": true,
|
|
13
|
+
"strictInputAccessModifiers": true,
|
|
14
|
+
"strictTemplates": true
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compileOnSave": false,
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"baseUrl": "./",
|
|
5
|
+
"outDir": "./dist/out-tsc",
|
|
6
|
+
"sourceMap": true,
|
|
7
|
+
"declaration": false,
|
|
8
|
+
"downlevelIteration": true,
|
|
9
|
+
"experimentalDecorators": true,
|
|
10
|
+
"module": "ESNext",
|
|
11
|
+
"moduleResolution": "bundler",
|
|
12
|
+
"resolveJsonModule": true,
|
|
13
|
+
"allowSyntheticDefaultImports": true,
|
|
14
|
+
"target": "ES2022",
|
|
15
|
+
"useDefineForClassFields": false,
|
|
16
|
+
"lib": ["ES2022", "dom"],
|
|
17
|
+
"types": ["node"],
|
|
18
|
+
"forceConsistentCasingInFileNames": true,
|
|
19
|
+
"strict": true,
|
|
20
|
+
"noImplicitOverride": true,
|
|
21
|
+
"noPropertyAccessFromIndexSignature": true,
|
|
22
|
+
"noImplicitReturns": true,
|
|
23
|
+
"noFallthroughCasesInSwitch": true,
|
|
24
|
+
"skipLibCheck": true
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { defineConfig } from "astro/config";
|
|
2
|
+
import litestar from "litestar-vite-plugin/astro";
|
|
3
|
+
{% if use_tailwind %}
|
|
4
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
5
|
+
{% endif %}
|
|
6
|
+
|
|
7
|
+
// Litestar manages the dev server port via VITE_PORT and runtime config.
|
|
8
|
+
// The Astro integration reads the port automatically - no hardcoding needed.
|
|
9
|
+
// LITESTAR_PORT is the backend API server port (default {{ litestar_port }}).
|
|
10
|
+
const LITESTAR_PORT = process.env.LITESTAR_PORT ?? "{{ litestar_port }}";
|
|
11
|
+
|
|
12
|
+
export default defineConfig({
|
|
13
|
+
integrations: [
|
|
14
|
+
litestar({
|
|
15
|
+
// API proxy points to the Litestar backend
|
|
16
|
+
apiProxy: `http://localhost:${LITESTAR_PORT}`,
|
|
17
|
+
apiPrefix: "/api",
|
|
18
|
+
{% if enable_types %}
|
|
19
|
+
typesPath: "./{{ resource_dir }}/generated",
|
|
20
|
+
{% endif %}
|
|
21
|
+
}),
|
|
22
|
+
],
|
|
23
|
+
{% if use_tailwind %}
|
|
24
|
+
vite: {
|
|
25
|
+
plugins: [tailwindcss()],
|
|
26
|
+
},
|
|
27
|
+
{% endif %}
|
|
28
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
"@hey-api/sdk",
|
|
10
|
+
"@hey-api/client-fetch",
|
|
11
|
+
{%- if generate_zod %}
|
|
12
|
+
"zod",
|
|
13
|
+
{%- endif %}
|
|
14
|
+
],
|
|
15
|
+
});
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
interface Props {
|
|
3
|
+
title: string;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
const { title } = Astro.props;
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
<!DOCTYPE html>
|
|
10
|
+
<html lang="en">
|
|
11
|
+
<head>
|
|
12
|
+
<meta charset="UTF-8" />
|
|
13
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
14
|
+
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
|
15
|
+
<title>{title}</title>
|
|
16
|
+
</head>
|
|
17
|
+
<body>
|
|
18
|
+
<slot />
|
|
19
|
+
</body>
|
|
20
|
+
</html>
|
|
21
|
+
|
|
22
|
+
<style is:global>
|
|
23
|
+
:root {
|
|
24
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
25
|
+
line-height: 1.5;
|
|
26
|
+
font-weight: 400;
|
|
27
|
+
|
|
28
|
+
color-scheme: light dark;
|
|
29
|
+
color: rgba(255, 255, 255, 0.87);
|
|
30
|
+
background-color: #242424;
|
|
31
|
+
|
|
32
|
+
font-synthesis: none;
|
|
33
|
+
text-rendering: optimizeLegibility;
|
|
34
|
+
-webkit-font-smoothing: antialiased;
|
|
35
|
+
-moz-osx-font-smoothing: grayscale;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
button {
|
|
39
|
+
border-radius: 8px;
|
|
40
|
+
border: 1px solid transparent;
|
|
41
|
+
padding: 0.6em 1.2em;
|
|
42
|
+
font-size: 1em;
|
|
43
|
+
font-weight: 500;
|
|
44
|
+
font-family: inherit;
|
|
45
|
+
background-color: #1a1a1a;
|
|
46
|
+
cursor: pointer;
|
|
47
|
+
transition: border-color 0.25s;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
button:hover {
|
|
51
|
+
border-color: #ff5d01;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
@media (prefers-color-scheme: light) {
|
|
55
|
+
:root {
|
|
56
|
+
color: #213547;
|
|
57
|
+
background-color: #ffffff;
|
|
58
|
+
}
|
|
59
|
+
button {
|
|
60
|
+
background-color: #f9f9f9;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</style>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Layout from "../layouts/Layout.astro";
|
|
3
|
+
---
|
|
4
|
+
|
|
5
|
+
<Layout title="{{ project_name }}">
|
|
6
|
+
<main class="app">
|
|
7
|
+
<h1>{{ project_name }}</h1>
|
|
8
|
+
<p>Astro + Litestar</p>
|
|
9
|
+
<div class="card">
|
|
10
|
+
<button id="counter">count is 0</button>
|
|
11
|
+
</div>
|
|
12
|
+
</main>
|
|
13
|
+
</Layout>
|
|
14
|
+
|
|
15
|
+
<script>
|
|
16
|
+
const button = document.getElementById("counter");
|
|
17
|
+
let count = 0;
|
|
18
|
+
|
|
19
|
+
button?.addEventListener("click", () => {
|
|
20
|
+
count += 1;
|
|
21
|
+
button.textContent = `count is ${count}`;
|
|
22
|
+
});
|
|
23
|
+
</script>
|
|
24
|
+
|
|
25
|
+
<style>
|
|
26
|
+
.app {
|
|
27
|
+
max-width: 1280px;
|
|
28
|
+
margin: 0 auto;
|
|
29
|
+
padding: 2rem;
|
|
30
|
+
text-align: center;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.card {
|
|
34
|
+
padding: 2em;
|
|
35
|
+
}
|
|
36
|
+
</style>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* Global styles are included in Layout.astro */
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# Dependencies
|
|
2
|
+
node_modules/
|
|
3
|
+
|
|
4
|
+
# Build output
|
|
5
|
+
{{ bundle_dir }}/
|
|
6
|
+
dist/
|
|
7
|
+
|
|
8
|
+
# Vite
|
|
9
|
+
*.local
|
|
10
|
+
.vite/
|
|
11
|
+
|
|
12
|
+
# TypeScript
|
|
13
|
+
*.tsbuildinfo
|
|
14
|
+
|
|
15
|
+
# Generated types
|
|
16
|
+
{{ resource_dir }}/generated/
|
|
17
|
+
|
|
18
|
+
# IDE
|
|
19
|
+
.idea/
|
|
20
|
+
.vscode/
|
|
21
|
+
*.swp
|
|
22
|
+
*.swo
|
|
23
|
+
|
|
24
|
+
# OS
|
|
25
|
+
.DS_Store
|
|
26
|
+
Thumbs.db
|
|
27
|
+
|
|
28
|
+
# Logs
|
|
29
|
+
logs/
|
|
30
|
+
*.log
|
|
31
|
+
npm-debug.log*
|
|
32
|
+
|
|
33
|
+
# Environment
|
|
34
|
+
.env
|
|
35
|
+
.env.local
|
|
36
|
+
.env.*.local
|
|
37
|
+
|
|
38
|
+
# Python
|
|
39
|
+
__pycache__/
|
|
40
|
+
*.py[cod]
|
|
41
|
+
.venv/
|
|
42
|
+
venv/
|
|
@@ -0,0 +1,15 @@
|
|
|
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
|
+
"@hey-api/sdk",
|
|
10
|
+
"@hey-api/client-axios",
|
|
11
|
+
{%- if generate_zod %}
|
|
12
|
+
"zod",
|
|
13
|
+
{%- endif %}
|
|
14
|
+
],
|
|
15
|
+
});
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "{{ project_name }}",
|
|
3
|
+
"private": true,
|
|
4
|
+
"type": "module",
|
|
5
|
+
"scripts": {
|
|
6
|
+
"dev": "vite",
|
|
7
|
+
"build": "vite build{% if use_typescript %} && {% if framework in ['vue', 'vue-inertia'] %}vue-tsc -b --noEmit{% else %}tsc -b --noEmit{% endif %}{% endif %}",
|
|
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 or generate_client %},{% endif %}
|
|
16
|
+
{%- endfor %}
|
|
17
|
+
{%- if generate_client %}
|
|
18
|
+
"axios": "^1.13.2"{% if generate_zod %},{% endif %}
|
|
19
|
+
{%- endif %}
|
|
20
|
+
{%- if generate_zod %}
|
|
21
|
+
"zod": "^4.1.13"
|
|
22
|
+
{%- endif %}
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
{%- for dep in dev_dependencies %}
|
|
26
|
+
"{{ dep }}": "latest",
|
|
27
|
+
{%- endfor %}
|
|
28
|
+
{%- if use_tailwind %}
|
|
29
|
+
"@tailwindcss/vite": "^4.1.17",
|
|
30
|
+
"tailwindcss": "^4.1.17",
|
|
31
|
+
{%- endif %}
|
|
32
|
+
{%- if generate_client %}
|
|
33
|
+
"@hey-api/openapi-ts": "^0.88.0",
|
|
34
|
+
{%- endif %}
|
|
35
|
+
"litestar-vite-plugin": "latest",
|
|
36
|
+
"vite": "^7.2.6"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2022",
|
|
4
|
+
"useDefineForClassFields": true,
|
|
5
|
+
"module": "ESNext",
|
|
6
|
+
"lib": ["ES2022", "DOM", "DOM.Iterable"],
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
|
|
9
|
+
/* Bundler mode */
|
|
10
|
+
"moduleResolution": "bundler",
|
|
11
|
+
"allowImportingTsExtensions": true,
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"moduleDetection": "force",
|
|
14
|
+
"noEmit": true,
|
|
15
|
+
{% if framework in ["react", "react-inertia", "react-router", "react-tanstack"] %}
|
|
16
|
+
"jsx": "react-jsx",
|
|
17
|
+
"types": ["vite/client"],
|
|
18
|
+
{% elif framework == "vue" or framework == "vue-inertia" %}
|
|
19
|
+
"jsx": "preserve",
|
|
20
|
+
{% endif %}
|
|
21
|
+
|
|
22
|
+
/* Linting */
|
|
23
|
+
"strict": true,
|
|
24
|
+
"noUnusedLocals": true,
|
|
25
|
+
"noUnusedParameters": true,
|
|
26
|
+
"noFallthroughCasesInSwitch": true,
|
|
27
|
+
"noUncheckedSideEffectImports": true,
|
|
28
|
+
|
|
29
|
+
/* Paths */
|
|
30
|
+
"baseUrl": ".",
|
|
31
|
+
"paths": {
|
|
32
|
+
"@/*": ["./{{ resource_dir }}/*"]
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"include": ["{{ resource_dir }}/**/*", "vite.config.ts"{% if framework == "vue" or framework == "vue-inertia" %}, "env.d.ts"{% endif %}],
|
|
36
|
+
"exclude": ["{{ resource_dir }}/generated/**"]
|
|
37
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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>{% raw %}{% block title %}{% endraw %}{{ "{{ project_name }}" }}{% raw %}{% endblock %}{% endraw %}</title>
|
|
7
|
+
{{ "{{ vite_hmr() }}" }}
|
|
8
|
+
{{ "{{ vite('resources/main.js') }}" }}
|
|
9
|
+
<style>
|
|
10
|
+
:root {
|
|
11
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
12
|
+
line-height: 1.5;
|
|
13
|
+
font-weight: 400;
|
|
14
|
+
color-scheme: light dark;
|
|
15
|
+
color: rgba(255, 255, 255, 0.87);
|
|
16
|
+
background-color: #242424;
|
|
17
|
+
}
|
|
18
|
+
.app {
|
|
19
|
+
max-width: 1280px;
|
|
20
|
+
margin: 0 auto;
|
|
21
|
+
padding: 2rem;
|
|
22
|
+
text-align: center;
|
|
23
|
+
}
|
|
24
|
+
.card {
|
|
25
|
+
padding: 2em;
|
|
26
|
+
}
|
|
27
|
+
button {
|
|
28
|
+
border-radius: 8px;
|
|
29
|
+
border: 1px solid transparent;
|
|
30
|
+
padding: 0.6em 1.2em;
|
|
31
|
+
font-size: 1em;
|
|
32
|
+
font-weight: 500;
|
|
33
|
+
font-family: inherit;
|
|
34
|
+
background-color: #1a1a1a;
|
|
35
|
+
color: inherit;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
transition: border-color 0.25s;
|
|
38
|
+
}
|
|
39
|
+
button:hover {
|
|
40
|
+
border-color: #3d72b4;
|
|
41
|
+
}
|
|
42
|
+
@media (prefers-color-scheme: light) {
|
|
43
|
+
:root {
|
|
44
|
+
color: #213547;
|
|
45
|
+
background-color: #ffffff;
|
|
46
|
+
}
|
|
47
|
+
button {
|
|
48
|
+
background-color: #f9f9f9;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
</style>
|
|
52
|
+
</head>
|
|
53
|
+
<body>
|
|
54
|
+
{% raw %}{% block content %}{% endraw %}{% raw %}{% endblock %}{% endraw %}
|
|
55
|
+
</body>
|
|
56
|
+
</html>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{% raw %}{% extends "base.html.j2" %}{% endraw %}
|
|
2
|
+
|
|
3
|
+
{% raw %}{% block content %}{% endraw %}
|
|
4
|
+
<main class="app">
|
|
5
|
+
<h1>{{ "{{ project_name }}" }}</h1>
|
|
6
|
+
<div class="card">
|
|
7
|
+
<button hx-get="/api/hello" hx-target="#greeting" hx-swap="innerHTML">
|
|
8
|
+
Load Greeting from API
|
|
9
|
+
</button>
|
|
10
|
+
<p id="greeting"></p>
|
|
11
|
+
</div>
|
|
12
|
+
</main>
|
|
13
|
+
{% raw %}{% endblock %}{% endraw %}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { defineConfig } from "vite";
|
|
2
|
+
import litestar from "litestar-vite-plugin";
|
|
3
|
+
{% if use_tailwind %}
|
|
4
|
+
import tailwindcss from "@tailwindcss/vite";
|
|
5
|
+
{% endif %}
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
server: {
|
|
9
|
+
host: "0.0.0.0",
|
|
10
|
+
port: Number(process.env.VITE_PORT || "{{ vite_port }}"),
|
|
11
|
+
cors: true,
|
|
12
|
+
hmr: {
|
|
13
|
+
host: "localhost",
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
plugins: [
|
|
17
|
+
{% if use_tailwind %}
|
|
18
|
+
tailwindcss(),
|
|
19
|
+
{% endif %}
|
|
20
|
+
litestar({
|
|
21
|
+
input: ["{{ resource_dir }}/main.js"],
|
|
22
|
+
}),
|
|
23
|
+
],
|
|
24
|
+
build: {
|
|
25
|
+
rollupOptions: {
|
|
26
|
+
onwarn(warning, warn) {
|
|
27
|
+
// Suppress eval warnings from htmx (htmx uses eval for dynamic attribute evaluation)
|
|
28
|
+
if (warning.code === "EVAL" && warning.id?.includes("htmx")) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
warn(warning);
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
resolve: {
|
|
36
|
+
alias: {
|
|
37
|
+
"@": "/{{ resource_dir }}",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<NuxtLayout>
|
|
3
|
+
<NuxtPage />
|
|
4
|
+
</NuxtLayout>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<style>
|
|
8
|
+
:root {
|
|
9
|
+
font-family: Inter, system-ui, Avenir, Helvetica, Arial, sans-serif;
|
|
10
|
+
line-height: 1.5;
|
|
11
|
+
font-weight: 400;
|
|
12
|
+
|
|
13
|
+
color-scheme: light dark;
|
|
14
|
+
color: rgba(255, 255, 255, 0.87);
|
|
15
|
+
background-color: #242424;
|
|
16
|
+
|
|
17
|
+
font-synthesis: none;
|
|
18
|
+
text-rendering: optimizeLegibility;
|
|
19
|
+
-webkit-font-smoothing: antialiased;
|
|
20
|
+
-moz-osx-font-smoothing: grayscale;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@media (prefers-color-scheme: light) {
|
|
24
|
+
:root {
|
|
25
|
+
color: #213547;
|
|
26
|
+
background-color: #ffffff;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
</style>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composable for making API requests to the Litestar backend.
|
|
3
|
+
* In development, requests are proxied through the Nuxt dev server.
|
|
4
|
+
* In production, requests go directly to the API server.
|
|
5
|
+
*/
|
|
6
|
+
export function useApi() {
|
|
7
|
+
const config = useRuntimeConfig();
|
|
8
|
+
|
|
9
|
+
const apiBase = process.client
|
|
10
|
+
? "/api" // In browser, use proxy
|
|
11
|
+
: (config.public.apiBase as string) || "http://localhost:{{ litestar_port }}/api";
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
/**
|
|
15
|
+
* Make a GET request to the API.
|
|
16
|
+
*/
|
|
17
|
+
async get<T>(path: string): Promise<T> {
|
|
18
|
+
const { data } = await useFetch<T>(`${apiBase}${path}`);
|
|
19
|
+
return data.value as T;
|
|
20
|
+
},
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Make a POST request to the API.
|
|
24
|
+
*/
|
|
25
|
+
async post<T>(path: string, body: unknown): Promise<T> {
|
|
26
|
+
const { data } = await useFetch<T>(`${apiBase}${path}`, {
|
|
27
|
+
method: "POST",
|
|
28
|
+
body,
|
|
29
|
+
});
|
|
30
|
+
return data.value as T;
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
}
|