3

I didn't find a way to get client on Sanity v3 script. The old version was getting it from 'part:@sanity/base/client' and it doesn't work for v3.

Well, it's simple:

import { getCliClient } from 'sanity/cli';

const client = getCliClient().withConfig({ apiVersion: '2022-09-09' });

Then you can execute your script this way: node_modules/.bin/sanity exec path-to/my-script.js --with-user-token

0 Answers0