Skip to content

Commit

Permalink
🔧 Modify #1756 script
Browse files Browse the repository at this point in the history
  • Loading branch information
fernandolucchesi committed Jan 23, 2024
1 parent da09bdf commit fadced9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sanityv3/scripts/issue-1756/aspectRatioDefaults.mjs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/* eslint-disable no-console */
import { sanityClients } from './getSanityClients.mjs'
import { getSanityClients as sanityClients } from '../run.js'

// Replace figure with fullWidthImage and set aspectRatio to 0.3
const fetchDocuments = (client) =>
client.fetch(
/* groq */ `*[_type in ['page','magazine'] && length(content[_type == 'fullWidthImage' && aspectRatio == null])>0][0..100]{ _id,"images":content[_type == 'fullWidthImage' && aspectRatio == 0.3]} `,
/* groq */ `*[_type in ['page','magazine'] && length(content[_type == 'fullWidthImage' && aspectRatio == null])>0][0..100]{ _id,"images":content[_type == 'fullWidthImage']} `,
)

const buildPatches = (docs) =>
Expand All @@ -14,7 +14,7 @@ const buildPatches = (docs) =>
id: doc._id,
patch: {
set: {
[`content[_key =="${image._key}"].aspectRatio`]: '0.3',
[`content[_key =="${image._key}"].aspectRatio`]: 0.3,
},
// this will cause the migration to fail if any of the documents has been
// modified since it was fetched.
Expand Down
1 change: 1 addition & 0 deletions sanityv3/scripts/run.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { getCliClient } from 'sanity/cli'

const DATASET_TARGET = ['global-development']

const RUN_SCRIPTS = ['issue-1832/index.mjs']

export const getSanityClients = DATASET_TARGET.map((dataset) => {
Expand Down

0 comments on commit fadced9

Please sign in to comment.