From 52b4f43f4541129dc3087f32849ac29f13f73d4d Mon Sep 17 00:00:00 2001 From: chaos Date: Tue, 17 Mar 2026 00:15:55 +0800 Subject: [PATCH] Fix Svelte 5 deprecation: Replace with {@render children()} --- Dockerfile | 23 +++++++++++++++-------- package.json | 10 +++++----- src/routes/+layout.svelte | 3 ++- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/Dockerfile b/Dockerfile index 0e4b9f1..ceab4dc 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,14 +1,16 @@ # Build stage -FROM node:20-slim AS builder +FROM node:20 AS builder WORKDIR /app -# Install build dependencies for better-sqlite3 -RUN apt-get update && apt-get install -y python3 make g++ +# Use a faster npm registry mirror +RUN npm config set registry https://registry.npmmirror.com +# Copy package files first for better caching COPY package*.json ./ RUN npm install +# Copy the rest of the code and build COPY . . RUN npm run build @@ -17,24 +19,29 @@ FROM node:20-slim 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 ./ +# 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++ \ && npm install --omit=dev \ && apt-get purge -y python3 make g++ \ && apt-get autoremove -y \ && rm -rf /var/lib/apt/lists/* +# Copy built app and static files from builder COPY --from=builder /app/build ./build COPY --from=builder /app/static ./static -# Ensure the database file isn't baked in unless desired, -# but adapter-node needs the build folder. -# The app will create data.db in /app/ at runtime. - +# App configuration ENV PORT=1995 ENV NODE_ENV=production EXPOSE 1995 +# The database data.db will be created at /app/data.db or mounted via volume CMD ["node", "build"] diff --git a/package.json b/package.json index 0ddbced..c018506 100644 --- a/package.json +++ b/package.json @@ -18,19 +18,19 @@ "@tailwindcss/postcss": "^4.2.1", "@types/node": "^25.5.0", "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", "svelte": "^5.51.0", "svelte-check": "^4.4.2", - "tailwind-merge": "^3.5.0", "tailwindcss": "^4.2.1", "typescript": "^5.9.3", "vite": "^7.3.1" }, "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" } } diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 1fe2550..72481dc 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,5 +1,6 @@ - +{@render children()}