Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

@sanity/incompatible-plugin

sanity-io409.3kMIT1.0.5TypeScript support: included

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

sanity, sanity-plugin

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

npm i @sanity/incompatible-plugin

or

yarn add @sanity/incompatible-plugin

Usage

In your plugin root directory, create two files:

v2-incompatible.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

{
  "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:

{
  "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. 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.

changelog

📓 Changelog

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

1.0.5 (2024-12-16)

Bug Fixes

1.0.4 (2022-10-07)

Bug Fixes

  • rewritten for minimal dependencies: no more sanity/ui or styled-components (7cbfb01)

1.0.3 (2022-09-28)

Bug Fixes

1.0.2 (2022-09-28)

Bug Fixes

  • add package json metadata (9a65590)
  • declare @reach/auto-id as a dependency (dd3baf8)
  • improve peerDependencies (b4910a0)
  • update doc links (dc59930)

1.0.1 (2022-09-09)

Bug Fixes

  • deps: update dependencies (non-major) (#5) (7e8d196)
  • deps: updated sanity ui (9e04b5f)

1.0.0 (2022-08-17)

Bug Fixes

  • add @sanity/semantic-release-preset (928b5e5)