New CLI Commands, Content Migration Tooling, Schema Validation, and Enhanced Localization & Validation Support
Published: January 31, 2024
Installation and upgrading
To initiate a new Sanity Studio without installing the CLI globally:
npm create sanity@latestpnpm create sanity@latestyarn create sanity@latestbun create sanity@latestTo upgrade a Sanity Studio, run this command in its folder:
npm install sanity@latestpnpm add sanity@latestyarn add sanity@latestbun add sanity@latest✨ Highlights
New CLI command sanity migration create|list|run
You can now create, list, and run content migrations from the Sanity CLI. The new tooling lets you scaffold content migrations as code and run them in dry and production mode. It also introduces a new API for defining content migration with helper functions (defineMigration()).
You can explore the documentation for schema and content migrations; or learn more by running the following CLI commands in a Sanity Studio project folder:
sanity migration --helpYou can run sanity migration create to explore our new content migration templates.
New CLI command: sanity schema validate
You can now validate a Sanity Studio schema with the CLI command sanity schema validate. Among other things, it will identify problems with your schema-type definitions. This tooling can be useful for running in CI/CD pipelines or debugging your schema configuration.
Learn more by running:
sanity schema validate ---helpOther features
- Adds Studio UI localization support to the comments plugin
- Adds support for validating dataset import and export files with
sanity documents validate - Adds
intentUrlinjsonandndjsonformats forsanity documents validate
Related documentation
Migrations CLI command reference
Create, list, and run content migrations
- Previous page
Documents CLI command reference
Interact with documents in your project
Schemas CLI command reference
List, validate, extract, and deploy schema.
Migrating your schema and content
How to migrate schema and content within a Sanity project
Content migration cheat sheet
Common content migration patterns that can be run by the Sanity CLI
Important considerations for schema and content migrations
How to derisk changes to your schema and plan for successful content migrations
CLI configuration
Wrangle datasets and webhooks, initialize plugin boilerplate code, build and deploy, all from the command line