Add single-command installation: install.sh, Makefile, frontend build hook

- hatch_build.py: custom hatchling build hook that compiles the React
  frontend (npm ci + build) when frontend/dist is missing or stale, so
  'uv tool install git+https://gitea.zephyre.one/Pakobbix/nvcurve.git'
  works as a single command
- install.sh: curl|bash installer (checks prerequisites, auto-installs uv,
  clones and installs)
- Makefile: dev targets (frontend, install, dev, test, clean)
- README/docs: document the one-liner, clone, and direct-git installs
This commit is contained in:
ARIA committed 2026-09-16 10:43:23 +02:00
1 parent d810c44478
commit a8462e696c
7 files changed
+287 -30

No files matched your search

+28 -19
View File
@@ -29,37 +29,45 @@ sudo pacman -S uv
pip install uv
```
## Installation from Source
## Installation
### Step 1: Clone the Repository
### Option 1: One-liner (recommended)
```bash
git clone <this-repo-url>.git
curl -fsSL https://gitea.zephyre.one/Pakobbix/nvcurve/raw/branch/main/install.sh | bash
```
The script checks prerequisites (installs `uv` if missing), clones the repository, and installs NVCurve. The React frontend is compiled automatically during the build by a hatchling build hook (`hatch_build.py`).
### Option 2: From a clone
```bash
git clone https://gitea.zephyre.one/Pakobbix/nvcurve.git
cd nvcurve
./install.sh
```
### Step 2: Build the Frontend
The frontend is a React + TypeScript + Vite application in the `frontend/` directory.
Equivalent manual steps (what the script does):
```bash
cd frontend
npm install
npm run build
cd ..
git clone https://gitea.zephyre.one/Pakobbix/nvcurve.git
cd nvcurve
uv tool install . # frontend is built automatically if missing/stale
```
This produces a `dist/` directory with the compiled static assets. The hatch build system bundles `frontend/dist` into the Python package.
### Step 3: Install the Python Package
### Option 3: Direct from git (no clone, no script)
```bash
uv tool install .
uv tool install "git+https://gitea.zephyre.one/Pakobbix/nvcurve.git"
```
This installs `nvcurve` as a system-wide tool with the bundled frontend.
To install a specific branch:
### Step 4: Verify
```bash
uv tool install "git+https://gitea.zephyre.one/Pakobbix/nvcurve.git@<branch>"
```
### Verify
```bash
nvcurve setup
@@ -94,10 +102,11 @@ nvcurve serve start
```bash
cd nvcurve
git pull
cd frontend && npm run build && cd ..
uv tool install .
uv tool install --force .
```
The frontend is rebuilt automatically if it is missing or older than the frontend sources. If you modified frontend code locally, run `make frontend` first (or `rm -rf frontend/dist`).
If running as a systemd service:
```bash
@@ -116,7 +125,7 @@ source ~/.local/bin/env # or wherever uv installed
### Frontend not loading in the web UI
Verify that `frontend/dist` exists and contains built assets. If the directory is empty or missing, rebuild with `npm run build` and reinstall with `uv tool install .`.
Verify that the installed package contains the frontend. If `frontend/dist` is empty or missing, rebuild with `make frontend` (or `cd frontend && npm ci && npm run build`) and reinstall with `uv tool install --force .`.
### NvAPI functions not found