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
40 changes: 0 additions & 40 deletions .eslintrc.js

This file was deleted.

64 changes: 64 additions & 0 deletions DEPRECATION_react-code-view.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Deprecation Notice: `react-code-view` Package

## ⚠️ Status: DEPRECATED

The `react-code-view` package has been **deprecated** and is no longer maintained.

## 🔄 Migration Required

Please migrate to **`@react-code-view/react`** instead.

### Why?

The `react-code-view` package was a convenience wrapper that re-exported everything from `@react-code-view/react` and `@react-code-view/core`. To simplify the architecture and reduce maintenance overhead, we've decided to deprecate this wrapper package.

### What to do?

**1. Update your package.json:**

```bash
# Remove old package
npm uninstall react-code-view

# Install new package
npm install @react-code-view/react
```

**2. Update your imports:**

```tsx
// Before (deprecated)
import { CodeView } from 'react-code-view';
import 'react-code-view/styles';

// After (recommended)
import { CodeView } from '@react-code-view/react';
import '@react-code-view/react/styles';
```

**3. That's it!**

All APIs remain the same - only the package name changes.

## 📦 New Package Structure

| Package | Purpose |
|---------|---------|
| `@react-code-view/react` | React components (main package) |
| `@react-code-view/core` | Core utilities (usually not needed directly) |
| `@react-code-view/unplugin` | Build tool plugins for markdown imports |

## 🔗 Resources

- **Documentation**: https://rcv-rsuite.vercel.app/
- **GitHub**: https://github.com/simonguo/react-code-view
- **npm**: https://www.npmjs.com/package/@react-code-view/react

## ⏰ Timeline

- **v3.0.0** (Dec 2025): `react-code-view` package deprecated
- **v4.0.0** (Future): Package will no longer be published

## 💬 Questions?

If you have any questions or need help migrating, please [open an issue](https://github.com/simonguo/react-code-view/issues).
47 changes: 47 additions & 0 deletions NPM_DEPRECATION_COMMANDS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# NPM Deprecation Commands for react-code-view

## 🚨 Important: Run these commands to deprecate the package on npm

After merging the PR that removes the `react-code-view` package, run the following commands to deprecate it on npm:

### Deprecate all versions

```bash
# Deprecate all versions of react-code-view
npm deprecate react-code-view "Package deprecated. Please use @react-code-view/react instead. See https://github.com/simonguo/react-code-view/blob/main/DEPRECATION_react-code-view.md for migration guide."
```

### Deprecate specific version ranges (alternative)

If you prefer to deprecate specific versions:

```bash
# Deprecate v3.x versions
npm deprecate react-code-view@3.x "Package deprecated. Please use @react-code-view/react instead. See https://github.com/simonguo/react-code-view/blob/main/DEPRECATION_react-code-view.md for migration guide."

# Deprecate v2.x versions (if needed)
npm deprecate react-code-view@2.x "Package deprecated. Please use @react-code-view/react instead. See https://github.com/simonguo/react-code-view/blob/main/DEPRECATION_react-code-view.md for migration guide."
```

## 📋 Verification

After running the deprecation command, verify it worked:

```bash
npm view react-code-view
```

You should see a deprecation warning in the output.

## 📝 Notes

- Deprecation does NOT unpublish the package - it remains available for existing users
- Users will see a warning when installing: `npm WARN deprecated react-code-view@x.x.x: Package deprecated...`
- The package will still be installable, but users are encouraged to migrate
- According to npm policy, you should NOT unpublish packages that others depend on

## 🔗 References

- npm deprecate documentation: https://docs.npmjs.com/cli/v10/commands/npm-deprecate
- npm unpublish policy: https://docs.npmjs.com/policies/unpublish
- Migration guide: [DEPRECATION_react-code-view.md](./DEPRECATION_react-code-view.md)
21 changes: 11 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,17 @@ A React component library for rendering code with **live preview** and syntax hi

```bash
# npm
npm install react-code-view
npm install @react-code-view/react @react-code-view/unplugin

# pnpm
pnpm add react-code-view
pnpm add @react-code-view/react @react-code-view/unplugin

# yarn
yarn add react-code-view
yarn add @react-code-view/react @react-code-view/unplugin
```

> **Note:** `@react-code-view/unplugin` is needed if you want to import `.md` files directly as React components. For basic CodeView usage without markdown imports, you only need `@react-code-view/react`.

## 🚀 Quick Start

### ⭐ Import Markdown as React Components
Expand Down Expand Up @@ -105,7 +107,7 @@ function App() {
If you prefer not to configure a build tool:

```tsx
import CodeView from 'react-code-view';
import { CodeView } from '@react-code-view/react';
import markdown from './demo.md?raw';

<CodeView dependencies={{ useState: React.useState }}>
Expand All @@ -118,7 +120,7 @@ import markdown from './demo.md?raw';
For simple code snippets without markdown:

```tsx
import CodeView from 'react-code-view';
import { CodeView } from '@react-code-view/react';

const code = `
<button onClick={() => alert('Hello!')}>
Expand All @@ -137,7 +139,6 @@ This monorepo contains the following packages:

| Package | Version | Description |
|---------|---------|-------------|
| [`react-code-view`](./packages/react-code-view) | [![npm](https://img.shields.io/npm/v/react-code-view.svg)](https://www.npmjs.com/package/react-code-view) | Main package (re-exports all) |
| [`@react-code-view/react`](./packages/react) | [![npm](https://img.shields.io/npm/v/@react-code-view/react.svg)](https://www.npmjs.com/package/@react-code-view/react) | React components |
| [`@react-code-view/core`](./packages/core) | [![npm](https://img.shields.io/npm/v/@react-code-view/core.svg)](https://www.npmjs.com/package/@react-code-view/core) | Core transformation utilities |
| [`@react-code-view/unplugin`](./packages/unplugin) | [![npm](https://img.shields.io/npm/v/@react-code-view/unplugin.svg)](https://www.npmjs.com/package/@react-code-view/unplugin) | Build tool plugins |
Expand Down Expand Up @@ -356,13 +357,13 @@ pnpm lint

Major changes in v3.0.0 modernize the architecture and usage. Here’s how to update:

- 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.
- Component imports: Prefer `react-code-view` for quick usage, or import directly from `@react-code-view/react` for granular control.
- New packages: The project is now a PNPM monorepo with `@react-code-view/react`, `@react-code-view/core`, and `@react-code-view/unplugin`.
- Component imports: Use `@react-code-view/react` for all React components.
- Before (v2): `import { CodeView } from 'react-code-view'`
- After (v3): `import CodeView from 'react-code-view'` or `import { CodeView } from '@react-code-view/react'`
- After (v3+): `import { CodeView } from '@react-code-view/react'`
- Styles: Use the new CSS entry points.
- Before (v2): Less files (e.g., `react-code-view/less/styles.less`)
- After (v3): `import 'react-code-view/styles'`
- After (v3+): `import '@react-code-view/react/styles'`
- Build tool integration: Replace legacy Webpack markdown loader with the unified unplugin across tools.
- Before (v2): `webpack-md-loader` and custom loader config
- After (v3): `@react-code-view/unplugin` for Vite/Webpack/Rollup/esbuild/Rspack (see examples above)
Expand Down
Loading