npm sanity 3.27.0
v3.27.0

latest releases: 2.36.6, 2.36.4, 3.63.0...
9 months ago

Installation and upgrading

To initiate a new Sanity Studio without installing the CLI globally:

npm create sanity@latest

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

npm install 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()).

We're still working out the documentation for schema and content migrations; early adopters can learn more by running the following CLI commands in a Sanity Studio project folder:

sanity migration --help

You 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 ---help

Other features

  • Adds Studio UI localization support to the comments plugin
  • Adds support for validating dataset import and export files with sanity documents validate
  • Adds intentUrl in json and ndjson formats for sanity documents validate

🐛 Notable bugfixes

  • Fixes a type issue where Rule.min and Rule.max did not allow strings
  • Fixes an issue where large documents would not duplicate correctly
  • Fixes an issue with date validation when using custom format for dates
  • Fixes typo in asset source string (thanks @kkupcin)
  • Fixes an where valid documents would be reported in sanity documents validate --format json
  • Fixes a bug that caused uses of Vite-like environment variables import.meta.env to break the mock browser environment used in the CLI.

📓 Full changelog

Author Message Commit
Rico Kahler fix(validation): update min and max to include string for dates (#5555) 881a991
Rico Kahler fix(core): wait for duplicate success before navigating (#5556) 088830d
Cody Olsen refactor: move babel config to jest config (#5562) fa3bf84
Tommy Petty bug(core): fix issue with date formatting in validation message (#5551) ab0dbe1
Cody Olsen fix(deps): update dependency @sanity/presentation to v1.6.1 68e6b07
ecospark[bot] chore(deps): dedupe yarn.lock (#5581) 974b601
Nina Andal Aarvik fix(comments): localize all strings (#5578) a7086f2
Rico Kahler feat(cli): support --file in sanity documents validate (#5580) 5cb4ea6
ecospark[bot] chore(deps): dedupe yarn.lock (#5588) ff3d625
Fred Carlsen chore(core): include user agent and screen density in telemetry calls (#5568) 8a166bd
Kornelija Kupcinskiene fix(i18n): spelling mistake in asset source string (#5575) 3a81d6b
Binoy Patel chore(cli): remove beta copy from documents validate command (#5589) c328dca
Nina Andal Aarvik fix(src): add textskeleton to loading state of mentions (#5587) 26cbae7
Binoy Patel fix(validation): filter system documents when running validation (#5590) d8c4a3f
Rico Kahler feat(cli): add new sanity schema validate command (#5583) 09cdb5f
renovate[bot] fix(deps): update dependency @sanity/client to ^6.12.3 (#5593) e6cad2e
renovate[bot] fix(deps): update dependency @sanity/presentation to v1.7.2 (#5596) 3650fb2
Bjørge Næss fix(studio): fallback to when logging installed plugins (#5602) 6df6ee5
renovate[bot] chore(deps): update dependency @sanity/ui to ^2.0.1 (#5594) b701756
Pedro Bonamin chore(deps): update dependency @sanity/ui to ^2.0.1 (#5607) dad3492
Rico Kahler feat(cli): add intentUrl to json and ndjson reporters (#5610) 71f9aed
Bjørge Næss feat(migrate): move into monorepo from poc fa86d63
Bjørge Næss test(migrate): make sure uint8array-extras package gets transpiled from esm 3b0e783
Bjørge Næss feat(cli): scaffold create/run migration cli commands 9495db7
Bjørge Næss fix(migrate): inline functions from uint8array-extras for now f379f40
Bjørge Næss feat: basic migration cli support 8304afc
Bjørge Næss feat: basic migrations list command ead9f3e
Bjørge Næss feat: migration create command w/templates 0a596e4
Bjørge Næss feat(sanity): add exports for sanity/migrate + sanity/migrate/mutations c4b19a4
Ash chore(migrate): add test script 4abe2bc
Ash test(migrate): add tests for parseJSON 1d39b78
Ash feat(migrate): add customisable parser and iterator type to parseJSON 5e8e666
Ash feat(migrate): add JSON parser that can handle chunks interrupted by an error object 74db2df
Bjørge Næss refactor(migrate): rename targets => destinations b730324
Ash feat(migrate): use safe JSON parser when streaming from Export HTTP API (#5542) a1c0faf
Bjørge Næss fix(util): fix package.json formatting 17e8130
Bjørge Næss feat(migrate): implement mutation batcher and use when submitting against mutate endpoint 1822dc2
Bjørge Næss feat(migrate): limit request concurrency a9bfef9
Bjørge Næss fix(migrate): workaround issue with p-map and ESM 7aaa5ed
Bjørge Næss feat(cli): allow user provided concurrency 2579159
Bjørge Næss feat(migration): improve progress as migration is running (#5550) 67aa5a9
Binoy Patel feat(migration): add a prompt before runing a real migration (#5552) 4ab2ac2
Binoy Patel feat(migration): support passing an array of documentTypes to migration (#5566) 458ac49
Binoy Patel chore(migration): add better error message when request fails (#5567) f1c2cd4
Bjørge Næss feat(migrate): add asyncIterableToStream util 0563e7b
Bjørge Næss feat(migrate): add bufferThroughFile utility ed7c904
Bjørge Næss fix(migrate): buffer exports through file dd47e2b
Bjørge Næss fix(cli): use dryRun from @sanity/migrate 4c2cab9
Bjørge Næss refactor(migrate): rename function 154483e
Bjørge Næss refactor(migrate): add ndjson support for both parsing and stringifying in ndjson util ec11092
Bjørge Næss refactor(sanity): remove mutiny dependency in favor of inlined creators 66bf826
Bjørge Næss fix(sanity): add --no-progress flag 24bc18f
Bjørge Næss fix(migrate): simplify bufferThroughFile 990fb50
Bjørge Næss feat(migrate): unify contexts, add support for document lookup and query during a migration 3a54e20
Bjørge Næss fix(dev): fix example migration script imports 5381f34
Binoy Patel feat(migration): support async hooks in migration nodes (#5564) cc6b2f3
Bjørge Næss fix(sanity): use --no-dry instead of --dry=false ba905dc
Bjørge Næss feat(migrate): add support for yielding transactions 0a58fa3
Bjørge Næss fix(migrate): minor typing issue 663da91
Bjørge Næss fix(sanity): polish cli and migration templates 027ad47
Bjørge Næss chore(deps): remove unused deps 2e61bd5
Bjørge Næss fix(sanity): fix quoting of documentTypes in migration templates 8a5f67b
Bjørge Næss fix(sanity): rename migration name => title 27b0088
Bjørge Næss fix(migrate): run migration against all documents if documentTypes is omitted e80bbdf
Binoy Patel fix(migration): fixes dry run not showing any information 2568666
Binoy Patel fix(migration): show proper error message when the file has code issues 7256f85
Bjørge Næss fix(migrate): various naming consistency fixes dbb7048
Bjørge Næss fix(sanity): add a few examples to help text for 'sanity migration create' 8290bae
Bjørge Næss fix(sanity): improve error handling on 'sanity migration run' without id 5d9a556
Bjørge Næss fix(migrate): fix error asserting transaction df310cf
Bjørge Næss fix(migrate): use transactionId instead of id on mutation payload a82df02
Ash feat(cli): add pretty mutation formatting to migration runner (#5573) 2dba206
Bjørge Næss chore(migrate): instrument with some debug logging 79c5e12
Bjørge Næss refactor(migration): move filtered document methods to a separate filtered-context key, add a client with limited concurrency to migration context 81e4309
Bjørge Næss fix(migrate): add request tags and user agent f22aa0c
Bjørge Næss fix(sanity): improve minimal example 2e77de7
Binoy Patel chore(migration): remove from-export flag from migration cli (#5611) b2a94ff
Binoy Patel chore(migration): remove query from migration context (#5612) ae7105a
Binoy Patel chore(migration): change dry command to dry-run (#5613) 81eb846
Bjørge Næss fix(migrate): limit client methods during migration 13de5a2
Binoy Patel fix(migration): parse cli arguments so the types are proper (#5616) 7751df1
Bjørge Næss fix(migrate): cleanup buffer file after read (#5618) 387945c
Bjørge Næss fix(migrate): remove mkdirp in favor of node:fs (#5619) 338bf26
Rico Kahler fix(cli): add support for import.meta.env (#5617) 083ff16
Bjørge Næss fix(migrate): scope node path to the current node (#5620) 93f82d2

Don't miss a new sanity release

NewReleases is sending notifications on new releases.