@django-stack/cli 0.9.0 → 0.10.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 +28 -3
- package/dist/index.d.ts +13 -5
- package/dist/index.js +1 -1
- package/dist/{production-M2SsuuBb.js → production-Ct_qoeXk.js} +154 -9
- package/package.json +1 -1
- package/templates/backend/config/settings.py +1 -0
- package/templates/backend/content/models.py +2 -2
- package/templates/backend/content/tests/test_api.py +15 -3
- package/templates/backend/pyproject.toml +1 -1
- package/templates/base/AGENTS.md +8 -8
- package/templates/base/README.md +3 -3
- package/templates/base/compose.yaml +7 -0
- package/templates/base/env.example +12 -0
- package/templates/frontend-astro/AGENTS.md +3 -3
- package/templates/frontend-astro/Dockerfile +6 -3
- package/templates/frontend-astro/astro.config.mjs +16 -5
- package/templates/frontend-astro/package.json +1 -1
- package/templates/frontend-astro/pnpm-workspace.yaml +17 -0
- package/templates/frontend-astro/src/components/ContactForm.astro +19 -3
- package/templates/frontend-astro/src/middleware.ts +9 -1
- package/templates/frontend-next/AGENTS.md +3 -3
- package/templates/frontend-next/Dockerfile +5 -2
- package/templates/frontend-next/package.json +3 -3
- package/templates/frontend-next/pnpm-workspace.yaml +11 -0
- package/templates/frontend-next/src/app/[...path]/page.tsx +2 -1
- package/templates/frontend-next/src/components/ContactForm.tsx +14 -3
- package/templates/frontend-next/src/instrumentation.ts +12 -0
- package/templates/frontend-next/src/proxy.ts +4 -1
- package/templates/frontend-nuxt/AGENTS.md +3 -3
- package/templates/frontend-nuxt/Dockerfile +5 -2
- package/templates/frontend-nuxt/nuxt.config.ts +7 -3
- package/templates/frontend-nuxt/package.json +2 -2
- package/templates/frontend-nuxt/pnpm-workspace.yaml +13 -0
- package/templates/frontend-nuxt/server/plugins/errors.ts +14 -0
- package/templates/frontend-nuxt/server/routes/_content/layout.get.ts +4 -0
- package/templates/frontend-nuxt/src/components/ContactForm.vue +15 -2
- package/templates/frontend-sveltekit/AGENTS.md +3 -3
- package/templates/frontend-sveltekit/Dockerfile +6 -3
- package/templates/frontend-sveltekit/package.json +2 -2
- package/templates/frontend-sveltekit/pnpm-workspace.yaml +11 -0
- package/templates/frontend-sveltekit/src/hooks.server.ts +13 -1
- package/templates/frontend-sveltekit/src/lib/components/ContactForm.svelte +15 -2
- package/templates/frontend-sveltekit/src/routes/+layout.server.ts +3 -0
- package/templates/frontend-sveltekit/src/routes/[...path]/+page.svelte +1 -1
- package/templates/frontend-sveltekit/vite.config.ts +10 -3
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { CAPTCHA_CSP } from "@django-stack/utils";
|
|
1
2
|
import adapter from "@sveltejs/adapter-node";
|
|
2
3
|
import { sveltekit } from "@sveltejs/kit/vite";
|
|
3
4
|
import { defineConfig } from "vitest/config";
|
|
@@ -7,6 +8,10 @@ const backend = process.env.BACKEND_INTERNAL_URL ?? "http://localhost:8000";
|
|
|
7
8
|
// Umami, for page analytics: only its tracker and page views, under /_a/.
|
|
8
9
|
const umami = process.env.UMAMI_URL || "http://umami:3000";
|
|
9
10
|
|
|
11
|
+
// SvelteKit takes keyword sources without quotes, such as self.
|
|
12
|
+
const unquoted = (sources: readonly string[]) =>
|
|
13
|
+
sources.map((source) => source.replaceAll("'", "")) as never[];
|
|
14
|
+
|
|
10
15
|
export default defineConfig({
|
|
11
16
|
plugins: [
|
|
12
17
|
sveltekit({
|
|
@@ -15,13 +20,15 @@ export default defineConfig({
|
|
|
15
20
|
// A Content-Security-Policy on every page: scripts and styles only from
|
|
16
21
|
// this site, with hashes for the ones SvelteKit inlines (hashes, not
|
|
17
22
|
// nonces, so cached pages stay valid). src/hooks.server.ts adds the
|
|
18
|
-
// origin of the media files.
|
|
23
|
+
// origin of the media files. CAPTCHA_CSP allows the captcha widget of
|
|
24
|
+
// the contact form: its solver, its style and its workers.
|
|
19
25
|
csp: {
|
|
20
26
|
mode: "hash",
|
|
21
27
|
directives: {
|
|
22
28
|
"default-src": ["self"],
|
|
23
|
-
"script-src": ["self"],
|
|
24
|
-
"style-src": ["self"],
|
|
29
|
+
"script-src": ["self", ...unquoted(CAPTCHA_CSP["script-src"])],
|
|
30
|
+
"style-src": ["self", ...unquoted(CAPTCHA_CSP["style-src"])],
|
|
31
|
+
"worker-src": unquoted(CAPTCHA_CSP["worker-src"]),
|
|
25
32
|
// Inline style attributes, such as the focal point of an image.
|
|
26
33
|
"style-src-attr": ["unsafe-inline"],
|
|
27
34
|
"base-uri": ["self"],
|