@smi-digital/create-smi-app 2.4.5 → 2.5.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/index.js CHANGED
@@ -604,7 +604,7 @@ async function createIntegrations(options, projectRoot, templatesDir) {
604
604
  const astroConfigPath = join5(frontendDir, "astro.config.mjs");
605
605
  let astroConfig = await readFile4(astroConfigPath, "utf8");
606
606
  astroConfig = astroConfig.replace(
607
- "export default defineConfig({",
607
+ /export default defineConfig\s*\(\s*\{/v,
608
608
  "export default defineConfig({\n output: 'server',"
609
609
  );
610
610
  await writeFile3(astroConfigPath, astroConfig);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smi-digital/create-smi-app",
3
- "version": "2.4.5",
3
+ "version": "2.5.0",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
@@ -39,13 +39,24 @@ services:
39
39
  depends_on:
40
40
  __APP_NAME__-strapi:
41
41
  condition: service_healthy
42
+
43
+ __APP_NAME__-cache:
44
+ container_name: __APP_NAME__-cache
45
+ image: nginx:alpine
46
+ restart: unless-stopped
47
+ volumes:
48
+ - ./frontend/nginx-cache.conf:/etc/nginx/conf.d/default.conf:ro
49
+ networks:
50
+ - agency_shared_network
51
+ depends_on:
52
+ - __APP_NAME__-astro
42
53
  labels:
43
54
  - "traefik.enable=true"
44
- # Listen on both www and non-www (If include_www is selected during setup, you can manually adjust this)
55
+ # Listen on both www and non-www
45
56
  - "traefik.http.routers.__APP_NAME__-astro.rule=Host(`__PROJECT_DOMAIN__`) || Host(`www.__PROJECT_DOMAIN__`)"
46
57
  - "traefik.http.routers.__APP_NAME__-astro.tls.certresolver=letsencrypt"
47
- # Port 4321 for Bun/SSR, Port 80 if pure SSG Nginx container
48
- - "traefik.http.services.__APP_NAME__-astro.loadbalancer.server.port=__ASTRO_PORT__"
58
+ # Route traffic to the Nginx Cache (Port 80) instead of Astro directly
59
+ - "traefik.http.services.__APP_NAME__-astro.loadbalancer.server.port=80"
49
60
 
50
61
  networks:
51
62
  agency_shared_network:
@@ -66,6 +66,10 @@
66
66
  "template": "Dockerfile.frontend.ssr.template",
67
67
  "target": "frontend/Dockerfile"
68
68
  },
69
+ {
70
+ "template": "nginx-cache.conf.template",
71
+ "target": "frontend/nginx-cache.conf"
72
+ },
69
73
  {
70
74
  "template": "frontend/src/middleware.ts.template",
71
75
  "target": "frontend/src/middleware.ts"
@@ -0,0 +1,29 @@
1
+ proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=astro_cache:10m max_size=1g inactive=60m use_temp_path=off;
2
+
3
+ server {
4
+ listen 80;
5
+
6
+ # Gzip compression for faster transfers
7
+ gzip on;
8
+ gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;
9
+
10
+ location / {
11
+ proxy_cache astro_cache;
12
+
13
+ # Respect the Stale-While-Revalidate headers from Astro middleware
14
+ proxy_cache_use_stale error timeout updating http_500 http_502 http_503 http_504;
15
+ proxy_cache_background_update on;
16
+ proxy_cache_lock on;
17
+
18
+ # Proxy to the Astro SSR container (internal Docker DNS)
19
+ proxy_pass http://__APP_NAME__-astro:4321;
20
+
21
+ proxy_set_header Host $host;
22
+ proxy_set_header X-Real-IP $remote_addr;
23
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
24
+ proxy_set_header X-Forwarded-Proto $scheme;
25
+
26
+ # Add a header so we can verify if the cache is working
27
+ add_header X-Cache-Status $upstream_cache_status;
28
+ }
29
+ }