Unlock seamless workflows and faster delivery with our latest releases – get the details
Back to changelog

Sanity Studio update: Enhancements to Studio initialization and migration commands, and bugfix for image/file assets in structure lists

Installation and upgrading

To initiate a new Studio without installing the CLI globally:

npm create sanity@latest

To upgrade a v3 Studio, run this command in its folder:

npm install sanity@latest

✨ Highlights

  • The studio initialization command now allows you to specify a package manager with a flag in a single line. This was previously only possible to do via an interactive CLI prompt. You can now skip this step:
npm create sanity@latest --package-manager pnpm
  • The dryRun parameter is now available in the context provided for the defineMigration command available from sanity/migrate. This allows developers to write scripts that skip certain actions (for example, mutating external data stores) if it is only a dry run. An example might look like this:
import { defineMigration } from "sanity/migrate"

/**
 * Run this migration with
 * `npx sanity migration run my-migration`
 */
export default defineMigration({
  title: "my-migration",

  // pass whether the migration is a dry-run as context
  async *migrate(documents, { dryRun }) {
    for await (const document of documents()) {
      if(dryRun) {
        // Only log the effect
        console.log(`Something happened`)
      } else {
        // Execute the side-effect
        await thirdPartyRequest()
      }
      // ... do something with the document, maybe yield patches
    }
  },
})

🐛 Notable bugfixes

  • Fixes an issue where image/file assets would not be listed in Structure lists, even if specified to do so.

Documentation affected by this release

Published June 04, 2024