Files
James Brunton dbd60d4765 Replace Prettier with Oxfmt (#7422)
# Description of Changes
Prettier takes about 10 seconds to run over our frontend folder, but
[Oxfmt](https://oxc.rs/docs/guide/usage/formatter.html) does an (almost)
identical job in 0.2 seconds. This PR converts our Prettier integration
to an equivalent Oxfmt integration. There's exactly 2 files in the
frontend folder that Oxfmt formats differently to Prettier so it'll
barely cause any disruption to the source.

I've removed the `--check` option from the frontend tool models
generator as part of this because we can do the same thing with Task
easily enough and Oxfmt isn't directly importable like Prettier since
it's a Rust binary instead of a JS library. Originally I was shelling
out to Oxfmt on single-file mode to keep it all in memory but it just
seemed more likely that there'd be config mismatches between that script
and the task so I think it's better this way.
2026-08-24 10:34:12 +00:00

88 lines
2.8 KiB
Markdown

# Frontend
All frontend commands are run from the repository root using [Task](https://taskfile.dev/):
- `task frontend:dev` — start Vite dev server (localhost:5173)
- `task frontend:build` — production build
- `task frontend:test` — run tests
- `task frontend:test:watch` — run tests in watch mode
- `task frontend:lint` — run linting
- `task frontend:typecheck` — run TypeScript type checking
- `task frontend:check` — run typecheck + lint + test
- `task frontend:install` — install npm dependencies
For desktop app development, see the [Tauri](#tauri) section below.
## Layout
`frontend/` is a workspace containing one or more apps. Today it holds the
PDF editor under `frontend/editor/`; new apps (the developer portal, etc.)
will sit alongside it as siblings. Shared tooling — `package.json`, `node_modules`,
`.storybook/`, oxlint, oxfmt — lives at `frontend/` so every app installs
once and lints with the same config.
## Environment Variables
The editor's environment variables live in committed `.env` files at
`frontend/editor/`:
- `.env` — used by all builds (core, proprietary, and as the base for desktop/SaaS)
- `.env.desktop` — additional vars loaded in desktop (Tauri) mode
- `.env.saas` — additional vars loaded in SaaS mode
These files contain non-secret defaults and are checked into Git, so most dev work needs no further setup.
To override values locally (API keys, machine-specific settings), create an uncommitted sibling `editor/.env.local` / `editor/.env.desktop.local` / `editor/.env.saas.local`. Vite automatically layers these on top of the committed files.
## Docker Setup
For Docker deployments and configuration, see the [Docker README](../docker/README.md).
## Tauri
All desktop tasks are available via [Task](https://taskfile.dev). From the root of the repo:
### Dev
```bash
task desktop:dev
```
This ensures the JLink runtime and backend JAR exist (skipping if already built), then starts Tauri in dev mode.
### Build
```bash
task desktop:build
```
This does a full clean rebuild of the backend JAR and JLink runtime, then builds the Tauri app for production.
Platform-specific dev builds are also available:
```bash
task desktop:build:dev # No bundling
task desktop:build:dev:mac # macOS .app bundle
task desktop:build:dev:windows # Windows NSIS installer
task desktop:build:dev:linux # Linux AppImage
```
### JLink Tasks
You can also run JLink steps individually:
```bash
task desktop:jlink # Build JAR + create JLink runtime
task desktop:jlink:jar # Build backend JAR only
task desktop:jlink:runtime # Create JLink custom JRE only
task desktop:jlink:clean # Remove JLink artifacts
```
### Clean
```bash
task desktop:clean
```
Removes all desktop build artifacts including JLink runtime, bundled JARs, Cargo build, and dist/build directories.