Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: CI

on:
push:
branches: [main]
pull_request:

jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: oven-sh/setup-bun@v2
with:
bun-version: 1.3.11
- run: bun install --frozen-lockfile
- run: bun run lint
- run: bun run test
- run: bun run build
71 changes: 48 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,32 +1,57 @@
# React + TypeScript + Vite
# O-Analysis

This template provides a minimal setup to get React working in Vite with HMR and some Oxlint rules.
A browser app for analysing orienteering maps. Import a map image, overlay GPX
tracks (georeferenced by pinning points), draw routes, add numbered control
annotations, and export an annotated PNG.

Currently, two official plugins are available:
Everything runs in the browser. Projects autosave to IndexedDB, and you can
save them as `.anal` files to move between devices or keep a copy.

- [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react) uses [Oxc](https://oxc.rs)
- [@vitejs/plugin-react-swc](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react-swc) uses [SWC](https://swc.rs/)
## Getting started

## React Compiler
Requires [Bun](https://bun.sh) 1.3 or newer.

The React Compiler is not enabled on this template because of its impact on dev & build performances. To add it, see [this documentation](https://react.dev/learn/react-compiler/installation).
```bash
bun install
bun run dev # start the dev server
```

## Expanding the Oxlint configuration
## Scripts

If you are developing a production application, we recommend enabling type-aware lint rules by installing `oxlint-tsgolint` and editing `.oxlintrc.json`:
| Command | What it does |
| --- | --- |
| `bun run dev` | Vite dev server with hot reload |
| `bun run test` | Unit tests (Vitest) |
| `bun run lint` | Oxlint |
| `bun run build` | Generate PWA icons, type-check, and build for production |
| `bun run preview` | Serve the production build locally |

```json
{
"$schema": "./node_modules/oxlint/configuration_schema.json",
"plugins": ["react", "typescript", "oxc"],
"options": {
"typeAware": true
},
"rules": {
"react/rules-of-hooks": "error",
"react/only-export-components": ["warn", { "allowConstantExport": true }]
}
}
```
## Configuration

Copy `.env.example` to `.env.local` and set `VITE_ANALYTICS_HOSTNAME` to the
domain registered with One Dollar Stats. Without it, the build uses
`oanalysis.com`.

## Project layout

- `src/store.ts`: Zustand store, undo/redo history, and the IndexedDB autosave
layer (project JSON plus the map image as a separate Blob)
- `src/utils/project.ts`: open, save, and the confirm-before-replacing flow
- `src/utils/projectValidation.ts`: checks every entry of a `.anal` file before
it is loaded
- `src/utils/export.ts`, `src/utils/exportScale.ts`: PNG composition and the
iOS canvas-size limit
- `src/components/canvas/`: Konva layers for the map, GPX tracks and markers
- `src/utils/gpx.ts`, `gpxMetrics.ts`: GPX parsing and per-point metrics

## Project file format

`.anal` files are JSON with `format: "map-analysis"` and `version: 1`. They hold
the map image as a data URL, GPX tracks, drawings, annotations, and the canvas
rotation. Older files that embed the map image load without changes.

## Privacy

See the [Oxlint rules documentation](https://oxc.rs/docs/guide/usage/linter/rules) for the full list of rules and categories.
The app does not upload map, track or project data. Analytics records only
anonymous usage events, such as that an export happened. See the Privacy Policy
inside the app for details.
822 changes: 821 additions & 1 deletion bun.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<script
defer
src="https://assets.onedollarstats.com/stonks.js"
data-hostname="oanalysis.com"
data-hostname="__ODS_HOSTNAME__"
></script>
</head>
<body>
Expand Down
Loading
Loading