Skip to content

Commit 7c3fdff

Browse files
committed
fix: included type of array item in script
1 parent 763146a commit 7c3fdff

2 files changed

Lines changed: 8 additions & 1 deletion

File tree

.changeset/wacky-animals-invite.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"sanity-plugin-internationalized-array": patch
3+
---
4+
5+
Object to Array Migration script update to match v5

plugins/sanity-plugin-internationalized-array/migrations/transformObjectToArray.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/* eslint-disable no-console */
22

3-
import {getCliClient} from 'sanity/cli'
43
import {randomKey} from '@sanity/util/content'
4+
import {getCliClient} from 'sanity/cli'
55

66
const client = getCliClient({apiVersion: '2023-06-30'})
77

@@ -45,6 +45,7 @@ const client = getCliClient({apiVersion: '2023-06-30'})
4545

4646
const TYPE = `presenter`
4747
const FIELD_NAME = `title`
48+
const ARRAY_ITEM_TYPE = `internationalizedArrayStringValue`
4849

4950
// 3. Run this script with:
5051
// `npx sanity@latest exec ./migrations/transformObjectToArray.ts --with-user-token`
@@ -68,6 +69,7 @@ const buildPatches = (docs: any[]) =>
6869
.filter((key) => key !== '_type')
6970
.map((key) => ({
7071
_key: randomKey(),
72+
_type: ARRAY_ITEM_TYPE,
7173
language: key,
7274
value: doc[FIELD_NAME][key],
7375
})),

0 commit comments

Comments
 (0)