Files

45 lines
1.6 KiB
Markdown

# Deploying LosaDev Tools
The tools are a static site (Vite build in `dist/`) served by `server.mjs`, a small Node server with no extra dependencies.
## Needs
- Node.js 20.19+ or 22.12+ (same as Vite).
- HTTPS on the public domain (for example `tools.losadev.wiki` behind the panel's reverse proxy). Browsers only allow opening a game folder (File System Access API) on HTTPS or `localhost`.
## First time
```bash
npm install
cp .env.example .env # then edit PORT / HOST
npm run rebuild # = npm run build && npm run start
```
`npm install` must include the dev dependencies (Vite builds the site). Do not set `NODE_ENV=production` before installing.
## Settings (`.env`)
| Key | Default | Meaning |
|---|---|---|
| `PORT` | `4700` | Port the server listens on |
| `HOST` | `0.0.0.0` | Address to bind. Use `127.0.0.1` when a reverse proxy on the same machine forwards to it |
Values already set in the real environment win over `.env`.
## Scripts
| Script | Does |
|---|---|
| `npm run build` | Builds the site into `dist/` |
| `npm run start` | Serves `dist/` (stops with a message if there is no build yet) |
| `npm run rebuild` | Build, then start. Use it after every update |
| `npm run dev` | Development server (port 4700, not for the public site) |
## Updating
Replace the files (keep your `.env`), run `npm install` if `package.json` changed, then `npm run rebuild` (or restart the process manager after `npm run build`).
## Caching
Files in `/assets/` carry a content hash and are cached for a year. `index.html` and the `legacy/` files are revalidated on every visit, so a new build shows up right away.