16 Commits
Author SHA1 Message Date
hh 0fadb740fb fix: format a fresh copy with its own linter, generated names can exceed the line width 2026-10-10 22:40:54 +00:00
hh 6c9d5063b9 feat!: sveltekit 3 with the official bun adapter, config lives in vite.config; biome unpinned at 2.5.15, anchor content check off for svelte; bun image pinned to the 1 tag 2026-10-10 22:39:07 +00:00
hh 5cee5f99e9 refactor: drop make deploy and its refs/deploy stamps, the fleet deploys from infra/komodo; short readme 2026-10-08 21:34:41 +02:00
hh 5e449a560b fix(docker): bun cache stays out of the runtime image, env= on a cache mount sets nothing 2026-10-08 20:43:15 +02:00
hh ab67b5a5da docs(readme): production in the fleet deploys from infra/komodo, make deploy stays for a checkout deployed by hand 2026-10-08 04:40:25 +00:00
hh c93a8fc68d fix(frontend): .env reaches the build for $env/static, the runtime image stays without it; eslint + prettier as an alternative to biome; image named with dashes 2026-10-08 04:37:20 +00:00
hh 180f16defd revert(update): bun install only on copy, a task in update merges two lockfiles into conflicts 2026-10-01 02:03:58 +02:00
hh 556f87ef60 fix(update): bun install after an update too, so bun.lock follows package.json 2026-10-01 02:03:21 +02:00
hh 7ca0813567 chore(deps): biome 2.5.13, ultracite 7.12, package.json in sorted order 2026-10-01 02:02:05 +02:00
hh 73132fc2d0 feat(compose): commented port publishing with a random host port from make env 2026-10-01 02:02:05 +02:00
hh 0c01260da2 feat: drop impeccable scaffolding, .mcp.json moves to infra 2026-10-01 02:02:04 +02:00
hh 695742019d Run compose from the root in part layout 2026-09-09 00:39:12 +02:00
hh a4994ce234 Deploy hooks 2026-09-09 00:37:04 +02:00
hh 1dafc5e2a7 README wording 2026-09-09 00:21:27 +02:00
hh e0d55e12e9 Override-based compose, profiles in .env, README 2026-09-09 00:18:15 +02:00
hh ecd38ee28b Single part at the root, COMPOSE_FILE in .env 2026-09-08 20:38:27 +02:00
46 changed files with 422 additions and 256 deletions

No files matched your search

