|
| 1 | +# Contributing to Avemo Dev |
| 2 | + |
| 3 | +Thanks for your interest in improving Avemo Dev! This document covers how to get |
| 4 | +a development build running, the project layout, and the conventions used here. |
| 5 | + |
| 6 | +## Prerequisites |
| 7 | + |
| 8 | +- [Node.js](https://nodejs.org/) 20 or newer |
| 9 | +- [pnpm](https://pnpm.io/) 9 or newer (`corepack enable` will provide it) |
| 10 | +- A Chromium-based browser (Chrome, Edge, Brave, Arc, …) for loading the extension |
| 11 | + |
| 12 | +## Getting started |
| 13 | + |
| 14 | +```bash |
| 15 | +pnpm install # install dependencies |
| 16 | +pnpm dev # start Vite in watch mode with HMR |
| 17 | +``` |
| 18 | + |
| 19 | +Then load the extension: |
| 20 | + |
| 21 | +1. Open `chrome://extensions`. |
| 22 | +2. Enable **Developer mode** (top-right). |
| 23 | +3. Click **Load unpacked** and select the generated `dist/` folder. |
| 24 | + |
| 25 | +CRXJS reloads the extension as you edit source files. For a production build, |
| 26 | +run `pnpm build` and load the same `dist/` folder. |
| 27 | + |
| 28 | +## Useful scripts |
| 29 | + |
| 30 | +| Command | What it does | |
| 31 | +| --- | --- | |
| 32 | +| `pnpm dev` | Vite dev server + HMR for the extension | |
| 33 | +| `pnpm build` | Type-check (`vue-tsc`) then produce the unpacked extension in `dist/` | |
| 34 | +| `pnpm type-check` | Type-check only, no build | |
| 35 | +| `pnpm test` | Run the Vitest unit suite once | |
| 36 | +| `pnpm test:watch` | Vitest in watch mode | |
| 37 | +| `pnpm e2e:install` | One-time: download the Chromium build Playwright drives | |
| 38 | +| `pnpm e2e` | Run the Playwright end-to-end suite against `dist/` (build first) | |
| 39 | + |
| 40 | +## Project structure |
| 41 | + |
| 42 | +``` |
| 43 | +src/ |
| 44 | +├─ background/ # MV3 service worker (toggles the panel on command/icon click) |
| 45 | +├─ content/ # content script: mounts the Shadow-DOM host |
| 46 | +│ ├─ overlay-root.ts # creates the shadow root, injects tokens + Inter |
| 47 | +│ ├─ overlay-manager.ts # watches the Pinia store, drives the plain-JS renderers |
| 48 | +│ └─ overlays/ # column/baseline/row grids, outlines, inspector, tools |
| 49 | +├─ ui/ # Vue panel + section/component tree |
| 50 | +├─ stores/ # Pinia store — the single config contract the UI drives |
| 51 | +├─ lib/ # framework-agnostic helpers (color, grid math, storage, …) |
| 52 | +└─ styles/ # panel.css — the avemo OKLCH token system (injected inline) |
| 53 | +``` |
| 54 | + |
| 55 | +Key architectural notes: |
| 56 | + |
| 57 | +- **Shadow DOM isolation.** The panel and every overlay mount inside a shadow root |
| 58 | + so page CSS never leaks in, and the extension's styles never affect the page. |
| 59 | +- **Store-driven overlays.** `src/stores/settings.ts` is the source of truth; |
| 60 | + `overlay-manager.ts` watches it and calls the plain-JS renderers in |
| 61 | + `src/content/overlays/`. Overlays don't import Vue. |
| 62 | +- **Per-domain persistence.** Config is saved per host in `chrome.storage.local` |
| 63 | + and auto-restored on the next visit. |
| 64 | + |
| 65 | +## Coding conventions |
| 66 | + |
| 67 | +- **TypeScript strict mode** throughout — no `any` escape hatches without a reason. |
| 68 | +- Match the style, naming, and comment density of the surrounding code. |
| 69 | +- Keep overlay renderers framework-agnostic (no Vue imports under `content/overlays/`). |
| 70 | +- Prefer small, focused modules in `src/lib/` for reusable logic and add a unit test. |
| 71 | + |
| 72 | +## Before opening a pull request |
| 73 | + |
| 74 | +1. `pnpm type-check` passes. |
| 75 | +2. `pnpm test` passes (add/adjust tests for behavior changes). |
| 76 | +3. `pnpm build` succeeds. |
| 77 | +4. If you touched panel/overlay behavior, sanity-check it in a real browser and, |
| 78 | + where practical, extend the Playwright suite in `e2e/`. |
| 79 | + |
| 80 | +### Commit messages |
| 81 | + |
| 82 | +This project uses [Conventional Commits](https://www.conventionalcommits.org/): |
| 83 | + |
| 84 | +``` |
| 85 | +feat(inspector): add contrast ratio readout |
| 86 | +fix(panel): restore focus after closing a color field |
| 87 | +docs: clarify E2E setup |
| 88 | +``` |
| 89 | + |
| 90 | +## Reporting bugs & requesting features |
| 91 | + |
| 92 | +Use the [issue templates](https://github.com/philippgerger/avemo-dev-plugin/issues/new/choose). |
| 93 | +For anything security-related, please read [SECURITY.md](./SECURITY.md) first. |
0 commit comments