@django-stack/cli 0.5.0 → 0.6.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.
- package/dist/bin.js +1799 -559
- package/dist/index.d.ts +3 -1
- package/dist/index.js +1 -1
- package/dist/{scaffold-DbgGYEsc.js → production-DIj9yRcg.js} +93 -66
- package/package.json +1 -1
- package/templates/backend/config/studio.py +9 -0
- package/templates/backend/content/admin.py +16 -2
- package/templates/backend/entrypoint.sh +5 -1
- package/templates/backend/pyproject.toml +2 -2
- package/templates/base/AGENTS.md +2 -1
- package/templates/base/Caddyfile +14 -1
- package/templates/base/README.md +9 -0
- package/templates/base/compose.yaml +39 -1
- package/templates/base/env.example +15 -1
- package/templates/frontend-astro/astro.config.mjs +13 -6
- package/templates/frontend-astro/package.json +1 -1
- package/templates/frontend-astro/src/layouts/Base.astro +3 -0
- package/templates/frontend-next/package.json +3 -3
- package/templates/frontend-next/src/app/layout.tsx +9 -0
- package/templates/frontend-next/src/proxy.ts +6 -0
- package/templates/frontend-nuxt/nuxt.config.ts +12 -6
- package/templates/frontend-nuxt/package.json +2 -2
- package/templates/frontend-nuxt/server/routes/_content/layout.get.ts +6 -1
- package/templates/frontend-nuxt/src/layouts/default.vue +3 -0
- package/templates/frontend-sveltekit/package.json +2 -2
- package/templates/frontend-sveltekit/src/routes/+layout.server.ts +2 -0
- package/templates/frontend-sveltekit/src/routes/+layout.svelte +3 -0
- package/templates/frontend-sveltekit/vite.config.ts +11 -3
|
@@ -9,5 +9,10 @@ export default defineEventHandler(async (event) => {
|
|
|
9
9
|
]);
|
|
10
10
|
return { settings, mainMenu, footerMenu, siteUrl: SITE_URL };
|
|
11
11
|
});
|
|
12
|
-
return {
|
|
12
|
+
return {
|
|
13
|
+
...data,
|
|
14
|
+
preview: previewToken(event) !== null,
|
|
15
|
+
// Page analytics: Umami's tracker, served from this site at /_a/.
|
|
16
|
+
analytics: process.env.UMAMI_WEBSITE_ID || null,
|
|
17
|
+
};
|
|
13
18
|
});
|
|
@@ -10,6 +10,9 @@ useHead(() => ({
|
|
|
10
10
|
link: [
|
|
11
11
|
{ rel: "alternate", type: "application/rss+xml", title: data.value?.settings?.site_name ?? "RSS", href: "/rss.xml" },
|
|
12
12
|
],
|
|
13
|
+
script: data.value?.analytics
|
|
14
|
+
? [{ src: "/_a/script.js", defer: true, "data-website-id": data.value.analytics }]
|
|
15
|
+
: [],
|
|
13
16
|
}));
|
|
14
17
|
</script>
|
|
15
18
|
|
|
@@ -19,8 +19,8 @@
|
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"@django-headless/client": "^1.1.1",
|
|
22
|
-
"@django-stack/svelte": "^0.
|
|
23
|
-
"@django-stack/utils": "^0.
|
|
22
|
+
"@django-stack/svelte": "^0.6.0",
|
|
23
|
+
"@django-stack/utils": "^0.6.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
26
|
"@sveltejs/adapter-node": "^6.0.1",
|
|
@@ -14,5 +14,7 @@ export const load: LayoutServerLoad = async ({ cookies }) => {
|
|
|
14
14
|
footerMenu,
|
|
15
15
|
preview: cookies.get(PREVIEW_COOKIE) !== undefined,
|
|
16
16
|
siteUrl: SITE_URL,
|
|
17
|
+
// Page analytics: Umami's tracker, served from this site at /_a/.
|
|
18
|
+
analytics: process.env.UMAMI_WEBSITE_ID || null,
|
|
17
19
|
};
|
|
18
20
|
};
|
|
@@ -13,6 +13,9 @@
|
|
|
13
13
|
|
|
14
14
|
<svelte:head>
|
|
15
15
|
<link rel="alternate" type="application/rss+xml" title={data.settings?.site_name ?? "RSS"} href="/rss.xml" />
|
|
16
|
+
{#if data.analytics}
|
|
17
|
+
<script defer src="/_a/script.js" data-website-id={data.analytics}></script>
|
|
18
|
+
{/if}
|
|
16
19
|
</svelte:head>
|
|
17
20
|
|
|
18
21
|
<Seo
|
|
@@ -4,6 +4,8 @@ import { defineConfig } from "vitest/config";
|
|
|
4
4
|
|
|
5
5
|
// The Django backend: the frontend container reaches it on the Compose network.
|
|
6
6
|
const backend = process.env.BACKEND_INTERNAL_URL ?? "http://localhost:8000";
|
|
7
|
+
// Umami, for page analytics: only its tracker and page views, under /_a/.
|
|
8
|
+
const umami = process.env.UMAMI_URL || "http://umami:3000";
|
|
7
9
|
|
|
8
10
|
export default defineConfig({
|
|
9
11
|
plugins: [
|
|
@@ -37,9 +39,15 @@ export default defineConfig({
|
|
|
37
39
|
allowedHosts: ["frontend"],
|
|
38
40
|
// In development, serve Django's paths from the same origin as the site,
|
|
39
41
|
// like the reverse proxy does in production.
|
|
40
|
-
proxy:
|
|
41
|
-
|
|
42
|
-
|
|
42
|
+
proxy: {
|
|
43
|
+
...Object.fromEntries(
|
|
44
|
+
["/admin", "/api", "/media", "/static"].map((path) => [
|
|
45
|
+
path,
|
|
46
|
+
{ target: backend, changeOrigin: false },
|
|
47
|
+
]),
|
|
48
|
+
),
|
|
49
|
+
"^/_a/(script\\.js|api/send)$": { target: umami, rewrite: (path) => path.slice("/_a".length) },
|
|
50
|
+
},
|
|
43
51
|
},
|
|
44
52
|
test: {
|
|
45
53
|
include: ["test/**/*.test.ts"],
|