|
| 1 | +# Upgrade prompt: `@open-elements/ui` 0.5.x → 0.6.0 |
| 2 | + |
| 3 | +`@open-elements/ui` 0.6.0 reorganises its dependency manifest: implementation-detail libraries moved from `peerDependencies` to regular `dependencies` so they install transitively. Consumer apps that listed those libs only to satisfy the peer-dep constraint can now drop them. |
| 4 | + |
| 5 | +This file is a self-contained prompt for an agent (Claude Code, etc.) to run inside a consumer repo. Paste it verbatim. |
| 6 | + |
| 7 | +--- |
| 8 | + |
| 9 | +## Prompt |
| 10 | + |
| 11 | +You are working inside an app that depends on `@open-elements/ui`. Goal: upgrade to `^0.6.0` and remove dependencies that are now transitive. |
| 12 | + |
| 13 | +### What changed in 0.6.0 |
| 14 | + |
| 15 | +These libs moved from `peerDependencies` to regular `dependencies` inside `@open-elements/ui`. Consumers no longer need to declare them — they install transitively: |
| 16 | + |
| 17 | +- `@tiptap/core`, `@tiptap/react`, `@tiptap/starter-kit`, `@tiptap/extension-link`, `@tiptap/extension-placeholder` |
| 18 | +- `tiptap-markdown` |
| 19 | +- `date-fns` |
| 20 | +- `react-day-picker` |
| 21 | +- `clsx` |
| 22 | +- `tailwind-merge` |
| 23 | +- `class-variance-authority` |
| 24 | + |
| 25 | +These remain `peerDependencies` and must stay in the consumer's `package.json`: |
| 26 | + |
| 27 | +- `react`, `react-dom` (Singleton) |
| 28 | +- `@base-ui/react`, `radix-ui` (shared React Context — version mismatch breaks providers like `TooltipProvider`) |
| 29 | +- `lucide-react` (consumers use icons directly) |
| 30 | + |
| 31 | +### Steps |
| 32 | + |
| 33 | +1. **Find the consumer's frontend package.json.** Usually `package.json` at repo root or under `frontend/`. Confirm `@open-elements/ui` is listed. |
| 34 | + |
| 35 | +2. **Bump `@open-elements/ui` to `^0.6.0`** in that `package.json`. |
| 36 | + |
| 37 | +3. **For each of the 11 libs above, grep the source directory for direct imports** (typically `src/`, exclude `node_modules` and `dist`): |
| 38 | + |
| 39 | + ```bash |
| 40 | + for pkg in "@tiptap/core" "@tiptap/react" "@tiptap/starter-kit" \ |
| 41 | + "@tiptap/extension-link" "@tiptap/extension-placeholder" \ |
| 42 | + "tiptap-markdown" "date-fns" "react-day-picker" \ |
| 43 | + "clsx" "tailwind-merge" "class-variance-authority"; do |
| 44 | + count=$(grep -rn "from \"$pkg" src --include="*.ts" --include="*.tsx" 2>/dev/null | wc -l) |
| 45 | + echo "$pkg: $count direct imports" |
| 46 | + done |
| 47 | + ``` |
| 48 | + |
| 49 | + - **0 direct imports** → remove from `package.json` (both `dependencies` and `devDependencies`). |
| 50 | + - **>0 direct imports** → keep as a direct dependency. The lib is consumer-owned, the new transitive availability is just a bonus. |
| 51 | + - Type-only imports (`import type { ... }`) and `.d.ts` augmentation files count as usage — keep them. |
| 52 | + |
| 53 | +4. **Look for a dead `tiptap-markdown` type augmentation.** Search for: |
| 54 | + |
| 55 | + ```bash |
| 56 | + grep -rln "declare module \"@tiptap/core\"" src |
| 57 | + ``` |
| 58 | + |
| 59 | + If a file like `src/types/tiptap-markdown.d.ts` exists AND nothing in `src/` calls `editor.storage.markdown`, the augmentation is dead — `@open-elements/ui` 0.6.0 ships its own internal augmentation. Verify: |
| 60 | + |
| 61 | + ```bash |
| 62 | + grep -rn "storage\.markdown\|storage\[\"markdown" src |
| 63 | + ``` |
| 64 | + |
| 65 | + If only the augmentation file itself matches, delete the augmentation file. |
| 66 | + |
| 67 | +5. **Run `pnpm install`** to refresh the lockfile. |
| 68 | + |
| 69 | +6. **Verify nothing broke.** All three must pass: |
| 70 | + |
| 71 | + ```bash |
| 72 | + pnpm exec tsc --noEmit |
| 73 | + pnpm test |
| 74 | + pnpm build |
| 75 | + ``` |
| 76 | + |
| 77 | + If a typecheck error mentions a removed dep, restore that dep — the grep missed an import (e.g. dynamic `import()` or a re-export through a barrel file). |
| 78 | + |
| 79 | +7. **Commit** with a clear message, e.g.: |
| 80 | + |
| 81 | + ``` |
| 82 | + chore(deps): upgrade @open-elements/ui to 0.6.0, drop now-transitive deps |
| 83 | +
|
| 84 | + <list the deps you removed> |
| 85 | + ``` |
| 86 | + |
| 87 | +### Guard rails |
| 88 | + |
| 89 | +- **Do not** remove `react`, `react-dom`, `@base-ui/react`, `radix-ui`, or `lucide-react` — these stay as peer dependencies. |
| 90 | +- **Do not** remove a lib that `package.json` lists if `src/` imports it directly (even once). Transitive availability does not justify dropping a direct dependency declaration. |
| 91 | +- **Do not** bump unrelated dependency versions in the same change. |
| 92 | +- If `pnpm install` warns about missing peer dependencies after your changes, you removed too much — restore the missing peer. |
| 93 | + |
| 94 | +### Don't do this |
| 95 | + |
| 96 | +- Do not add a `.npmrc` with `auto-install-peers=true` to "fix" peer warnings. Declare peers explicitly. |
| 97 | +- Do not move `react`/`react-dom` to regular dependencies in the consumer; they stay where they are. |
| 98 | +- Do not edit `@open-elements/ui` from the consumer side. If something is missing, open an issue against the UI lib. |
0 commit comments