+1 -3
View File
@@ -1,8 +1,6 @@
# frontend-svelte # frontend-svelte
Copier template for a `frontend/` part: SvelteKit on Bun with Tailwind v4, ultracite (biome) and optional shadcn-svelte, served by a Bun server with SSR, as a static SPA behind `serve.ts`, or as a static SPA that the backend api serves from `frontend/build`. Copier template for a SvelteKit frontend on Bun with Tailwind v4, biome or ESLint + Prettier and optional shadcn-svelte: SSR on Bun, a static SPA behind `serve.ts`, or a static SPA served by the backend api. A `frontend/` part or the whole project (`layout`), on top of `infra`.
Ships `frontend/docker-compose.yml` with root-relative paths, `docker-compose.local.yml` (published ports) and `docker-compose.prod.yml` (the `caddy` network), a `Makefile` with `fmt`, `check`, `build` and `dev`, `.env.example`, `CLAUDE.md`, `.claude/rules` for Svelte and ultracite, the Svelte MCP server and `.impeccable/` scaffolding. Meant to be applied on top of the `infra` template.
```sh ```sh
copier copy --trust -d project_name="My Thing" -d serve=bun <this-repo> <dest> copier copy --trust -d project_name="My Thing" -d serve=bun <this-repo> <dest>
+28 -5
View File
@@ -13,6 +13,14 @@ project_slug:
help: Package name, snake_case help: Package name, snake_case
default: "{{ project_name | lower | replace(' ', '_') | replace('-', '_') | replace('.', '_') }}" default: "{{ project_name | lower | replace(' ', '_') | replace('-', '_') | replace('.', '_') }}"
layout:
type: str
help: Where the frontend lives
choices:
In frontend/ next to other parts: part
At the root of the project: root
default: part
serve: serve:
type: str type: str
help: How the frontend is served help: How the frontend is served
@@ -29,10 +37,13 @@ ui_library:
shadcn-svelte: shadcn shadcn-svelte: shadcn
default: none default: none
include_impeccable: linter:
type: bool type: str
help: .impeccable/ scaffolding for the impeccable skill help: Linter and formatter
default: true choices:
Biome with the ultracite preset: biome
ESLint + Prettier (the sv create setup): eslint
default: biome
install_deps: install_deps:
type: bool type: bool
@@ -44,5 +55,17 @@ frontend_adapter:
when: false when: false
default: "{{ 'bun' if serve == 'bun' else 'static' }}" default: "{{ 'bun' if serve == 'bun' else 'static' }}"
part_dir:
type: str
when: false
default: "{{ 'frontend' if layout == 'part' else '.' }}"
prefix:
type: str
when: false
default: "{{ 'frontend/' if layout == 'part' else '' }}"
_tasks: _tasks:
- "{% if _copier_operation == 'copy' and install_deps %}sh -c 'cd frontend && bun install'{% else %}true{% endif %}" # Generated values (project name) can push lines past the formatter width,
# so every fresh copy is formatted once by its own linter.
- "{% if _copier_operation == 'copy' and install_deps %}sh -c 'cd {{ part_dir }} && bun install && bun --bun run fix'{% else %}true{% endif %}"
@@ -4,7 +4,7 @@
{ {
"hooks": [ "hooks": [
{ {
"command": "cd frontend && bun run fix --skip=correctness/noUnusedImports", "command": "{% if layout == 'part' %}cd frontend && {% endif %}bun run fix{% if linter == 'biome' %} --skip=correctness/noUnusedImports{% endif %}",
"type": "command" "type": "command"
} }
], ],
-8
View File
@@ -1,8 +0,0 @@
{
"mcpServers": {
"svelte": {
"type": "http",
"url": "https://mcp.svelte.dev/mcp"
}
}
}
-5
View File
@@ -1,5 +0,0 @@
node_modules
.svelte-kit
build
.env
.env.*
-1
View File
@@ -1 +0,0 @@
PUBLIC_API_BASE_URL=/api
-17
View File
@@ -1,17 +0,0 @@
COMPOSE := docker compose --project-directory ..
.PHONY: fmt check build dev
fmt:
bun run fix
check:
bun run check
bun run lint
build:
{% if serve == 'api' %} $(COMPOSE) run --rm frontend-dev sh -c "bun install && bun run build"
{% else %} $(COMPOSE) build frontend
{% endif %}
dev:
bun run dev
@@ -1,8 +0,0 @@
services:
{% if serve != 'api' %} frontend:
ports:
- "127.0.0.1:3000:3000"
{% endif %} frontend-dev:
ports:
- "127.0.0.1:3000:3000"
@@ -1,15 +0,0 @@
{%- set dash = project_slug | replace('_', '-') -%}
{% if serve != 'api' -%}
services:
frontend:
networks:
caddy:
aliases:
- {{ dash }}-frontend
networks:
caddy:
external: true
{%- else -%}
services: {}
{%- endif %}
-41
View File
@@ -1,41 +0,0 @@
{
"name": "{{ project_slug }}",
"type": "module",
"private": true,
"version": "0.0.1",
"scripts": {
"dev": "vite dev",
"build": "vite build",
"preview": "vite preview",
"prepare": "svelte-kit sync || echo ''",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"lint": "ultracite check",
"fix": "ultracite fix"
},
"devDependencies": {
"@biomejs/biome": "2.5.2",
"@sveltejs/kit": "^2.63.0",
"@sveltejs/vite-plugin-svelte": "^7.1.2",
"@tailwindcss/vite": "^4.3.0",
"@types/bun": "^1.3.0",
{% if frontend_adapter == 'bun' %} "svelte-adapter-bun": "^1.0.1",
{% else %} "@sveltejs/adapter-static": "^3.0.10",
{% endif %}{% if ui_library == 'shadcn' %} "@internationalized/date": "^3.12.0",
"@lucide/svelte": "^1.23.0",
"bits-ui": "^2.16.3",
"clsx": "^2.1.1",
"mode-watcher": "^1.1.0",
"shadcn-svelte": "^1.3.0",
"svelte-sonner": "^1.1.0",
"tailwind-merge": "^3.5.0",
"tailwind-variants": "^3.2.2",
"tw-animate-css": "^1.4.0",
{% endif %} "svelte": "^5.56.1",
"svelte-check": "^4.6.0",
"tailwindcss": "^4.3.0",
"typescript": "^6.0.3",
"ultracite": "7.9.0",
"vite": "^8.0.16"
}
}
-2
View File
@@ -1,2 +0,0 @@
// place files you want to import through the `$lib` alias in this folder.
// biome-ignore-all lint/suspicious/noEmptySource: temporary
-36
View File
@@ -1,36 +0,0 @@
{% if frontend_adapter == 'bun' -%}
import adapter from "svelte-adapter-bun";
/** @type {import('@sveltejs/kit').Config} */
const config = {
compilerOptions: {
runes: ({ filename }) =>
// biome-ignore lint/performance/useTopLevelRegex: svelte default behaviour
filename.split(/[/\\]/).includes("node_modules") ? undefined : true,
},
kit: {
adapter: adapter(),
},
};
export default config;
{%- else -%}
import adapter from "@sveltejs/adapter-static";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
/** @type {import('@sveltejs/kit').Config} */
const config = {
kit: {
adapter: adapter({
assets: "build",
fallback: "index.html",
pages: "build",
precompress: false,
strict: false,
}),
},
preprocess: vitePreprocess(),
};
export default config;
{%- endif %}
-20
View File
@@ -1,20 +0,0 @@
{
"extends": "./.svelte-kit/tsconfig.json",
"compilerOptions": {
"rewriteRelativeImportExtensions": true,
"allowJs": true,
"checkJs": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"resolveJsonModule": true,
"skipLibCheck": true,
"sourceMap": true,
"strict": true,
"moduleResolution": "bundler"
}
// Path aliases are handled by https://svelte.dev/docs/kit/configuration#alias
// except $lib which is handled by https://svelte.dev/docs/kit/configuration#files
//
// To make changes to top-level options such as include and exclude, we recommend extending
// the generated config; see https://svelte.dev/docs/kit/configuration#typescript
}
-15
View File
@@ -1,15 +0,0 @@
import { sveltekit } from "@sveltejs/kit/vite";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
export default defineConfig({
plugins: [tailwindcss(), sveltekit()],
server: {
proxy: {
"/api": {
changeOrigin: true,
target: process.env.API_PROXY_TARGET ?? "http://localhost:8080",
},
},
},
});
@@ -1,55 +0,0 @@
{% if frontend_adapter == 'bun' -%}
FROM oven/bun:alpine
ENV TERM=xterm-256color
ENV COLORTERM=truecolor
WORKDIR /app
COPY package.json bun.lock* ./
RUN bun install --frozen-lockfile
COPY . .
RUN bun --bun svelte-kit sync
RUN bun --bun run build
ENTRYPOINT ["bun"]
CMD ["build/index.js"]
{%- else -%}
FROM oven/bun:alpine AS deps
ENV TERM=xterm-256color
ENV COLORTERM=truecolor
ENV BUN_INSTALL_CACHE_DIR=/bun-cache
WORKDIR /app
COPY package.json bun.lock* ./
RUN --mount=type=cache,target=/bun-cache bun install --frozen-lockfile
FROM deps AS builder
COPY . .
RUN bun --bun svelte-kit sync
RUN bun run build
FROM oven/bun:alpine AS runtime
ENV NODE_ENV=production
WORKDIR /app
COPY --from=builder /app/build ./build
COPY --from=builder /app/serve.ts ./serve.ts
EXPOSE 3000
ENTRYPOINT ["bun"]
CMD ["run", "serve.ts"]
{%- endif %}
@@ -1,3 +0,0 @@
config.local.json
hook.cache.json
hook.pending.json
+7
View File
@@ -0,0 +1,7 @@
node_modules
.svelte-kit
build
# .env goes into the build: $env/static/public (and static/private) are
# inlined at build time from it. It stays in the builder stage, the runtime
# image gets build/ only. Local overrides (.env.local and the like) stay out.
.env.*
@@ -0,0 +1,4 @@
{% if layout == 'root' %}COMPOSE_PROFILES=services
{% endif %}PUBLIC_API_BASE_URL=/api
ALLOWED_HOSTS=
File renamed without changes.
+44
View File
@@ -0,0 +1,44 @@
COMPOSE := {% if layout == 'part' %}cd .. && {% endif %}docker compose
.PHONY: {% if layout == 'root' %}env recreate rebuild restart logs down {% endif %}fmt check build dev
fmt:
bun run fix
check:
bun run check
bun run lint
build:
{% if serve == 'api' %} $(COMPOSE) run --rm frontend-dev sh -c "bun install && bun run build"
{% else %} $(COMPOSE) build frontend
{% endif %}
dev:
bun run dev
{% if layout == 'root' %}
env:
@fresh=; test -f .env || { cp .env.example .env; fresh=1; }; \
if ! test -f docker-compose.override.yml; then \
cp docker-compose.override.yml.example docker-compose.override.yml; \
for port in $$(sed -n 's/.*127\.0\.0\.1:\([0-9]*\):.*/\1/p' docker-compose.override.yml | sort -u); do \
random=$$((20000 + $$(od -An -N2 -tu2 /dev/urandom) % 40000)); \
sed "s/127\.0\.0\.1:$$port:/127.0.0.1:$$random:/" docker-compose.override.yml > docker-compose.override.yml.tmp && mv docker-compose.override.yml.tmp docker-compose.override.yml; \
test -z "$$fresh" || { sed "s|localhost:$$port/|localhost:$$random/|" .env > .env.tmp && mv .env.tmp .env; }; \
done; \
fi
recreate:
$(COMPOSE) up -d --force-recreate
rebuild: build
$(COMPOSE) up -d
restart:
$(COMPOSE) restart
logs:
$(COMPOSE) logs -f --tail=100
down:
$(COMPOSE) down
{% endif %}
@@ -0,0 +1,23 @@
{%- set dash = project_slug | replace('_', '-') -%}
services:
{% if serve != 'api' %} frontend:
networks:
default: {}
caddy:
aliases:
- {{ dash }}-frontend
# ports:
# - "127.0.0.1:3000:3000"
{% endif %} frontend-dev:
networks:
default: {}
caddy:
aliases:
- {{ dash }}-frontend
# ports:
# - "127.0.0.1:3000:3000"
networks:
caddy:
external: true
@@ -1,15 +1,15 @@
services: services:
{% if serve != 'api' %} frontend: {% if serve != 'api' %} frontend:
build: frontend build: {{ part_dir }}
image: {{ project_slug }}/frontend image: {{ project_slug | replace('_', '-') }}/frontend
profiles: [frontend, services] profiles: [frontend, services]
restart: unless-stopped restart: unless-stopped
env_file: env_file:
- path: .env - path: .env
required: false required: false
- path: frontend/.env {% if layout == 'part' %} - path: frontend/.env
required: false required: false
command: {% if serve == 'bun' %}[build/index.js]{% else %}[run, serve.ts]{% endif %} {% endif %} command: {% if serve == 'bun' %}[build/index.js]{% else %}[run, serve.ts]{% endif %}
{% endif %} frontend-dev: {% endif %} frontend-dev:
image: oven/bun:alpine image: oven/bun:alpine
@@ -19,12 +19,12 @@ services:
env_file: env_file:
- path: .env - path: .env
required: false required: false
- path: frontend/.env {% if layout == 'part' %} - path: frontend/.env
required: false required: false
environment: {% endif %} environment:
API_PROXY_TARGET: http://api:8080 API_PROXY_TARGET: http://api:8080
volumes: volumes:
- ./frontend:/app - {{ './frontend' if layout == 'part' else '.' }}:/app
- frontend_node_modules:/app/node_modules - frontend_node_modules:/app/node_modules
- frontend_svelte_kit:/app/.svelte-kit - frontend_svelte_kit:/app/.svelte-kit
command: [sh, -c, "bun install && bun run dev --host 0.0.0.0 --port 3000"] command: [sh, -c, "bun install && bun run dev --host 0.0.0.0 --port 3000"]
@@ -0,0 +1,69 @@
{
"name": "{{ project_slug }}",
"version": "0.0.1",
"private": true,
"type": "module",
"imports": {
"#lib": "./src/lib/index.js",
"#lib/*": "./src/lib/*"
},
"scripts": {
"build": "vite build",
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"dev": "vite dev",
{%- if linter == 'biome' %}
"fix": "ultracite fix",
"lint": "ultracite check",
{%- else %}
"fix": "prettier --write . && eslint --fix .",
"lint": "prettier --check . && eslint .",
{%- endif %}
"prepare": "svelte-kit sync || echo ''",
"preview": "vite preview"
},
"devDependencies": {
{%- set deps = {
"@sveltejs/kit": "^3.0.1",
"@sveltejs/vite-plugin-svelte": "^7.1.2",
"@tailwindcss/vite": "^4.3.0",
"@types/bun": "^1.3.0",
"svelte": "^5.57.1",
"svelte-check": "^4.7.6",
"tailwindcss": "^4.3.0",
"typescript": "^6.0.3",
"vite": "^8.0.16",
} -%}
{%- if linter == 'biome' %}{% set _ = deps.update({
"@biomejs/biome": "^2.5.15",
"ultracite": "^7.12.4",
}) %}{% else %}{% set _ = deps.update({
"@eslint/compat": "^2.1.1",
"@eslint/js": "^10.0.1",
"eslint": "^10.12.0",
"eslint-config-prettier": "^10.1.8",
"eslint-plugin-svelte": "^3.23.0",
"globals": "^17.13.0",
"prettier": "^3.9.9",
"prettier-plugin-svelte": "^4.1.1",
"prettier-plugin-tailwindcss": "^0.8.1",
"typescript-eslint": "^8.71.1",
}) %}{% endif -%}
{%- if frontend_adapter == 'bun' %}{% set _ = deps.update({"@sveltejs/adapter-bun": "^1.0.0"}) %}{% else %}{% set _ = deps.update({"@sveltejs/adapter-static": "^4.0.0"}) %}{% endif -%}
{%- if ui_library == 'shadcn' %}{% set _ = deps.update({
"@internationalized/date": "^3.12.0",
"@lucide/svelte": "^1.23.0",
"bits-ui": "^2.16.3",
"clsx": "^2.1.1",
"mode-watcher": "^1.1.0",
"shadcn-svelte": "^1.3.0",
"svelte-sonner": "^1.1.0",
"tailwind-merge": "^3.5.0",
"tailwind-variants": "^3.2.2",
"tw-animate-css": "^1.4.0",
}) %}{% endif %}
{%- for name, version in deps | dictsort %}
"{{ name }}": "{{ version }}"{{ "," if not loop.last }}
{%- endfor %}
}
}
File renamed without changes.
+5
View File
@@ -0,0 +1,5 @@
import { defineEnvVars } from "@sveltejs/kit/env";
export const variables = defineEnvVars({
PUBLIC_API_BASE_URL: { public: true, schema: (input) => input ?? "/api" },
});
@@ -1,6 +1,6 @@
import { env } from "$env/dynamic/public"; import { PUBLIC_API_BASE_URL } from "$app/env/public";
const BASE = env.PUBLIC_API_BASE_URL ?? "/api"; const BASE = PUBLIC_API_BASE_URL;
export class ApiError extends Error { export class ApiError extends Error {
status: number; status: number;
@@ -0,0 +1,3 @@
// place files you want to import through the `#lib` alias in this folder.
{% if linter == 'biome' %}// biome-ignore-all lint/suspicious/noEmptySource: temporary
{% endif %}
@@ -0,0 +1,9 @@
{
"extends": "$app/tsconfig",
"compilerOptions": {
"rewriteRelativeImportExtensions": true,
"sourceMap": true,
"strict": true
},
"include": ["src", "vite.config.ts"]
}
@@ -0,0 +1,51 @@
{% if frontend_adapter == 'bun' -%}
import adapter from "@sveltejs/adapter-bun";
import { sveltekit } from "@sveltejs/kit/vite";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
const PATH_SEP = /[/\\]/;
{%- else -%}
import adapter from "@sveltejs/adapter-static";
import { sveltekit } from "@sveltejs/kit/vite";
import { vitePreprocess } from "@sveltejs/vite-plugin-svelte";
import tailwindcss from "@tailwindcss/vite";
import { defineConfig } from "vite";
{%- endif %}
const allowedHosts = process.env.ALLOWED_HOSTS
? process.env.ALLOWED_HOSTS.split(",")
: undefined;
export default defineConfig({
plugins: [
tailwindcss(),
sveltekit({
{%- if frontend_adapter == 'bun' %}
adapter: adapter(),
compilerOptions: {
runes: ({ filename }) =>
filename.split(PATH_SEP).includes("node_modules") ? undefined : true,
},
{%- else %}
adapter: adapter({
assets: "build",
fallback: "index.html",
pages: "build",
precompress: false,
strict: false,
}),
preprocess: [vitePreprocess()],
{%- endif %}
}),
],
server: {
allowedHosts,
proxy: {
"/api": {
changeOrigin: true,
target: process.env.API_PROXY_TARGET ?? "http://localhost:8080",
},
},
},
});
@@ -16,8 +16,3 @@ node_modules
# Vite # Vite
vite.config.js.timestamp-* vite.config.js.timestamp-*
vite.config.ts.timestamp-* vite.config.ts.timestamp-*
# Impeccable
**/.impeccable/config.local.json
**/.impeccable/hook.cache.json
**/.impeccable/hook.pending.json
@@ -0,0 +1,8 @@
# {{ project_name }}
```sh
make env # .env and docker-compose.override.yml from the examples
make recreate # the services in COMPOSE_PROFILES
make dev # vite on the host
make check
```
@@ -2,13 +2,7 @@
"$schema": "./node_modules/@biomejs/biome/configuration_schema.json", "$schema": "./node_modules/@biomejs/biome/configuration_schema.json",
"extends": ["ultracite/biome/core", "ultracite/biome/svelte"], "extends": ["ultracite/biome/core", "ultracite/biome/svelte"],
"files": { "files": {
"includes": [ "includes": ["!.claude", "!.svelte-kit", "!build", "!.mcp.json"]
"!.claude",
"!.svelte-kit",
"!build",
"!.mcp.json",
"!.impeccable"
]
}, },
"javascript": { "globals": ["Bun"] }, "javascript": { "globals": ["Bun"] },
"overrides": [ "overrides": [
@@ -27,6 +21,7 @@
"includes": ["**/*.svelte"], "includes": ["**/*.svelte"],
"linter": { "linter": {
"rules": { "rules": {
"a11y": { "useAnchorContent": "off" },
"style": { "style": {
"useFilenamingConvention": { "useFilenamingConvention": {
"level": "error", "level": "error",
@@ -0,0 +1,14 @@
# Package managers
package-lock.json
pnpm-lock.yaml
yarn.lock
bun.lock
bun.lockb
# Written by copier and the infra template, not by hand
.copier/
*.md
renovate.jsonc
# Miscellaneous
/static/
@@ -0,0 +1,6 @@
{
"trailingComma": "es5",
"plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"],
"overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }],
"tailwindStylesheet": "./src/routes/layout.css"
}
@@ -0,0 +1,59 @@
import { fileURLToPath } from "node:url";
import { includeIgnoreFile } from "@eslint/compat";
import js from "@eslint/js";
import prettier from "eslint-config-prettier";
import svelte from "eslint-plugin-svelte";
import { defineConfig } from "eslint/config";
import globals from "globals";
import ts from "typescript-eslint";
const gitignorePath = fileURLToPath(new URL("./.gitignore", import.meta.url));
{% if frontend_adapter == 'bun' -%}
const svelteConfig = {
compilerOptions: {
runes: ({ filename }) =>
filename.split(/[/\\]/).includes("node_modules") ? undefined : true,
},
};
{%- else -%}
const svelteConfig = {};
{%- endif %}
export default defineConfig(
includeIgnoreFile(gitignorePath),
js.configs.recommended,
...ts.configs.recommended,
...svelte.configs.recommended,
prettier,
...svelte.configs.prettier,
{
languageOptions: { globals: { ...globals.browser, ...globals.node } },
rules: {
// typescript-eslint recommends against no-undef on TypeScript projects:
// https://typescript-eslint.io/troubleshooting/faqs/eslint/#i-get-errors-from-the-no-undef-rule-about-global-variables-not-being-defined-even-though-there-are-no-typescript-errors
"no-undef": "off",
},
},
{%- if ui_library == 'shadcn' %}
{
// shadcn-svelte primitives are copied in and changed upstream only.
files: ["src/lib/components/ui/**"],
rules: {
"@typescript-eslint/no-explicit-any": "off",
"svelte/no-navigation-without-resolve": "off",
},
},
{%- endif %}
{
files: ["**/*.svelte", "**/*.svelte.ts", "**/*.svelte.js"],
languageOptions: {
parserOptions: {
extraFileExtensions: [".svelte"],
parser: ts.parser,
projectService: true,
svelteConfig,
},
},
}
);
@@ -0,0 +1,79 @@
{% if frontend_adapter == 'bun' -%}
FROM oven/bun:1-alpine AS deps
ENV TERM=xterm-256color
ENV COLORTERM=truecolor
ENV BUN_INSTALL_CACHE_DIR=/bun-cache
WORKDIR /app
COPY package.json bun.lock* ./
RUN --mount=type=cache,target=/bun-cache bun install --frozen-lockfile
# .env is in the context ($env/static/* are inlined at build) and stays in
# this stage: the runtime image below gets build/ and production deps only.
FROM deps AS builder
COPY . .
RUN bun --bun svelte-kit sync
RUN bun --bun run build
FROM oven/bun:1-alpine AS runtime
ENV NODE_ENV=production
# The cache mount only holds files; without the variable bun caches into
# ~/.bun inside the image.
ENV BUN_INSTALL_CACHE_DIR=/bun-cache
WORKDIR /app
COPY package.json bun.lock* ./
RUN --mount=type=cache,target=/bun-cache bun install --frozen-lockfile --production
COPY --from=builder /app/build ./build
EXPOSE 3000
ENTRYPOINT ["bun"]
CMD ["build/index.js"]
{%- else -%}
FROM oven/bun:1-alpine AS deps
ENV TERM=xterm-256color
ENV COLORTERM=truecolor
ENV BUN_INSTALL_CACHE_DIR=/bun-cache
WORKDIR /app
COPY package.json bun.lock* ./
RUN --mount=type=cache,target=/bun-cache bun install --frozen-lockfile
FROM deps AS builder
COPY . .
RUN bun --bun svelte-kit sync
RUN bun run build
FROM oven/bun:1-alpine AS runtime
ENV NODE_ENV=production
WORKDIR /app
COPY --from=builder /app/build ./build
COPY --from=builder /app/serve.ts ./serve.ts
EXPOSE 3000
ENTRYPOINT ["bun"]
CMD ["run", "serve.ts"]
{%- endif %}