# @sanity/incompatible-plugin

> Display an error dialog in Sanity Studio v2 when a v3 plugin has been installed.

Latest version **1.0.5** (published 2024-12-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install @sanity/incompatible-plugin
pnpm add @sanity/incompatible-plugin
yarn add @sanity/incompatible-plugin
bun add @sanity/incompatible-plugin
```

## Health

**Score 45/100 (D)** — status: stable.

Positive: has types; no vulnerabilities; high maintenance score.

Warnings: low downloads; no esm support.

Negative: stale.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2024-12-16 |
| First published | 2022-06-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 35.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Sanity.io |
| Maintainers | kmelve, bjoerge, rexxars, skogsmaskin, tonina, mattcraig, joneidejohnsen, rubioz, robinpyon, mariuslundgard, sanity-io, evenw, radhe_sanity, rbotten, danielsgroves, judofyr, ryanblock, obliadp, dcilke, madken, fredcarlsen, hermanw, tambet, sgulseth, atombender, simeonsanity, stipsan, snorreeb, rankers, rdunk, michael-sanity, vincentquigley, ritasdias, kenjonespizza, rneatherway-sanity, josh_sanity_io, cngonzalez-sanity, jjburbridge, tdfka_rick, svirs, ryanbonial-sanity, indrek.karner, ash, sergeisarviro, refiito, drewsanity, kaspar.lippmaa.sanity, dam, simen.svale, tbeseda, daniel.malmer, jordanl17, colepeters, armandocerna, joan_miralles_paez, christianhg, pedro-sanity, jwoods-sanity, ricokahler, tiit.kass.saity, binoy14, pauloborgesf, ausha, nuurtamo, chrislarocquesanity |
| Keywords | sanity, sanity-plugin |

## Links

- npm: https://www.npmjs.com/package/@sanity/incompatible-plugin
- Repository: https://github.com/sanity-io/incompatible-plugin
- Homepage: https://github.com/sanity-io/incompatible-plugin#readme
- Issues: https://github.com/sanity-io/incompatible-plugin/issues
- npm.io page: https://npm.io/package/@sanity/incompatible-plugin

## Recent versions

- 1.0.5 (latest) — 2024-12-16
- 1.0.4 — 2022-10-07
- 1.0.3 — 2022-09-28
- 1.0.2 — 2022-09-28
- 1.0.1 — 2022-09-09
- 1.0.0 — 2022-08-17
- 0.0.1-studio-v3.1 — 2022-06-13
- 0.0.1 — 2022-06-11

## README

# @sanity/incompatible-plugin

Small helper library that will display a warning in Sanity Studio v2 when a plugin built for Studio v3 is installed.

## Installation

```bash
npm i @sanity/incompatible-plugin
```

or

```bash
yarn add @sanity/incompatible-plugin
```

## Usage

In your plugin root directory, create two files:

`v2-incompatible.js`

```js
const {showIncompatiblePluginDialog} = require('@sanity/incompatible-plugin')
const {name, version} = require('./package.json')

export default showIncompatiblePluginDialog({
  name: name,
  versions: {
    v3: version,
    // Optional: If there is not v2 version of your plugin, v2 can be omitted
    v2: '^1.2.5',
  },
  // Optional: Feel free to put this as field in package.json and import it alongside name and version above
  sanityExchangeUrl: 'https://www.sanity.io/plugins/<plugin-on-sanity-exchanged>',
})
```

`sanity.json`

```json
{
  "parts": [
    {
      "implements": "part:@sanity/base/sanity-root",
      "path": "./v2-incompatible.js"
    }
  ]
}
```

Add these to `files` in the plugin `package.json` alongside anything else already there, for instance:

```json
{
  "files": ["src", "lib", "v2-incompatible.js", "sanity.json"]
}
```

Done!

If your v3 plugin gets installed in a v2 studio by mistake, a dialog will display how to fix it.

## Develop

### Release new version

Run ["CI & Release" workflow](https://github.com/sanity-io/incompatible-plugin/actions/workflows/main.yml).
Make sure to select the main branch and check "Release new version".

Semantic release will only release on configured branches, so it is safe to run release on any branch.

---
_Source: https://npm.io/package/@sanity/incompatible-plugin · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
