Fix Svelte 5 deprecation: Replace <slot /> with {@render children()}

This commit is contained in:
chaos
2026-03-17 00:15:55 +08:00
parent 8a055daf5e
commit 52b4f43f45
3 changed files with 22 additions and 14 deletions

View File

@@ -1,14 +1,16 @@
# Build stage # Build stage
FROM node:20-slim AS builder FROM node:20 AS builder
WORKDIR /app WORKDIR /app
# Install build dependencies for better-sqlite3 # Use a faster npm registry mirror
RUN apt-get update && apt-get install -y python3 make g++ RUN npm config set registry https://registry.npmmirror.com
# Copy package files first for better caching
COPY package*.json ./ COPY package*.json ./
RUN npm install RUN npm install
# Copy the rest of the code and build
COPY . . COPY . .
RUN npm run build RUN npm run build
@@ -17,24 +19,29 @@ FROM node:20-slim
WORKDIR /app WORKDIR /app
# Install production dependencies only # Use a faster npm registry mirror
RUN npm config set registry https://registry.npmmirror.com
# Install only production dependencies
# Copy package files again for production layer caching
COPY package*.json ./ COPY package*.json ./
# Install build tools temporarily for native modules if needed,
# though many have pre-built binaries on standard Node images
RUN apt-get update && apt-get install -y python3 make g++ \ RUN apt-get update && apt-get install -y python3 make g++ \
&& npm install --omit=dev \ && npm install --omit=dev \
&& apt-get purge -y python3 make g++ \ && apt-get purge -y python3 make g++ \
&& apt-get autoremove -y \ && apt-get autoremove -y \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
# Copy built app and static files from builder
COPY --from=builder /app/build ./build COPY --from=builder /app/build ./build
COPY --from=builder /app/static ./static COPY --from=builder /app/static ./static
# Ensure the database file isn't baked in unless desired, # App configuration
# but adapter-node needs the build folder.
# The app will create data.db in /app/ at runtime.
ENV PORT=1995 ENV PORT=1995
ENV NODE_ENV=production ENV NODE_ENV=production
EXPOSE 1995 EXPOSE 1995
# The database data.db will be created at /app/data.db or mounted via volume
CMD ["node", "build"] CMD ["node", "build"]

View File

@@ -18,19 +18,19 @@
"@tailwindcss/postcss": "^4.2.1", "@tailwindcss/postcss": "^4.2.1",
"@types/node": "^25.5.0", "@types/node": "^25.5.0",
"autoprefixer": "^10.4.27", "autoprefixer": "^10.4.27",
"bcryptjs": "^3.0.3",
"better-sqlite3": "^12.8.0",
"clsx": "^2.1.1",
"lucide-svelte": "^0.577.0",
"postcss": "^8.5.8", "postcss": "^8.5.8",
"svelte": "^5.51.0", "svelte": "^5.51.0",
"svelte-check": "^4.4.2", "svelte-check": "^4.4.2",
"tailwind-merge": "^3.5.0",
"tailwindcss": "^4.2.1", "tailwindcss": "^4.2.1",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"vite": "^7.3.1" "vite": "^7.3.1"
}, },
"dependencies": { "dependencies": {
"bcryptjs": "^3.0.3",
"better-sqlite3": "^12.8.0",
"clsx": "^2.1.1",
"lucide-svelte": "^0.577.0",
"tailwind-merge": "^3.5.0",
"xlsx": "^0.18.5" "xlsx": "^0.18.5"
} }
} }

View File

@@ -1,5 +1,6 @@
<script> <script>
import "../app.css"; import "../app.css";
let { children } = $props();
</script> </script>
<slot /> {@render children()}