Files
jnss-web/README.md

77 lines
1.7 KiB
Markdown

# jnss-web
Static website for jnss.me - built with SvelteKit and deployed via Caddy.
## Project Structure
This project uses a **two-branch deployment strategy**:
- **`main` branch**: Source code and development
- Contains all source files, configuration, and build tooling
- `build/` directory is gitignored
- **`deploy` branch**: Orphan branch with build outputs only
- Contains only the static build artifacts (index.html, _app/, etc.)
- No source code or build dependencies
- Used by Ansible/Caddy for serving the site
## Development
Install dependencies:
```sh
bun install
```
Start development server:
```sh
bun run dev
# or open in browser automatically
bun run dev -- --open
```
## Building
Build the static site:
```sh
bun run build
```
Preview the production build locally:
```sh
bun run preview
```
## Deployment
This project uses an automated deployment script that builds and pushes to the `deploy` branch:
```sh
# Deploy with auto-generated timestamp commit message
./deploy.sh
# Deploy with custom commit message
./deploy.sh "Add new feature X"
```
**What the script does:**
1. Builds the site on the `main` branch (`bun run build`)
2. Switches to the `deploy` branch
3. Clears old build files
4. Moves new build output to the root of `deploy` branch
5. Commits and pushes to `origin/deploy`
6. Switches back to `main` branch
**For rick-infra:**
The Ansible role clones the `deploy` branch to get production-ready static files:
```sh
git clone -b deploy git@jnss.me:joakim/jnss-web.git
```
## Tech Stack
- **Framework**: SvelteKit 2.x with static adapter
- **Build Tool**: Vite 7.x
- **Package Manager**: Bun
- **Deployment**: Two-branch strategy (main → source, deploy → build artifacts)
- **Hosting**: Caddy (configured via rick-infra)