Skip to content

Commit 914aba6

Browse files
committed
docs: add v2→v3 migration guide and clarify usage
1 parent b567a4e commit 914aba6

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,28 @@ pnpm lint
253253

254254
- CI runs on Node 18+ and uses PNPM and Turbo to install, type-check, build, and test the monorepo.
255255
- Docs are built with Vite and deployed to GitHub Pages from `docs/dist`.
256+
257+
## 🔄 Migration Guide (v2 → v3)
258+
259+
Major changes in v3.0.0 modernize the architecture and usage. Here’s how to update:
260+
261+
- New packages: The project is now a PNPM monorepo with `@react-code-view/react`, `@react-code-view/core`, and `@react-code-view/unplugin`. The `react-code-view` package re-exports everything for convenience.
262+
- Component imports: Prefer `react-code-view` for quick usage, or import directly from `@react-code-view/react` for granular control.
263+
- Before (v2): `import { CodeView } from 'react-code-view'`
264+
- After (v3): `import CodeView from 'react-code-view'` or `import { CodeView } from '@react-code-view/react'`
265+
- Styles: Use the new CSS entry points.
266+
- Before (v2): Less files (e.g., `react-code-view/less/styles.less`)
267+
- After (v3): `import 'react-code-view/styles'` and optional syntax theme `import 'react-code-view/styles/highlight'`
268+
- Build tool integration: Replace legacy Webpack markdown loader with the unified unplugin across tools.
269+
- Before (v2): `webpack-md-loader` and custom loader config
270+
- After (v3): `@react-code-view/unplugin` for Vite/Webpack/Rollup/esbuild/Rspack (see examples above)
271+
- Hook behavior: `useCodeExecution` is stabilized to avoid unintended re-executions.
272+
- New: `updateCode` alias for code changes; pass `dependencies` explicitly if runtime scope is needed
273+
- If you relied on implicit re-runs via changing options, update to change `code` or manage your own triggers
274+
- Types & tests: Vitest + jest-dom types included via package `tsconfig.json`.
275+
- Add `types: ['vitest/globals', '@testing-library/jest-dom']` if customizing your test config
276+
277+
If you need help migrating specific code paths from v2, open an issue and we’ll guide you through it.
256278
```
257279
258280
## 📝 Changelog

0 commit comments

Comments
 (0)