|
| 1 | +--- |
| 2 | +name: quill-code |
| 3 | +description: Edit the @posthog/quill design system locally and consume the change in this repo (posthog-code) before it is published to npm. Use when changing quill components/primitives/tokens, when a quill change must be tested inside the Code app, or when the user mentions quill, the design system, the .local-quill tarball, or the @posthog/quill pnpm override. |
| 4 | +--- |
| 5 | + |
| 6 | +# quill-code |
| 7 | + |
| 8 | +`@posthog/quill` is **not** in this repo. It is a published catalog dependency whose |
| 9 | +source lives in the main PostHog monorepo at `../posthog/packages/quill`. To test an |
| 10 | +unpublished quill change inside this repo (posthog-code), you build quill, pack it to a |
| 11 | +tarball, and point a pnpm `overrides` entry at that tarball. This is a **temporary |
| 12 | +local-dev** state — revert before merging (see below). |
| 13 | + |
| 14 | +## Quill layout (where to edit) |
| 15 | + |
| 16 | +`../posthog/packages/quill` is the **workspace** (`@posthog/quill-workspace`). It |
| 17 | +contains sub-packages, each a layer of the design system: |
| 18 | + |
| 19 | +- `packages/primitives/src` — base components (Card, Badge, Button, Progress, …) |
| 20 | +- `packages/components/src` — composed components (DataTable, DateTimePicker, Metric) |
| 21 | +- `packages/blocks/src` — **product-level blocks** (e.g. `ExperimentCard`). Add the |
| 22 | + file here and export it from `packages/blocks/src/index.ts`. |
| 23 | +- `packages/quill/src` — the **aggregate** that re-exports all layers as `@posthog/quill`. |
| 24 | + |
| 25 | +A new export in any sub-package flows to `@posthog/quill` automatically on build. |
| 26 | + |
| 27 | +## The loop (every quill change) |
| 28 | + |
| 29 | +1. Edit/add the component in the right sub-package (above) and export it from that |
| 30 | + package's `src/index.ts`. |
| 31 | +2. Re-sync into this repo: |
| 32 | + |
| 33 | + ```bash |
| 34 | + .claude/skills/quill-code/scripts/sync-quill.sh |
| 35 | + ``` |
| 36 | + |
| 37 | + This builds the **whole quill workspace** (recursive `pnpm build` at the workspace |
| 38 | + root — it rebuilds the sub-packages BEFORE the aggregate bundles them), packs it |
| 39 | + into `.local-quill/` as a content-hashed `posthog-quill-local-<hash>.tgz`, rewrites |
| 40 | + the override line in `pnpm-workspace.yaml`, deletes stale tarballs, and runs |
| 41 | + `pnpm install`. |
| 42 | + |
| 43 | + > Building only the aggregate (`packages/quill/packages/quill`) re-bundles the |
| 44 | + > sub-packages' **stale** `dist/`, so edits to primitives/components/blocks are |
| 45 | + > silently dropped. Always build at the workspace root — the script does this. |
| 46 | +3. Verify in the Code app (`pnpm dev`, or the `test-electron-app` skill). Repeat from 1. |
| 47 | + |
| 48 | +After every quill edit you **must** re-run the sync — the app consumes the tarball, not |
| 49 | +the quill source, so unsynced edits are invisible here. |
| 50 | + |
| 51 | +If quill lives elsewhere, set `QUILL_DIR=/abs/path/to/posthog/packages/quill/packages/quill`. |
| 52 | + |
| 53 | +## Why a tarball, not `link:` |
| 54 | + |
| 55 | +`link:` symlinks into the mono's `node_modules` and drags in its **React 18** types, |
| 56 | +colliding with this repo's **React 19** (dual-React → broken typecheck + |
| 57 | +invalid-hook-call at runtime). The tarball is copied into this repo's store and deduped |
| 58 | +against React 19. The filename is **content-hashed** because pnpm pins a tarball by |
| 59 | +integrity, so a stable filename gets cached stale across re-syncs. |
| 60 | + |
| 61 | +## The override (what the script rewrites) |
| 62 | + |
| 63 | +In `pnpm-workspace.yaml`, under `overrides:`: |
| 64 | + |
| 65 | +```yaml |
| 66 | +'@posthog/quill': file:./.local-quill/posthog-quill-local-<hash>.tgz |
| 67 | +``` |
| 68 | +
|
| 69 | +There is also a permanent pin you should leave alone: |
| 70 | +
|
| 71 | +```yaml |
| 72 | +'@posthog/quill>@base-ui/react': ^1.3.0 # quill ships a broken catalog: dep; do not remove |
| 73 | +``` |
| 74 | +
|
| 75 | +## Reverting (before merge) |
| 76 | +
|
| 77 | +The override is local-dev only. Once the quill change is published to npm: |
| 78 | +
|
| 79 | +1. Bump the catalog version in `pnpm-workspace.yaml` (`'@posthog/quill': 0.3.0-beta.x`) |
| 80 | + to the published version. |
| 81 | +2. Restore the override line to point back at the catalog, or remove the `file:` override. |
| 82 | +3. `pnpm install`. |
| 83 | + |
| 84 | +Do not commit a `file:./.local-quill/...` override or the `.local-quill/` tarballs. |
0 commit comments