diff --git a/packages/@sanity/cli/.eslintignore b/packages/@sanity/cli/.eslintignore index 0ecf9ccdd89..47de67274b3 100644 --- a/packages/@sanity/cli/.eslintignore +++ b/packages/@sanity/cli/.eslintignore @@ -1,3 +1,2 @@ # package specific /templates -/test/test-template diff --git a/packages/@sanity/cli/src/util/remoteTemplate.ts b/packages/@sanity/cli/src/util/remoteTemplate.ts index 8a2421c5a9d..648c42344b6 100644 --- a/packages/@sanity/cli/src/util/remoteTemplate.ts +++ b/packages/@sanity/cli/src/util/remoteTemplate.ts @@ -233,15 +233,17 @@ export async function applyEnvVariables( value: string, useQuotes: boolean, ) => { - const pattern = varRegex instanceof RegExp ? varRegex : new RegExp(`${varRegex}=.*$`, 'gm') - const match = content.match(pattern) - if (!match) return content - - const varName = match[0].split('=')[0] - return content.replace( - new RegExp(`${varName}=.*$`, 'gm'), - `${varName}=${useQuotes ? `"${value}"` : value}`, - ) + const varPattern = typeof varRegex === 'string' ? varRegex : varRegex.source + const pattern = new RegExp(`.*${varPattern}=.*$`, 'gm') + const matches = content.matchAll(pattern) + return Array.from(matches).reduce((updatedContent, match) => { + if (!match[0]) return updatedContent + const varName = match[0].split('=')[0].trim() + return updatedContent.replace( + new RegExp(`${varName}=.*$`, 'gm'), + `${varName}=${useQuotes ? `"${value}"` : value}`, + ) + }, content) } let envContent = templateContent diff --git a/packages/@sanity/cli/test/__fixtures__/remote-template/.env.local.example b/packages/@sanity/cli/test/__fixtures__/remote-template/.env.local.example new file mode 100644 index 00000000000..51c5ccb7e99 --- /dev/null +++ b/packages/@sanity/cli/test/__fixtures__/remote-template/.env.local.example @@ -0,0 +1,5 @@ +NEXT_PUBLIC_SANITY_PROJECT_ID= +SANITY_STUDIO_PROJECT_ID= + +NEXT_PUBLIC_SANITY_DATASET= +SANITY_STUDIO_DATASET= diff --git a/packages/@sanity/cli/test/__fixtures__/remote-template/README.md b/packages/@sanity/cli/test/__fixtures__/remote-template/README.md new file mode 100644 index 00000000000..0475b41d48a --- /dev/null +++ b/packages/@sanity/cli/test/__fixtures__/remote-template/README.md @@ -0,0 +1 @@ +This is a test template solely for the purpose of testing the `init --template` command when using remote templates. diff --git a/packages/@sanity/cli/test/__fixtures__/remote-template/next.config.ts b/packages/@sanity/cli/test/__fixtures__/remote-template/next.config.ts new file mode 100644 index 00000000000..b0df3743d0c --- /dev/null +++ b/packages/@sanity/cli/test/__fixtures__/remote-template/next.config.ts @@ -0,0 +1,7 @@ +import {type NextConfig} from 'next' + +const nextConfig: NextConfig = { + /* config options here */ +} + +export default nextConfig diff --git a/packages/@sanity/cli/test/__fixtures__/remote-template/package.json b/packages/@sanity/cli/test/__fixtures__/remote-template/package.json new file mode 100644 index 00000000000..0ff42d6f64f --- /dev/null +++ b/packages/@sanity/cli/test/__fixtures__/remote-template/package.json @@ -0,0 +1,13 @@ +{ + "name": "test-template", + "version": "1.0.0", + "main": "package.json", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "dependencies": { + "next": "^15", + "next-sanity": "^9", + "sanity": "^3" + } +} diff --git a/packages/@sanity/cli/test/__fixtures__/remote-template/sanity.cli.ts b/packages/@sanity/cli/test/__fixtures__/remote-template/sanity.cli.ts new file mode 100644 index 00000000000..824b4032abc --- /dev/null +++ b/packages/@sanity/cli/test/__fixtures__/remote-template/sanity.cli.ts @@ -0,0 +1,8 @@ +import {defineCliConfig} from 'sanity/cli' + +export default defineCliConfig({ + api: { + projectId: process.env.SANITY_STUDIO_PROJECT_ID, + dataset: process.env.SANITY_STUDIO_DATASET, + }, +}) diff --git a/packages/@sanity/cli/test/__fixtures__/remote-template/sanity.config.ts b/packages/@sanity/cli/test/__fixtures__/remote-template/sanity.config.ts new file mode 100644 index 00000000000..ddbc5e56399 --- /dev/null +++ b/packages/@sanity/cli/test/__fixtures__/remote-template/sanity.config.ts @@ -0,0 +1,13 @@ +import {defineConfig} from 'sanity' +import {structureTool} from 'sanity/structure' + +export default defineConfig({ + name: 'sanity-template-astro-clean', + title: 'Sanity Astro Starter', + projectId: process.env.SANITY_STUDIO_PROJECT_ID, + dataset: process.env.SANITY_STUDIO_DATASET, + plugins: [structureTool()], + schema: { + types: [], + }, +}) diff --git a/packages/@sanity/cli/test/init.test.ts b/packages/@sanity/cli/test/init.test.ts index 06722a8eae9..08ec7960886 100644 --- a/packages/@sanity/cli/test/init.test.ts +++ b/packages/@sanity/cli/test/init.test.ts @@ -106,7 +106,7 @@ describeCliTest('CLI: `sanity init v3`', () => { '--dataset', testRunArgs.dataset, '--template', - 'sanity-io/sanity/packages/@sanity/cli/test/test-template', + 'sanity-io/sanity/packages/@sanity/cli/test/__fixtures__/remote-template', '--output-path', `${baseTestPath}/${outpath}`, '--package-manager', @@ -145,7 +145,7 @@ describeCliTest('CLI: `sanity init v3`', () => { '--dataset', testRunArgs.dataset, '--template', - 'https://github.com/sanity-io/sanity/tree/next/packages/@sanity/cli/test/test-template', + 'https://github.com/sanity-io/sanity/tree/next/packages/@sanity/cli/test/__fixtures__/remote-template', '--output-path', `${baseTestPath}/${outpath}`, '--package-manager', @@ -183,7 +183,7 @@ describeCliTest('CLI: `sanity init v3`', () => { '--dataset', testRunArgs.dataset, '--template', - 'sanity-io/sanity/packages/@sanity/cli/test/test-template', + 'sanity-io/sanity/packages/@sanity/cli/test/__fixtures__/remote-template', '--output-path', `${baseTestPath}/${outpath}`, '--package-manager', @@ -192,8 +192,10 @@ describeCliTest('CLI: `sanity init v3`', () => { const envContent = await fs.readFile(path.join(baseTestPath, outpath, '.env.local'), 'utf-8') - expect(envContent).toContain(`SANITY_PROJECT_ID=${cliProjectId}`) - expect(envContent).toContain(`SANITY_DATASET=${testRunArgs.dataset}`) + expect(envContent).toContain(`NEXT_PUBLIC_SANITY_PROJECT_ID=${cliProjectId}`) + expect(envContent).toContain(`SANITY_STUDIO_PROJECT_ID=${cliProjectId}`) + expect(envContent).toContain(`NEXT_PUBLIC_SANITY_DATASET=${testRunArgs.dataset}`) + expect(envContent).toContain(`SANITY_STUDIO_DATASET=${testRunArgs.dataset}`) }) testConcurrent('fails with invalid repository format', async () => { diff --git a/packages/@sanity/cli/test/test-template/.env.local.example b/packages/@sanity/cli/test/test-template/.env.local.example deleted file mode 100644 index abae22560ac..00000000000 --- a/packages/@sanity/cli/test/test-template/.env.local.example +++ /dev/null @@ -1,3 +0,0 @@ -# https://github.com/vercel/next.js/tree/canary/examples/cms-sanity#using-the-sanity-cli -NEXT_PUBLIC_SANITY_PROJECT_ID= -NEXT_PUBLIC_SANITY_DATASET= diff --git a/packages/@sanity/cli/test/test-template/.eslintignore b/packages/@sanity/cli/test/test-template/.eslintignore deleted file mode 100644 index 30764a1a839..00000000000 --- a/packages/@sanity/cli/test/test-template/.eslintignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignoring generated files -./sanity.types.ts diff --git a/packages/@sanity/cli/test/test-template/.eslintrc b/packages/@sanity/cli/test/test-template/.eslintrc deleted file mode 100644 index 7c1a3addbd4..00000000000 --- a/packages/@sanity/cli/test/test-template/.eslintrc +++ /dev/null @@ -1,4 +0,0 @@ -{ - "extends": "next/core-web-vitals", - "root": true -} diff --git a/packages/@sanity/cli/test/test-template/.gitignore b/packages/@sanity/cli/test/test-template/.gitignore deleted file mode 100644 index d449ea2fa95..00000000000 --- a/packages/@sanity/cli/test/test-template/.gitignore +++ /dev/null @@ -1,42 +0,0 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/studio/node_modules -/.pnp -.pnp.js -.yarn/install-state.gz - -# testing -/coverage - -# next.js -/.next/ -/out/ - -# sanity -/.sanity/ -/dist/ - -# misc -.DS_Store -*.pem - -# debug -npm-debug.log* -yarn-debug.log* -yarn-error.log* - -# local env files -.env*.local - -# vercel -.vercel - -# typescript -*.tsbuildinfo -next-env.d.ts - -# Env files created by scripts for working locally -.env -.env.local \ No newline at end of file diff --git a/packages/@sanity/cli/test/test-template/.prettierignore b/packages/@sanity/cli/test/test-template/.prettierignore deleted file mode 100644 index 1509c4cdb7a..00000000000 --- a/packages/@sanity/cli/test/test-template/.prettierignore +++ /dev/null @@ -1,3 +0,0 @@ -# Ignoring generated files -./sanity.types.ts -./schema.json diff --git a/packages/@sanity/cli/test/test-template/README.md b/packages/@sanity/cli/test/test-template/README.md deleted file mode 100644 index 6e45bf98f2e..00000000000 --- a/packages/@sanity/cli/test/test-template/README.md +++ /dev/null @@ -1,4 +0,0 @@ -This is a test template solely for the purpose of testing the `init --template` command when using remote templates. - -It is a fork of the officially maintained template at: -https://github.com/vercel/next.js/tree/canary/examples/cms-sanity diff --git a/packages/@sanity/cli/test/test-template/app/(blog)/actions.ts b/packages/@sanity/cli/test/test-template/app/(blog)/actions.ts deleted file mode 100644 index 0263a84602a..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(blog)/actions.ts +++ /dev/null @@ -1,12 +0,0 @@ -'use server' - -import {draftMode} from 'next/headers' - -export async function disableDraftMode() { - 'use server' - await Promise.allSettled([ - (await draftMode()).disable(), - // Simulate a delay to show the loading state - new Promise((resolve) => setTimeout(resolve, 1000)), - ]) -} diff --git a/packages/@sanity/cli/test/test-template/app/(blog)/alert-banner.tsx b/packages/@sanity/cli/test/test-template/app/(blog)/alert-banner.tsx deleted file mode 100644 index f6cc701714f..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(blog)/alert-banner.tsx +++ /dev/null @@ -1,52 +0,0 @@ -'use client' - -import {useRouter} from 'next/navigation' -import {useSyncExternalStore, useTransition} from 'react' - -import {disableDraftMode} from './actions' - -const emptySubscribe = () => () => {} - -export default function AlertBanner() { - const router = useRouter() - const [pending, startTransition] = useTransition() - - const shouldShow = useSyncExternalStore( - emptySubscribe, - () => window.top === window, - () => false - ) - - if (!shouldShow) return null - - return ( -
-
- {pending ? ( - 'Disabling draft mode...' - ) : ( - <> - {'Previewing drafts. '} - - - )} -
-
- ) -} diff --git a/packages/@sanity/cli/test/test-template/app/(blog)/avatar.tsx b/packages/@sanity/cli/test/test-template/app/(blog)/avatar.tsx deleted file mode 100644 index 30ca8a51811..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(blog)/avatar.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import {Image} from 'next-sanity/image' - -import type {Author} from '@/sanity.types' -import {urlForImage} from '@/sanity/lib/utils' - -interface Props { - name: string - picture: Exclude | null -} - -export default function Avatar({name, picture}: Props) { - return ( -
- {picture?.asset?._ref ? ( -
- {picture?.alt -
- ) : ( -
By
- )} -
{name}
-
- ) -} diff --git a/packages/@sanity/cli/test/test-template/app/(blog)/cover-image.tsx b/packages/@sanity/cli/test/test-template/app/(blog)/cover-image.tsx deleted file mode 100644 index 6d393eb0e96..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(blog)/cover-image.tsx +++ /dev/null @@ -1,31 +0,0 @@ -import {Image} from 'next-sanity/image' - -import {urlForImage} from '@/sanity/lib/utils' - -interface CoverImageProps { - image: any - priority?: boolean -} - -export default function CoverImage(props: CoverImageProps) { - const {image: source, priority} = props - const image = source?.asset?._ref ? ( - {source?.alt - ) : ( -
- ) - - return ( -
- {image} -
- ) -} diff --git a/packages/@sanity/cli/test/test-template/app/(blog)/date.tsx b/packages/@sanity/cli/test/test-template/app/(blog)/date.tsx deleted file mode 100644 index 7b65187705e..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(blog)/date.tsx +++ /dev/null @@ -1,5 +0,0 @@ -import {format} from 'date-fns' - -export default function DateComponent({dateString}: {dateString: string}) { - return -} diff --git a/packages/@sanity/cli/test/test-template/app/(blog)/layout.tsx b/packages/@sanity/cli/test/test-template/app/(blog)/layout.tsx deleted file mode 100644 index 933b369e5f6..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(blog)/layout.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import '../globals.css' - -import {SpeedInsights} from '@vercel/speed-insights/next' -import type {Metadata} from 'next' -import {VisualEditing, toPlainText, type PortableTextBlock} from 'next-sanity' -import {Inter} from 'next/font/google' -import {draftMode} from 'next/headers' - -import AlertBanner from './alert-banner' -import PortableText from './portable-text' - -import * as demo from '@/sanity/lib/demo' -import {sanityFetch} from '@/sanity/lib/fetch' -import {settingsQuery} from '@/sanity/lib/queries' -import {resolveOpenGraphImage} from '@/sanity/lib/utils' - -export async function generateMetadata(): Promise { - const settings = await sanityFetch({ - query: settingsQuery, - // Metadata should never contain stega - stega: false, - }) - const title = settings?.title || demo.title - const description = settings?.description || demo.description - - const ogImage = resolveOpenGraphImage(settings?.ogImage) - let metadataBase: URL | undefined = undefined - try { - metadataBase = settings?.ogImage?.metadataBase - ? new URL(settings.ogImage.metadataBase) - : undefined - } catch { - // ignore - } - return { - metadataBase, - title: { - template: `%s | ${title}`, - default: title, - }, - description: toPlainText(description), - openGraph: { - images: ogImage ? [ogImage] : [], - }, - } -} - -const inter = Inter({ - variable: '--font-inter', - subsets: ['latin'], - display: 'swap', -}) - -export default async function RootLayout({children}: {children: React.ReactNode}) { - const data = await sanityFetch({query: settingsQuery}) - const footer = data?.footer || [] - const {isEnabled: isDraftMode} = await draftMode() - - return ( - - -
- {isDraftMode && } -
{children}
- -
- {isDraftMode && } - - - - ) -} diff --git a/packages/@sanity/cli/test/test-template/app/(blog)/more-stories.tsx b/packages/@sanity/cli/test/test-template/app/(blog)/more-stories.tsx deleted file mode 100644 index 2c0378e3e8f..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(blog)/more-stories.tsx +++ /dev/null @@ -1,39 +0,0 @@ -import Link from 'next/link' - -import Avatar from './avatar' -import CoverImage from './cover-image' -import DateComponent from './date' - -import {sanityFetch} from '@/sanity/lib/fetch' -import {moreStoriesQuery} from '@/sanity/lib/queries' - -export default async function MoreStories(params: {skip: string; limit: number}) { - const data = await sanityFetch({query: moreStoriesQuery, params}) - - return ( - <> -
- {data?.map((post) => { - const {_id, title, slug, coverImage, excerpt, author} = post - return ( -
- - - -

- - {title} - -

-
- -
- {excerpt &&

{excerpt}

} - {author && } -
- ) - })} -
- - ) -} diff --git a/packages/@sanity/cli/test/test-template/app/(blog)/onboarding.tsx b/packages/@sanity/cli/test/test-template/app/(blog)/onboarding.tsx deleted file mode 100644 index 9f4153bd9de..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(blog)/onboarding.tsx +++ /dev/null @@ -1,71 +0,0 @@ -'use client' - -/** - * This file is used for onboarding when you don't have any posts yet and are using the template for the first time. - * Once you have content, and know where to go to access the Sanity Studio and create content, you can delete this file. - */ - -import Link from 'next/link' -import {useSyncExternalStore} from 'react' - -const emptySubscribe = () => () => {} - -export default function Onboarding() { - const target = useSyncExternalStore( - emptySubscribe, - () => (window.top === window ? undefined : '_blank'), - () => '_blank' - ) - - return ( -
- -
-

No posts

-

Get started by creating a new post.

-
- -
- - - Create Post - -
-
- ) -} diff --git a/packages/@sanity/cli/test/test-template/app/(blog)/page.tsx b/packages/@sanity/cli/test/test-template/app/(blog)/page.tsx deleted file mode 100644 index 2438886c89f..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(blog)/page.tsx +++ /dev/null @@ -1,105 +0,0 @@ -import Link from 'next/link' -import {Suspense} from 'react' - -import Avatar from './avatar' -import CoverImage from './cover-image' -import DateComponent from './date' -import MoreStories from './more-stories' -import Onboarding from './onboarding' -import PortableText from './portable-text' - -import type {HeroQueryResult} from '@/sanity.types' -import * as demo from '@/sanity/lib/demo' -import {sanityFetch} from '@/sanity/lib/fetch' -import {heroQuery, settingsQuery} from '@/sanity/lib/queries' - -function Intro(props: {title: string | null | undefined; description: any}) { - const title = props.title || demo.title - const description = props.description?.length ? props.description : demo.description - return ( -
-

- {title || demo.title} -

-

- -

-
- ) -} - -function HeroPost({ - title, - slug, - excerpt, - coverImage, - date, - author, -}: Pick< - Exclude, - 'title' | 'coverImage' | 'date' | 'excerpt' | 'author' | 'slug' ->) { - return ( -
- - - -
-
-

- - {title} - -

-
- -
-
-
- {excerpt &&

{excerpt}

} - {author && } -
-
-
- ) -} - -export default async function Page() { - const [settings, heroPost] = await Promise.all([ - sanityFetch({ - query: settingsQuery, - }), - sanityFetch({query: heroQuery}), - ]) - - return ( -
- - {heroPost ? ( - - ) : ( - - )} - {heroPost?._id && ( - - )} -
- ) -} diff --git a/packages/@sanity/cli/test/test-template/app/(blog)/portable-text.tsx b/packages/@sanity/cli/test/test-template/app/(blog)/portable-text.tsx deleted file mode 100644 index 0d8ae8b90d7..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(blog)/portable-text.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/** - * This component uses Portable Text to render a post body. - * - * You can learn more about Portable Text on: - * https://www.sanity.io/docs/block-content - * https://github.com/portabletext/react-portabletext - * https://portabletext.org/ - * - */ - -import {PortableText, type PortableTextComponents, type PortableTextBlock} from 'next-sanity' - -export default function CustomPortableText({ - className, - value, -}: { - className?: string - value: PortableTextBlock[] -}) { - const components: PortableTextComponents = { - block: { - h5: ({children}) =>
{children}
, - h6: ({children}) =>
{children}
, - }, - marks: { - link: ({children, value}) => { - return ( - - {children} - - ) - }, - }, - } - - return ( -
- -
- ) -} diff --git a/packages/@sanity/cli/test/test-template/app/(blog)/posts/[slug]/page.tsx b/packages/@sanity/cli/test/test-template/app/(blog)/posts/[slug]/page.tsx deleted file mode 100644 index c18539794ac..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(blog)/posts/[slug]/page.tsx +++ /dev/null @@ -1,107 +0,0 @@ -import {defineQuery} from 'next-sanity' -import type {Metadata, ResolvingMetadata} from 'next' -import {type PortableTextBlock} from 'next-sanity' -import Link from 'next/link' -import {notFound} from 'next/navigation' -import {Suspense} from 'react' - -import Avatar from '../../avatar' -import CoverImage from '../../cover-image' -import DateComponent from '../../date' -import MoreStories from '../../more-stories' -import PortableText from '../../portable-text' - -import * as demo from '@/sanity/lib/demo' -import {sanityFetch} from '@/sanity/lib/fetch' -import {postQuery, settingsQuery} from '@/sanity/lib/queries' -import {resolveOpenGraphImage} from '@/sanity/lib/utils' - -type Props = { - params: Promise<{slug: string}> -} - -const postSlugs = defineQuery(`*[_type == "post" && defined(slug.current)]{"slug": slug.current}`) - -export async function generateStaticParams() { - return await sanityFetch({ - query: postSlugs, - perspective: 'published', - stega: false, - }) -} - -export async function generateMetadata( - {params}: Props, - parent: ResolvingMetadata -): Promise { - const post = await sanityFetch({ - query: postQuery, - params, - stega: false, - }) - const previousImages = (await parent).openGraph?.images || [] - const ogImage = resolveOpenGraphImage(post?.coverImage) - - return { - authors: post?.author?.name ? [{name: post?.author?.name}] : [], - title: post?.title, - description: post?.excerpt, - openGraph: { - images: ogImage ? [ogImage, ...previousImages] : previousImages, - }, - } satisfies Metadata -} - -export default async function PostPage({params}: Props) { - const [post, settings] = await Promise.all([ - sanityFetch({query: postQuery, params}), - sanityFetch({query: settingsQuery}), - ]) - - if (!post?._id) { - return notFound() - } - - return ( -
-

- - {settings?.title || demo.title} - -

-
-

- {post.title} -

-
- {post.author && } -
-
- -
-
-
- {post.author && } -
-
-
- -
-
-
- {post.content?.length && ( - - )} -
- -
- ) -} diff --git a/packages/@sanity/cli/test/test-template/app/(sanity)/apple-icon.png b/packages/@sanity/cli/test/test-template/app/(sanity)/apple-icon.png deleted file mode 100644 index bc571d60bf6..00000000000 Binary files a/packages/@sanity/cli/test/test-template/app/(sanity)/apple-icon.png and /dev/null differ diff --git a/packages/@sanity/cli/test/test-template/app/(sanity)/icon.ico b/packages/@sanity/cli/test/test-template/app/(sanity)/icon.ico deleted file mode 100644 index 3f67d3e8e86..00000000000 Binary files a/packages/@sanity/cli/test/test-template/app/(sanity)/icon.ico and /dev/null differ diff --git a/packages/@sanity/cli/test/test-template/app/(sanity)/icon.png b/packages/@sanity/cli/test/test-template/app/(sanity)/icon.png deleted file mode 100644 index 6320b50010d..00000000000 Binary files a/packages/@sanity/cli/test/test-template/app/(sanity)/icon.png and /dev/null differ diff --git a/packages/@sanity/cli/test/test-template/app/(sanity)/icon.svg b/packages/@sanity/cli/test/test-template/app/(sanity)/icon.svg deleted file mode 100644 index 1beaa9b7579..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(sanity)/icon.svg +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/packages/@sanity/cli/test/test-template/app/(sanity)/layout.tsx b/packages/@sanity/cli/test/test-template/app/(sanity)/layout.tsx deleted file mode 100644 index d1d13629c68..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(sanity)/layout.tsx +++ /dev/null @@ -1,19 +0,0 @@ -import '../globals.css' - -import {Inter} from 'next/font/google' - -const inter = Inter({ - variable: '--font-inter', - subsets: ['latin'], - display: 'swap', -}) - -export {metadata, viewport} from 'next-sanity/studio' - -export default function RootLayout({children}: {children: React.ReactNode}) { - return ( - - {children} - - ) -} diff --git a/packages/@sanity/cli/test/test-template/app/(sanity)/studio/[[...tool]]/page.tsx b/packages/@sanity/cli/test/test-template/app/(sanity)/studio/[[...tool]]/page.tsx deleted file mode 100644 index 9f98c539da2..00000000000 --- a/packages/@sanity/cli/test/test-template/app/(sanity)/studio/[[...tool]]/page.tsx +++ /dev/null @@ -1,9 +0,0 @@ -import {NextStudio} from 'next-sanity/studio' - -import config from '@/sanity.config' - -export const dynamic = 'force-static' - -export default function StudioPage() { - return -} diff --git a/packages/@sanity/cli/test/test-template/app/api/draft-mode/enable/route.ts b/packages/@sanity/cli/test/test-template/app/api/draft-mode/enable/route.ts deleted file mode 100644 index d9d04445f11..00000000000 --- a/packages/@sanity/cli/test/test-template/app/api/draft-mode/enable/route.ts +++ /dev/null @@ -1,8 +0,0 @@ -import {defineEnableDraftMode} from 'next-sanity/draft-mode' - -import {client} from '@/sanity/lib/client' -import {token} from '@/sanity/lib/token' - -export const {GET} = defineEnableDraftMode({ - client: client.withConfig({token}), -}) diff --git a/packages/@sanity/cli/test/test-template/app/favicon.ico b/packages/@sanity/cli/test/test-template/app/favicon.ico deleted file mode 100644 index af98450595e..00000000000 Binary files a/packages/@sanity/cli/test/test-template/app/favicon.ico and /dev/null differ diff --git a/packages/@sanity/cli/test/test-template/app/globals.css b/packages/@sanity/cli/test/test-template/app/globals.css deleted file mode 100644 index b5c61c95671..00000000000 --- a/packages/@sanity/cli/test/test-template/app/globals.css +++ /dev/null @@ -1,3 +0,0 @@ -@tailwind base; -@tailwind components; -@tailwind utilities; diff --git a/packages/@sanity/cli/test/test-template/next.config.ts b/packages/@sanity/cli/test/test-template/next.config.ts deleted file mode 100644 index 451313c0a5a..00000000000 --- a/packages/@sanity/cli/test/test-template/next.config.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type {NextConfig} from 'next' - -const nextConfig: NextConfig = { - env: { - // Matches the behavior of `sanity dev` which sets styled-components to use the fastest way of inserting CSS rules in both dev and production. It's default behavior is to disable it in dev mode. - SC_DISABLE_SPEEDY: 'false', - }, -} - -export default nextConfig diff --git a/packages/@sanity/cli/test/test-template/package.json b/packages/@sanity/cli/test/test-template/package.json deleted file mode 100644 index 10c11e12cf4..00000000000 --- a/packages/@sanity/cli/test/test-template/package.json +++ /dev/null @@ -1,45 +0,0 @@ -{ - "private": true, - "scripts": { - "prebuild": "npm run typegen", - "build": "next build", - "predev": "npm run typegen", - "dev": "next --turbo", - "lint": "next lint", - "presetup": "echo 'about to setup env variables, follow the guide here: https://github.com/vercel/next.js/tree/canary/examples/cms-sanity#using-the-sanity-cli'", - "setup": "npx sanity@latest init --env .env.local", - "postsetup": "echo 'create the read token by following the rest of the guide: https://github.com/vercel/next.js/tree/canary/examples/cms-sanity#creating-a-read-token'", - "start": "next start", - "typegen": "sanity schema extract && sanity typegen generate" - }, - "dependencies": { - "@sanity/assist": "^3.0.8", - "@sanity/icons": "^3.5.7", - "@sanity/image-url": "^1.0.2", - "@sanity/preview-url-secret": "^2.0.0", - "@sanity/vision": "^3.62.0", - "@tailwindcss/typography": "^0.5.15", - "@types/node": "^22.7.8", - "@types/react": "^19.0.3", - "@types/react-dom": "^19.0.2", - "@vercel/speed-insights": "^1.0.13", - "autoprefixer": "^10.4.20", - "date-fns": "^4.1.0", - "next": "^15.0.0", - "next-sanity": "^9.7.0", - "postcss": "^8.4.47", - "react": "^18.3.1", - "react-dom": "^18.3.1", - "sanity": "^3.62.0", - "sanity-plugin-asset-source-unsplash": "^3.0.1", - "server-only": "^0.0.1", - "styled-components": "^6.1.13", - "tailwindcss": "^3.4.14", - "typescript": "5.7.3" - }, - "devDependencies": { - "eslint": "^9.13.0", - "eslint-config-next": "^15.0.0" - } -} - diff --git a/packages/@sanity/cli/test/test-template/postcss.config.js b/packages/@sanity/cli/test/test-template/postcss.config.js deleted file mode 100644 index 33ad091d26d..00000000000 --- a/packages/@sanity/cli/test/test-template/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -} diff --git a/packages/@sanity/cli/test/test-template/sanity.cli.ts b/packages/@sanity/cli/test/test-template/sanity.cli.ts deleted file mode 100644 index 481d2b2b505..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity.cli.ts +++ /dev/null @@ -1,19 +0,0 @@ -import {defineCliConfig} from 'sanity/cli' - -const projectId = process.env.NEXT_PUBLIC_SANITY_PROJECT_ID -const dataset = process.env.NEXT_PUBLIC_SANITY_DATASET - -export default defineCliConfig({ - api: {projectId, dataset}, - vite: { - define: { - 'process.env.NEXT_PUBLIC_SANITY_PROJECT_ID': JSON.stringify(projectId), - 'process.env.NEXT_PUBLIC_SANITY_DATASET': JSON.stringify(dataset), - }, - resolve: { - alias: { - '@': __dirname, - }, - }, - }, -}) diff --git a/packages/@sanity/cli/test/test-template/sanity.config.ts b/packages/@sanity/cli/test/test-template/sanity.config.ts deleted file mode 100644 index af5be2c66c1..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity.config.ts +++ /dev/null @@ -1,88 +0,0 @@ -'use client' -/** - * This config is used to set up Sanity Studio that's mounted on the `app/(sanity)/studio/[[...tool]]/page.tsx` route - */ -import {visionTool} from '@sanity/vision' -import {PluginOptions, defineConfig} from 'sanity' -import {unsplashImageAsset} from 'sanity-plugin-asset-source-unsplash' -import { - presentationTool, - defineDocuments, - defineLocations, - type DocumentLocation, -} from 'sanity/presentation' -import {structureTool} from 'sanity/structure' - -import {apiVersion, dataset, projectId, studioUrl} from '@/sanity/lib/api' -import {pageStructure, singletonPlugin} from '@/sanity/plugins/settings' -import {assistWithPresets} from '@/sanity/plugins/assist' -import author from '@/sanity/schemas/documents/author' -import post from '@/sanity/schemas/documents/post' -import settings from '@/sanity/schemas/singletons/settings' -import {resolveHref} from '@/sanity/lib/utils' - -const homeLocation = { - title: 'Home', - href: '/', -} satisfies DocumentLocation - -export default defineConfig({ - basePath: studioUrl, - projectId, - dataset, - schema: { - types: [ - // Singletons - settings, - // Documents - post, - author, - ], - }, - plugins: [ - presentationTool({ - resolve: { - mainDocuments: defineDocuments([ - { - route: '/posts/:slug', - filter: `_type == "post" && slug.current == $slug`, - }, - ]), - locations: { - settings: defineLocations({ - locations: [homeLocation], - message: 'This document is used on all pages', - tone: 'caution', - }), - post: defineLocations({ - select: { - title: 'title', - slug: 'slug.current', - }, - resolve: (doc) => ({ - locations: [ - { - title: doc?.title || 'Untitled', - href: resolveHref('post', doc?.slug)!, - }, - homeLocation, - ], - }), - }), - }, - }, - previewUrl: {previewMode: {enable: '/api/draft-mode/enable'}}, - }), - structureTool({structure: pageStructure([settings])}), - // Configures the global "new document" button, and document actions, to suit the Settings document singleton - singletonPlugin([settings.name]), - // Add an image asset source for Unsplash - unsplashImageAsset(), - // Sets up AI Assist with preset prompts - // https://www.sanity.io/docs/ai-assist - assistWithPresets(), - // Vision lets you query your content with GROQ in the studio - // https://www.sanity.io/docs/the-vision-plugin - process.env.NODE_ENV === 'development' && visionTool({defaultApiVersion: apiVersion}), - ].filter(Boolean) as PluginOptions[], -}) diff --git a/packages/@sanity/cli/test/test-template/sanity.types.ts b/packages/@sanity/cli/test/test-template/sanity.types.ts deleted file mode 100644 index 3a3daca21c9..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity.types.ts +++ /dev/null @@ -1,649 +0,0 @@ -/** - * --------------------------------------------------------------------------------- - * This file has been generated by Sanity TypeGen. - * Command: `sanity typegen generate` - * - * Any modifications made directly to this file will be overwritten the next time - * the TypeScript definitions are generated. Please make changes to the Sanity - * schema definitions and/or GROQ queries if you need to update these types. - * - * For more information on how to use Sanity TypeGen, visit the official documentation: - * https://www.sanity.io/docs/sanity-typegen - * --------------------------------------------------------------------------------- - */ - -// Source: schema.json -export type SanityImagePaletteSwatch = { - _type: 'sanity.imagePaletteSwatch' - background?: string - foreground?: string - population?: number - title?: string -} - -export type SanityImagePalette = { - _type: 'sanity.imagePalette' - darkMuted?: SanityImagePaletteSwatch - lightVibrant?: SanityImagePaletteSwatch - darkVibrant?: SanityImagePaletteSwatch - vibrant?: SanityImagePaletteSwatch - dominant?: SanityImagePaletteSwatch - lightMuted?: SanityImagePaletteSwatch - muted?: SanityImagePaletteSwatch -} - -export type SanityImageDimensions = { - _type: 'sanity.imageDimensions' - height?: number - width?: number - aspectRatio?: number -} - -export type SanityFileAsset = { - _id: string - _type: 'sanity.fileAsset' - _createdAt: string - _updatedAt: string - _rev: string - originalFilename?: string - label?: string - title?: string - description?: string - altText?: string - sha1hash?: string - extension?: string - mimeType?: string - size?: number - assetId?: string - uploadId?: string - path?: string - url?: string - source?: SanityAssetSourceData -} - -export type Geopoint = { - _type: 'geopoint' - lat?: number - lng?: number - alt?: number -} - -export type Post = { - _id: string - _type: 'post' - _createdAt: string - _updatedAt: string - _rev: string - title?: string - slug?: Slug - content?: Array<{ - children?: Array<{ - marks?: Array - text?: string - _type: 'span' - _key: string - }> - style?: 'normal' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote' - listItem?: 'bullet' | 'number' - markDefs?: Array<{ - href?: string - _type: 'link' - _key: string - }> - level?: number - _type: 'block' - _key: string - }> - excerpt?: string - coverImage?: { - asset?: { - _ref: string - _type: 'reference' - _weak?: boolean - [internalGroqTypeReferenceTo]?: 'sanity.imageAsset' - } - hotspot?: SanityImageHotspot - crop?: SanityImageCrop - alt?: string - _type: 'image' - } - date?: string - author?: { - _ref: string - _type: 'reference' - _weak?: boolean - [internalGroqTypeReferenceTo]?: 'author' - } -} - -export type Author = { - _id: string - _type: 'author' - _createdAt: string - _updatedAt: string - _rev: string - name?: string - picture?: { - asset?: { - _ref: string - _type: 'reference' - _weak?: boolean - [internalGroqTypeReferenceTo]?: 'sanity.imageAsset' - } - hotspot?: SanityImageHotspot - crop?: SanityImageCrop - alt?: string - _type: 'image' - } -} - -export type Slug = { - _type: 'slug' - current?: string - source?: string -} - -export type Settings = { - _id: string - _type: 'settings' - _createdAt: string - _updatedAt: string - _rev: string - title?: string - description?: Array<{ - children?: Array<{ - marks?: Array - text?: string - _type: 'span' - _key: string - }> - style?: 'normal' - listItem?: never - markDefs?: Array<{ - href?: string - _type: 'link' - _key: string - }> - level?: number - _type: 'block' - _key: string - }> - footer?: Array<{ - children?: Array<{ - marks?: Array - text?: string - _type: 'span' - _key: string - }> - style?: 'normal' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'blockquote' - listItem?: 'bullet' | 'number' - markDefs?: Array<{ - href?: string - _type: 'link' - _key: string - }> - level?: number - _type: 'block' - _key: string - }> - ogImage?: { - asset?: { - _ref: string - _type: 'reference' - _weak?: boolean - [internalGroqTypeReferenceTo]?: 'sanity.imageAsset' - } - hotspot?: SanityImageHotspot - crop?: SanityImageCrop - alt?: string - metadataBase?: string - _type: 'image' - } -} - -export type SanityImageCrop = { - _type: 'sanity.imageCrop' - top?: number - bottom?: number - left?: number - right?: number -} - -export type SanityImageHotspot = { - _type: 'sanity.imageHotspot' - x?: number - y?: number - height?: number - width?: number -} - -export type SanityImageAsset = { - _id: string - _type: 'sanity.imageAsset' - _createdAt: string - _updatedAt: string - _rev: string - originalFilename?: string - label?: string - title?: string - description?: string - altText?: string - sha1hash?: string - extension?: string - mimeType?: string - size?: number - assetId?: string - uploadId?: string - path?: string - url?: string - metadata?: SanityImageMetadata - source?: SanityAssetSourceData -} - -export type SanityAssetSourceData = { - _type: 'sanity.assetSourceData' - name?: string - id?: string - url?: string -} - -export type SanityImageMetadata = { - _type: 'sanity.imageMetadata' - location?: Geopoint - dimensions?: SanityImageDimensions - palette?: SanityImagePalette - lqip?: string - blurHash?: string - hasAlpha?: boolean - isOpaque?: boolean -} - -export type SanityAssistInstructionTask = { - _type: 'sanity.assist.instructionTask' - path?: string - instructionKey?: string - started?: string - updated?: string - info?: string -} - -export type SanityAssistTaskStatus = { - _type: 'sanity.assist.task.status' - tasks?: Array< - { - _key: string - } & SanityAssistInstructionTask - > -} - -export type SanityAssistSchemaTypeAnnotations = { - _type: 'sanity.assist.schemaType.annotations' - title?: string - fields?: Array< - { - _key: string - } & SanityAssistSchemaTypeField - > -} - -export type SanityAssistOutputType = { - _type: 'sanity.assist.output.type' - type?: string -} - -export type SanityAssistOutputField = { - _type: 'sanity.assist.output.field' - path?: string -} - -export type SanityAssistInstructionContext = { - _type: 'sanity.assist.instruction.context' - reference?: { - _ref: string - _type: 'reference' - _weak?: boolean - [internalGroqTypeReferenceTo]?: 'assist.instruction.context' - } -} - -export type AssistInstructionContext = { - _id: string - _type: 'assist.instruction.context' - _createdAt: string - _updatedAt: string - _rev: string - title?: string - context?: Array<{ - children?: Array<{ - marks?: Array - text?: string - _type: 'span' - _key: string - }> - style?: 'normal' - listItem?: never - markDefs?: null - level?: number - _type: 'block' - _key: string - }> -} - -export type SanityAssistInstructionUserInput = { - _type: 'sanity.assist.instruction.userInput' - message?: string - description?: string -} - -export type SanityAssistInstructionPrompt = Array<{ - children?: Array< - | { - marks?: Array - text?: string - _type: 'span' - _key: string - } - | ({ - _key: string - } & SanityAssistInstructionFieldRef) - | ({ - _key: string - } & SanityAssistInstructionContext) - | ({ - _key: string - } & SanityAssistInstructionUserInput) - > - style?: 'normal' - listItem?: never - markDefs?: null - level?: number - _type: 'block' - _key: string -}> - -export type SanityAssistInstructionFieldRef = { - _type: 'sanity.assist.instruction.fieldRef' - path?: string -} - -export type SanityAssistInstruction = { - _type: 'sanity.assist.instruction' - prompt?: SanityAssistInstructionPrompt - icon?: string - title?: string - userId?: string - createdById?: string - output?: Array< - | ({ - _key: string - } & SanityAssistOutputField) - | ({ - _key: string - } & SanityAssistOutputType) - > -} - -export type SanityAssistSchemaTypeField = { - _type: 'sanity.assist.schemaType.field' - path?: string - instructions?: Array< - { - _key: string - } & SanityAssistInstruction - > -} - -export type AllSanitySchemaTypes = - | SanityImagePaletteSwatch - | SanityImagePalette - | SanityImageDimensions - | SanityFileAsset - | Geopoint - | Post - | Author - | Slug - | Settings - | SanityImageCrop - | SanityImageHotspot - | SanityImageAsset - | SanityAssetSourceData - | SanityImageMetadata - | SanityAssistInstructionTask - | SanityAssistTaskStatus - | SanityAssistSchemaTypeAnnotations - | SanityAssistOutputType - | SanityAssistOutputField - | SanityAssistInstructionContext - | AssistInstructionContext - | SanityAssistInstructionUserInput - | SanityAssistInstructionPrompt - | SanityAssistInstructionFieldRef - | SanityAssistInstruction - | SanityAssistSchemaTypeField -export declare const internalGroqTypeReferenceTo: unique symbol -// Source: ./sanity/lib/queries.ts -// Variable: settingsQuery -// Query: *[_type == "settings"][0] -export type SettingsQueryResult = { - _id: string - _type: 'settings' - _createdAt: string - _updatedAt: string - _rev: string - title?: string - description?: Array<{ - children?: Array<{ - marks?: Array - text?: string - _type: 'span' - _key: string - }> - style?: 'normal' - listItem?: never - markDefs?: Array<{ - href?: string - _type: 'link' - _key: string - }> - level?: number - _type: 'block' - _key: string - }> - footer?: Array<{ - children?: Array<{ - marks?: Array - text?: string - _type: 'span' - _key: string - }> - style?: 'blockquote' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'normal' - listItem?: 'bullet' | 'number' - markDefs?: Array<{ - href?: string - _type: 'link' - _key: string - }> - level?: number - _type: 'block' - _key: string - }> - ogImage?: { - asset?: { - _ref: string - _type: 'reference' - _weak?: boolean - [internalGroqTypeReferenceTo]?: 'sanity.imageAsset' - } - hotspot?: SanityImageHotspot - crop?: SanityImageCrop - alt?: string - metadataBase?: string - _type: 'image' - } -} | null -// Variable: heroQuery -// Query: *[_type == "post" && defined(slug.current)] | order(date desc, _updatedAt desc) [0] { content, _id, "status": select(_originalId in path("drafts.**") => "draft", "published"), "title": coalesce(title, "Untitled"), "slug": slug.current, excerpt, coverImage, "date": coalesce(date, _updatedAt), "author": author->{"name": coalesce(name, "Anonymous"), picture}, } -export type HeroQueryResult = { - content: Array<{ - children?: Array<{ - marks?: Array - text?: string - _type: 'span' - _key: string - }> - style?: 'blockquote' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'normal' - listItem?: 'bullet' | 'number' - markDefs?: Array<{ - href?: string - _type: 'link' - _key: string - }> - level?: number - _type: 'block' - _key: string - }> | null - _id: string - status: 'draft' | 'published' - title: string | 'Untitled' - slug: string | null - excerpt: string | null - coverImage: { - asset?: { - _ref: string - _type: 'reference' - _weak?: boolean - [internalGroqTypeReferenceTo]?: 'sanity.imageAsset' - } - hotspot?: SanityImageHotspot - crop?: SanityImageCrop - alt?: string - _type: 'image' - } | null - date: string - author: { - name: string | 'Anonymous' - picture: { - asset?: { - _ref: string - _type: 'reference' - _weak?: boolean - [internalGroqTypeReferenceTo]?: 'sanity.imageAsset' - } - hotspot?: SanityImageHotspot - crop?: SanityImageCrop - alt?: string - _type: 'image' - } | null - } | null -} | null -// Variable: moreStoriesQuery -// Query: *[_type == "post" && _id != $skip && defined(slug.current)] | order(date desc, _updatedAt desc) [0...$limit] { _id, "status": select(_originalId in path("drafts.**") => "draft", "published"), "title": coalesce(title, "Untitled"), "slug": slug.current, excerpt, coverImage, "date": coalesce(date, _updatedAt), "author": author->{"name": coalesce(name, "Anonymous"), picture}, } -export type MoreStoriesQueryResult = Array<{ - _id: string - status: 'draft' | 'published' - title: string | 'Untitled' - slug: string | null - excerpt: string | null - coverImage: { - asset?: { - _ref: string - _type: 'reference' - _weak?: boolean - [internalGroqTypeReferenceTo]?: 'sanity.imageAsset' - } - hotspot?: SanityImageHotspot - crop?: SanityImageCrop - alt?: string - _type: 'image' - } | null - date: string - author: { - name: string | 'Anonymous' - picture: { - asset?: { - _ref: string - _type: 'reference' - _weak?: boolean - [internalGroqTypeReferenceTo]?: 'sanity.imageAsset' - } - hotspot?: SanityImageHotspot - crop?: SanityImageCrop - alt?: string - _type: 'image' - } | null - } | null -}> -// Variable: postQuery -// Query: *[_type == "post" && slug.current == $slug] [0] { content, _id, "status": select(_originalId in path("drafts.**") => "draft", "published"), "title": coalesce(title, "Untitled"), "slug": slug.current, excerpt, coverImage, "date": coalesce(date, _updatedAt), "author": author->{"name": coalesce(name, "Anonymous"), picture}, } -export type PostQueryResult = { - content: Array<{ - children?: Array<{ - marks?: Array - text?: string - _type: 'span' - _key: string - }> - style?: 'blockquote' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'normal' - listItem?: 'bullet' | 'number' - markDefs?: Array<{ - href?: string - _type: 'link' - _key: string - }> - level?: number - _type: 'block' - _key: string - }> | null - _id: string - status: 'draft' | 'published' - title: string | 'Untitled' - slug: string | null - excerpt: string | null - coverImage: { - asset?: { - _ref: string - _type: 'reference' - _weak?: boolean - [internalGroqTypeReferenceTo]?: 'sanity.imageAsset' - } - hotspot?: SanityImageHotspot - crop?: SanityImageCrop - alt?: string - _type: 'image' - } | null - date: string - author: { - name: string | 'Anonymous' - picture: { - asset?: { - _ref: string - _type: 'reference' - _weak?: boolean - [internalGroqTypeReferenceTo]?: 'sanity.imageAsset' - } - hotspot?: SanityImageHotspot - crop?: SanityImageCrop - alt?: string - _type: 'image' - } | null - } | null -} | null - -// Source: ./app/(blog)/posts/[slug]/page.tsx -// Variable: postSlugs -// Query: *[_type == "post" && defined(slug.current)]{"slug": slug.current} -export type PostSlugsResult = Array<{ - slug: string | null -}> - -// Query TypeMap -import '@sanity/client' -declare module '@sanity/client' { - interface SanityQueries { - '*[_type == "settings"][0]': SettingsQueryResult - '\n *[_type == "post" && defined(slug.current)] | order(date desc, _updatedAt desc) [0] {\n content,\n \n _id,\n "status": select(_originalId in path("drafts.**") => "draft", "published"),\n "title": coalesce(title, "Untitled"),\n "slug": slug.current,\n excerpt,\n coverImage,\n "date": coalesce(date, _updatedAt),\n "author": author->{"name": coalesce(name, "Anonymous"), picture},\n\n }\n': HeroQueryResult - '\n *[_type == "post" && _id != $skip && defined(slug.current)] | order(date desc, _updatedAt desc) [0...$limit] {\n \n _id,\n "status": select(_originalId in path("drafts.**") => "draft", "published"),\n "title": coalesce(title, "Untitled"),\n "slug": slug.current,\n excerpt,\n coverImage,\n "date": coalesce(date, _updatedAt),\n "author": author->{"name": coalesce(name, "Anonymous"), picture},\n\n }\n': MoreStoriesQueryResult - '\n *[_type == "post" && slug.current == $slug] [0] {\n content,\n \n _id,\n "status": select(_originalId in path("drafts.**") => "draft", "published"),\n "title": coalesce(title, "Untitled"),\n "slug": slug.current,\n excerpt,\n coverImage,\n "date": coalesce(date, _updatedAt),\n "author": author->{"name": coalesce(name, "Anonymous"), picture},\n\n }\n': PostQueryResult - '*[_type == "post" && defined(slug.current)]{"slug": slug.current}': PostSlugsResult - } -} diff --git a/packages/@sanity/cli/test/test-template/sanity/lib/api.ts b/packages/@sanity/cli/test/test-template/sanity/lib/api.ts deleted file mode 100644 index 8e0157a360a..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity/lib/api.ts +++ /dev/null @@ -1,32 +0,0 @@ -/** - * As this file is reused in several other files, try to keep it lean and small. - * Importing other npm packages here could lead to needlessly increasing the client bundle size, or end up in a server-only function that don't need it. - */ - -function assertValue(v: T | undefined, errorMessage: string): T { - if (v === undefined) { - throw new Error(errorMessage) - } - - return v -} - -export const dataset = assertValue( - process.env.NEXT_PUBLIC_SANITY_DATASET, - 'Missing environment variable: NEXT_PUBLIC_SANITY_DATASET' -) - -export const projectId = assertValue( - process.env.NEXT_PUBLIC_SANITY_PROJECT_ID, - 'Missing environment variable: NEXT_PUBLIC_SANITY_PROJECT_ID' -) - -/** - * see https://www.sanity.io/docs/api-versioning for how versioning works - */ -export const apiVersion = process.env.NEXT_PUBLIC_SANITY_API_VERSION || '2024-02-28' - -/** - * Used to configure edit intent links, for Presentation Mode, as well as to configure where the Studio is mounted in the router. - */ -export const studioUrl = '/studio' diff --git a/packages/@sanity/cli/test/test-template/sanity/lib/client.ts b/packages/@sanity/cli/test/test-template/sanity/lib/client.ts deleted file mode 100644 index c66dbd442dd..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity/lib/client.ts +++ /dev/null @@ -1,22 +0,0 @@ -import {createClient} from 'next-sanity' - -import {apiVersion, dataset, projectId, studioUrl} from '@/sanity/lib/api' - -export const client = createClient({ - projectId, - dataset, - apiVersion, - useCdn: true, - perspective: 'published', - stega: { - studioUrl, - logger: console, - filter: (props) => { - if (props.sourcePath.at(-1) === 'title') { - return true - } - - return props.filterDefault(props) - }, - }, -}) diff --git a/packages/@sanity/cli/test/test-template/sanity/lib/demo.ts b/packages/@sanity/cli/test/test-template/sanity/lib/demo.ts deleted file mode 100644 index 6dc1a7d43ee..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity/lib/demo.ts +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Demo data used as placeholders and initial values for the blog - */ - -export const title = 'Blog.' - -export const description = [ - { - _key: '9f1a629887fd', - _type: 'block', - children: [ - { - _key: '4a58edd077880', - _type: 'span', - marks: [], - text: 'A statically generated blog example using ', - }, - { - _key: '4a58edd077881', - _type: 'span', - marks: ['ec5b66c9b1e0'], - text: 'Next.js', - }, - { - _key: '4a58edd077882', - _type: 'span', - marks: [], - text: ' and ', - }, - { - _key: '4a58edd077883', - _type: 'span', - marks: ['1f8991913ea8'], - text: 'Sanity', - }, - { - _key: '4a58edd077884', - _type: 'span', - marks: [], - text: '.', - }, - ], - markDefs: [ - { - _key: 'ec5b66c9b1e0', - _type: 'link', - href: 'https://nextjs.org/', - }, - { - _key: '1f8991913ea8', - _type: 'link', - href: 'https://sanity.io/', - }, - ], - style: 'normal', - }, -] - -export const ogImageTitle = 'A Next.js Blog with a Native Authoring Experience' diff --git a/packages/@sanity/cli/test/test-template/sanity/lib/fetch.ts b/packages/@sanity/cli/test/test-template/sanity/lib/fetch.ts deleted file mode 100644 index 50775f7c013..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity/lib/fetch.ts +++ /dev/null @@ -1,52 +0,0 @@ -import type {ClientPerspective, QueryParams} from 'next-sanity' -import {draftMode} from 'next/headers' - -import {client} from '@/sanity/lib/client' -import {token} from '@/sanity/lib/token' - -/** - * Used to fetch data in Server Components, it has built in support for handling Draft Mode and perspectives. - * When using the "published" perspective then time-based revalidation is used, set to match the time-to-live on Sanity's API CDN (60 seconds) - * and will also fetch from the CDN. - * When using the "previewDrafts" perspective then the data is fetched from the live API and isn't cached, it will also fetch draft content that isn't published yet. - */ -export async function sanityFetch({ - query, - params = {}, - perspective: _perspective, - /** - * Stega embedded Content Source Maps are used by Visual Editing by both the Sanity Presentation Tool and Vercel Visual Editing. - * The Sanity Presentation Tool will enable Draft Mode when loading up the live preview, and we use it as a signal for when to embed source maps. - * When outside of the Sanity Studio we also support the Vercel Toolbar Visual Editing feature, which is only enabled in production when it's a Vercel Preview Deployment. - */ - stega: _stega, -}: { - query: QueryString - params?: QueryParams | Promise - perspective?: Omit - stega?: boolean -}) { - const perspective = _perspective || (await draftMode()).isEnabled ? 'previewDrafts' : 'published' - const stega = _stega || perspective === 'previewDrafts' || process.env.VERCEL_ENV === 'preview' - if (perspective === 'previewDrafts') { - return client.fetch(query, await params, { - stega, - perspective: 'previewDrafts', - // The token is required to fetch draft content - token, - // The `previewDrafts` perspective isn't available on the API CDN - useCdn: false, - // And we can't cache the responses as it would slow down the live preview experience - next: {revalidate: 0}, - }) - } - return client.fetch(query, await params, { - stega, - perspective: 'published', - // The `published` perspective is available on the API CDN - useCdn: true, - // Only enable Stega in production if it's a Vercel Preview Deployment, as the Vercel Toolbar supports Visual Editing - // When using the `published` perspective we use time-based revalidation to match the time-to-live on Sanity's API CDN (60 seconds) - next: {revalidate: 60}, - }) -} diff --git a/packages/@sanity/cli/test/test-template/sanity/lib/queries.ts b/packages/@sanity/cli/test/test-template/sanity/lib/queries.ts deleted file mode 100644 index 34906f5c968..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity/lib/queries.ts +++ /dev/null @@ -1,34 +0,0 @@ -import {defineQuery} from 'next-sanity' - -export const settingsQuery = defineQuery(`*[_type == "settings"][0]`) - -const postFields = /* groq */ ` - _id, - "status": select(_originalId in path("drafts.**") => "draft", "published"), - "title": coalesce(title, "Untitled"), - "slug": slug.current, - excerpt, - coverImage, - "date": coalesce(date, _updatedAt), - "author": author->{"name": coalesce(name, "Anonymous"), picture}, -` - -export const heroQuery = defineQuery(` - *[_type == "post" && defined(slug.current)] | order(date desc, _updatedAt desc) [0] { - content, - ${postFields} - } -`) - -export const moreStoriesQuery = defineQuery(` - *[_type == "post" && _id != $skip && defined(slug.current)] | order(date desc, _updatedAt desc) [0...$limit] { - ${postFields} - } -`) - -export const postQuery = defineQuery(` - *[_type == "post" && slug.current == $slug] [0] { - content, - ${postFields} - } -`) diff --git a/packages/@sanity/cli/test/test-template/sanity/lib/token.ts b/packages/@sanity/cli/test/test-template/sanity/lib/token.ts deleted file mode 100644 index c5aaae62039..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity/lib/token.ts +++ /dev/null @@ -1,7 +0,0 @@ -import 'server-only' - -export const token = process.env.SANITY_API_READ_TOKEN - -if (!token) { - throw new Error('Missing SANITY_API_READ_TOKEN') -} diff --git a/packages/@sanity/cli/test/test-template/sanity/lib/utils.ts b/packages/@sanity/cli/test/test-template/sanity/lib/utils.ts deleted file mode 100644 index c029316eada..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity/lib/utils.ts +++ /dev/null @@ -1,34 +0,0 @@ -import createImageUrlBuilder from '@sanity/image-url' - -import {dataset, projectId} from '@/sanity/lib/api' - -const imageBuilder = createImageUrlBuilder({ - projectId: projectId || '', - dataset: dataset || '', -}) - -export const urlForImage = (source: any) => { - // Ensure that source image contains a valid reference - if (!source?.asset?._ref) { - return undefined - } - - return imageBuilder?.image(source).auto('format').fit('max') -} - -export function resolveOpenGraphImage(image: any, width = 1200, height = 627) { - if (!image) return - const url = urlForImage(image)?.width(1200).height(627).fit('crop').url() - if (!url) return - return {url, alt: image?.alt as string, width, height} -} - -export function resolveHref(documentType?: string, slug?: string): string | undefined { - switch (documentType) { - case 'post': - return slug ? `/posts/${slug}` : undefined - default: - console.warn('Invalid document type:', documentType) - return undefined - } -} diff --git a/packages/@sanity/cli/test/test-template/sanity/plugins/assist.ts b/packages/@sanity/cli/test/test-template/sanity/plugins/assist.ts deleted file mode 100644 index c844ee942b8..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity/plugins/assist.ts +++ /dev/null @@ -1,265 +0,0 @@ -/** - * Sets up the AI Assist plugin with preset prompts for content creation - */ - -import {assist} from '@sanity/assist' - -import postType from '../schemas/documents/post' - -export const assistWithPresets = () => - assist({ - __presets: { - [postType.name]: { - fields: [ - { - /** - * Creates Portable Text `content` blocks from the `title` field - */ - path: 'content', - instructions: [ - { - _key: 'preset-instruction-1', - title: 'Generate sample content', - icon: 'block-content', - prompt: [ - { - _key: '86e70087d4d5', - markDefs: [], - children: [ - { - _type: 'span', - marks: [], - text: 'Given the draft title ', - _key: '6b5d5d6a63cf0', - }, - { - path: 'title', - _type: 'sanity.assist.instruction.fieldRef', - _key: '0132742d463b', - }, - { - _type: 'span', - marks: [], - text: ' of a blog post, generate a comprehensive and engaging sample content that spans the length of one to two A4 pages. The content should be structured, informative, and tailored to the subject matter implied by the title, whether it be travel, software engineering, fashion, politics, or any other theme. The text will be displayed below the ', - _key: 'a02c9ab4eb2d', - }, - { - _type: 'sanity.assist.instruction.fieldRef', - _key: 'f208ef240062', - path: 'title', - }, - { - text: " and doesn't need to repeat it in the text. The generated text should include the following elements:", - _key: '8ecfa74a8487', - _type: 'span', - marks: [], - }, - ], - _type: 'block', - style: 'normal', - }, - { - style: 'normal', - _key: 'e4dded41ea89', - markDefs: [], - children: [ - { - _type: 'span', - marks: [], - text: '1. Introduction: A brief paragraph that captures the essence of the blog post, hooks the reader with intriguing insights, and outlines the purpose of the post.', - _key: 'cc5ef44a2fb5', - }, - ], - _type: 'block', - }, - { - style: 'normal', - _key: '585e8de2fe35', - markDefs: [], - children: [ - { - _type: 'span', - marks: [], - text: '2. Main Body:', - _key: 'fab36eb7c541', - }, - ], - _type: 'block', - }, - { - _type: 'block', - style: 'normal', - _key: 'e96b89ef6357', - markDefs: [], - children: [ - { - _type: 'span', - marks: [], - text: '- For thematic consistency, divide the body into several sections with subheadings that explore different facets of the topic.', - _key: 'b685a310a0ff', - }, - ], - }, - { - children: [ - { - marks: [], - text: '- Include engaging and informative content such as personal anecdotes (for travel or fashion blogs), technical explanations or tutorials (for software engineering blogs), satirical or humorous observations (for shitposting), or well-argued positions (for political blogs).', - _key: 'c7468d106c91', - _type: 'span', - }, - ], - _type: 'block', - style: 'normal', - _key: 'ce4acdb00da9', - markDefs: [], - }, - { - _type: 'block', - style: 'normal', - _key: 'fb4572e65833', - markDefs: [], - children: [ - { - _type: 'span', - marks: [], - text: '- ', - _key: '5358f261dce4', - }, - { - _type: 'span', - marks: [], - text: ' observations (for shitposting), or well-argued positions (for political blogs).', - _key: '50792c6d0f77', - }, - ], - }, - { - children: [ - { - marks: [], - text: 'Where applicable, incorporate bullet points or numbered lists to break down complex information, steps in a process, or key highlights.', - _key: '3b891d8c1dde0', - _type: 'span', - }, - ], - _type: 'block', - style: 'normal', - _key: '9364b67074ce', - markDefs: [], - }, - { - _key: 'a6ba7579cd66', - markDefs: [], - children: [ - { - _type: 'span', - marks: [], - text: '3. Conclusion: Summarize the main points discussed in the post, offer final thoughts or calls to action, and invite readers to engage with the content through comments or social media sharing.', - _key: '1280f11d499d', - }, - ], - _type: 'block', - style: 'normal', - }, - { - style: 'normal', - _key: '719a79eb4c1c', - markDefs: [], - children: [ - { - marks: [], - text: "4. Engagement Prompts: Conclude with questions or prompts that encourage readers to share their experiences, opinions, or questions related to the blog post's topic, but keep in mind there is no Comments field below the blog post.", - _key: 'f1512086bab6', - _type: 'span', - }, - ], - _type: 'block', - }, - { - _type: 'block', - style: 'normal', - _key: '4a1c586fd44a', - markDefs: [], - children: [ - { - marks: [], - text: 'Ensure the generated content maintains a balance between being informative and entertaining, to capture the interest of a wide audience. The sample content should serve as a solid foundation that can be further customized or expanded upon by the blog author to finalize the post.', - _key: '697bbd03cb110', - _type: 'span', - }, - ], - }, - { - children: [ - { - marks: [], - text: 'Don\'t prefix each section with "Introduction", "Main Body", "Conclusion" or "Engagement Prompts"', - _key: 'd20bb9a03b0d', - _type: 'span', - }, - ], - _type: 'block', - style: 'normal', - _key: 'b072b3c62c3c', - markDefs: [], - }, - ], - }, - ], - }, - { - /** - * Summarize content into the `excerpt` field - */ - path: 'excerpt', - instructions: [ - { - _key: 'preset-instruction-2', - title: 'Summarize content', - icon: 'blockquote', - prompt: [ - { - markDefs: [], - children: [ - { - _key: '650a0dcc327d', - _type: 'span', - marks: [], - text: 'Create a short excerpt based on ', - }, - { - path: 'content', - _type: 'sanity.assist.instruction.fieldRef', - _key: 'c62d14c73496', - }, - { - _key: '38e043efa606', - _type: 'span', - marks: [], - text: " that doesn't repeat what's already in the ", - }, - { - path: 'title', - _type: 'sanity.assist.instruction.fieldRef', - _key: '445e62dda246', - }, - { - _key: '98cce773915e', - _type: 'span', - marks: [], - text: ' . Consider the UI has limited horizontal space and try to avoid too many line breaks and make it as short, terse and brief as possible. At best a single sentence, at most two sentences.', - }, - ], - _type: 'block', - style: 'normal', - _key: '392c618784b0', - }, - ], - }, - ], - }, - ], - }, - }, - }) diff --git a/packages/@sanity/cli/test/test-template/sanity/plugins/settings.tsx b/packages/@sanity/cli/test/test-template/sanity/plugins/settings.tsx deleted file mode 100644 index d5c3d717a46..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity/plugins/settings.tsx +++ /dev/null @@ -1,55 +0,0 @@ -/** - * This plugin contains all the logic for setting up the singletons - */ - -import {definePlugin, type DocumentDefinition} from 'sanity' -import {type StructureResolver} from 'sanity/structure' - -export const singletonPlugin = definePlugin((types: string[]) => { - return { - name: 'singletonPlugin', - document: { - // Hide 'Singletons (such as Settings)' from new document options - // https://user-images.githubusercontent.com/81981/195728798-e0c6cf7e-d442-4e58-af3a-8cd99d7fcc28.png - newDocumentOptions: (prev, {creationContext, ...rest}) => { - if (creationContext.type === 'global') { - return prev.filter((templateItem) => !types.includes(templateItem.templateId)) - } - - return prev - }, - // Removes the "duplicate" action on the Singletons (such as Home) - actions: (prev, {schemaType}) => { - if (types.includes(schemaType)) { - return prev.filter(({action}) => action !== 'duplicate') - } - - return prev - }, - }, - } -}) - -// The StructureResolver is how we're changing the DeskTool structure to linking to document (named Singleton) -// like how "Home" is handled. -export const pageStructure = (typeDefArray: DocumentDefinition[]): StructureResolver => { - return (S) => { - // Goes through all of the singletons that were provided and translates them into something the - // Structure tool can understand - const singletonItems = typeDefArray.map((typeDef) => { - return S.listItem() - .title(typeDef.title!) - .icon(typeDef.icon) - .child(S.editor().id(typeDef.name).schemaType(typeDef.name).documentId(typeDef.name)) - }) - - // The default root list items (except custom ones) - const defaultListItems = S.documentTypeListItems().filter( - (listItem) => !typeDefArray.find((singleton) => singleton.name === listItem.getId()) - ) - - return S.list() - .title('Content') - .items([...singletonItems, S.divider(), ...defaultListItems]) - } -} diff --git a/packages/@sanity/cli/test/test-template/sanity/schemas/documents/author.ts b/packages/@sanity/cli/test/test-template/sanity/schemas/documents/author.ts deleted file mode 100644 index 3b1d0a3a59b..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity/schemas/documents/author.ts +++ /dev/null @@ -1,45 +0,0 @@ -import {UserIcon} from '@sanity/icons' -import {defineField, defineType} from 'sanity' - -export default defineType({ - name: 'author', - title: 'Author', - icon: UserIcon, - type: 'document', - fields: [ - defineField({ - name: 'name', - title: 'Name', - type: 'string', - validation: (rule) => rule.required(), - }), - defineField({ - name: 'picture', - title: 'Picture', - type: 'image', - fields: [ - { - name: 'alt', - type: 'string', - title: 'Alternative text', - description: 'Important for SEO and accessiblity.', - validation: (rule) => { - return rule.custom((alt, context) => { - if ((context.document?.picture as any)?.asset?._ref && !alt) { - return 'Required' - } - return true - }) - }, - }, - ], - options: { - hotspot: true, - aiAssist: { - imageDescriptionField: 'alt', - }, - }, - validation: (rule) => rule.required(), - }), - ], -}) diff --git a/packages/@sanity/cli/test/test-template/sanity/schemas/documents/post.ts b/packages/@sanity/cli/test/test-template/sanity/schemas/documents/post.ts deleted file mode 100644 index 74e6cb068c8..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity/schemas/documents/post.ts +++ /dev/null @@ -1,111 +0,0 @@ -import {DocumentTextIcon} from '@sanity/icons' -import {format, parseISO} from 'date-fns' -import {defineField, defineType} from 'sanity' - -import authorType from './author' - -/** - * This file is the schema definition for a post. - * - * Here you'll be able to edit the different fields that appear when you - * create or edit a post in the studio. - * - * Here you can see the different schema types that are available: - - https://www.sanity.io/docs/schema-types - - */ - -export default defineType({ - name: 'post', - title: 'Post', - icon: DocumentTextIcon, - type: 'document', - fields: [ - defineField({ - name: 'title', - title: 'Title', - type: 'string', - validation: (rule) => rule.required(), - }), - defineField({ - name: 'slug', - title: 'Slug', - type: 'slug', - description: 'A slug is required for the post to show up in the preview', - options: { - source: 'title', - maxLength: 96, - isUnique: (value, context) => context.defaultIsUnique(value, context), - }, - validation: (rule) => rule.required(), - }), - defineField({ - name: 'content', - title: 'Content', - type: 'array', - of: [{type: 'block'}], - }), - defineField({ - name: 'excerpt', - title: 'Excerpt', - type: 'text', - }), - defineField({ - name: 'coverImage', - title: 'Cover Image', - type: 'image', - options: { - hotspot: true, - aiAssist: { - imageDescriptionField: 'alt', - }, - }, - fields: [ - { - name: 'alt', - type: 'string', - title: 'Alternative text', - description: 'Important for SEO and accessiblity.', - validation: (rule) => { - return rule.custom((alt, context) => { - if ((context.document?.coverImage as any)?.asset?._ref && !alt) { - return 'Required' - } - return true - }) - }, - }, - ], - validation: (rule) => rule.required(), - }), - defineField({ - name: 'date', - title: 'Date', - type: 'datetime', - initialValue: () => new Date().toISOString(), - }), - defineField({ - name: 'author', - title: 'Author', - type: 'reference', - to: [{type: authorType.name}], - }), - ], - preview: { - select: { - title: 'title', - author: 'author.name', - date: 'date', - media: 'coverImage', - }, - prepare({title, media, author, date}) { - const subtitles = [ - author && `by ${author}`, - date && `on ${format(parseISO(date), 'LLL d, yyyy')}`, - ].filter(Boolean) - - return {title, media, subtitle: subtitles.join(' ')} - }, - }, -}) diff --git a/packages/@sanity/cli/test/test-template/sanity/schemas/singletons/settings.tsx b/packages/@sanity/cli/test/test-template/sanity/schemas/singletons/settings.tsx deleted file mode 100644 index b3613560d6c..00000000000 --- a/packages/@sanity/cli/test/test-template/sanity/schemas/singletons/settings.tsx +++ /dev/null @@ -1,127 +0,0 @@ -import {CogIcon} from '@sanity/icons' -import {defineArrayMember, defineField, defineType} from 'sanity' - -import * as demo from '@/sanity/lib/demo' - -export default defineType({ - name: 'settings', - title: 'Settings', - type: 'document', - icon: CogIcon, - fields: [ - defineField({ - name: 'title', - description: 'This field is the title of your blog.', - title: 'Title', - type: 'string', - initialValue: demo.title, - validation: (rule) => rule.required(), - }), - defineField({ - name: 'description', - description: 'Used both for the description tag for SEO, and the blog subheader.', - title: 'Description', - type: 'array', - initialValue: demo.description, - of: [ - defineArrayMember({ - type: 'block', - options: {}, - styles: [], - lists: [], - marks: { - decorators: [], - annotations: [ - defineField({ - type: 'object', - name: 'link', - fields: [ - { - type: 'string', - name: 'href', - title: 'URL', - validation: (rule) => rule.required(), - }, - ], - }), - ], - }, - }), - ], - }), - defineField({ - name: 'footer', - description: 'This is a block of text that will be displayed at the bottom of the page.', - title: 'Footer Info', - type: 'array', - of: [ - defineArrayMember({ - type: 'block', - marks: { - annotations: [ - { - name: 'link', - type: 'object', - title: 'Link', - fields: [ - { - name: 'href', - type: 'url', - title: 'Url', - }, - ], - }, - ], - }, - }), - ], - }), - defineField({ - name: 'ogImage', - title: 'Open Graph Image', - type: 'image', - description: 'Displayed on social cards and search engine results.', - options: { - hotspot: true, - aiAssist: { - imageDescriptionField: 'alt', - }, - }, - fields: [ - defineField({ - name: 'alt', - description: 'Important for accessibility and SEO.', - title: 'Alternative text', - type: 'string', - validation: (rule) => { - return rule.custom((alt, context) => { - if ((context.document?.ogImage as any)?.asset?._ref && !alt) { - return 'Required' - } - return true - }) - }, - }), - defineField({ - name: 'metadataBase', - type: 'url', - description: ( - - More information - - ), - }), - ], - }), - ], - preview: { - prepare() { - return { - title: 'Settings', - } - }, - }, -}) diff --git a/packages/@sanity/cli/test/test-template/schema.json b/packages/@sanity/cli/test/test-template/schema.json deleted file mode 100644 index 7db0c69906a..00000000000 --- a/packages/@sanity/cli/test/test-template/schema.json +++ /dev/null @@ -1,2329 +0,0 @@ -[ - { - "name": "sanity.imagePaletteSwatch", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.imagePaletteSwatch" - } - }, - "background": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "foreground": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "population": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "title": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - } - } - } - }, - { - "name": "sanity.imagePalette", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.imagePalette" - } - }, - "darkMuted": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imagePaletteSwatch" - }, - "optional": true - }, - "lightVibrant": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imagePaletteSwatch" - }, - "optional": true - }, - "darkVibrant": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imagePaletteSwatch" - }, - "optional": true - }, - "vibrant": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imagePaletteSwatch" - }, - "optional": true - }, - "dominant": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imagePaletteSwatch" - }, - "optional": true - }, - "lightMuted": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imagePaletteSwatch" - }, - "optional": true - }, - "muted": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imagePaletteSwatch" - }, - "optional": true - } - } - } - }, - { - "name": "sanity.imageDimensions", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.imageDimensions" - } - }, - "height": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "width": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "aspectRatio": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - } - } - } - }, - { - "name": "sanity.fileAsset", - "type": "document", - "attributes": { - "_id": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.fileAsset" - } - }, - "_createdAt": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_updatedAt": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_rev": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "originalFilename": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "label": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "title": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "description": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "altText": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "sha1hash": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "extension": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "mimeType": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "size": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "assetId": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "uploadId": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "path": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "url": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "source": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.assetSourceData" - }, - "optional": true - } - } - }, - { - "name": "geopoint", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "geopoint" - } - }, - "lat": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "lng": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "alt": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - } - } - } - }, - { - "name": "post", - "type": "document", - "attributes": { - "_id": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "post" - } - }, - "_createdAt": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_updatedAt": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_rev": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "title": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "slug": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "slug" - }, - "optional": true - }, - "content": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "children": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "marks": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "string" - } - }, - "optional": true - }, - "text": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "span" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - } - }, - "optional": true - }, - "style": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "normal" - }, - { - "type": "string", - "value": "h1" - }, - { - "type": "string", - "value": "h2" - }, - { - "type": "string", - "value": "h3" - }, - { - "type": "string", - "value": "h4" - }, - { - "type": "string", - "value": "h5" - }, - { - "type": "string", - "value": "h6" - }, - { - "type": "string", - "value": "blockquote" - } - ] - }, - "optional": true - }, - "listItem": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "bullet" - }, - { - "type": "string", - "value": "number" - } - ] - }, - "optional": true - }, - "markDefs": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "href": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "link" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - } - }, - "optional": true - }, - "level": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "block" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - } - }, - "optional": true - }, - "excerpt": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "coverImage": { - "type": "objectAttribute", - "value": { - "type": "object", - "attributes": { - "asset": { - "type": "objectAttribute", - "value": { - "type": "object", - "attributes": { - "_ref": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "reference" - } - }, - "_weak": { - "type": "objectAttribute", - "value": { - "type": "boolean" - }, - "optional": true - } - }, - "dereferencesTo": "sanity.imageAsset" - }, - "optional": true - }, - "hotspot": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imageHotspot" - }, - "optional": true - }, - "crop": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imageCrop" - }, - "optional": true - }, - "alt": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "image" - } - } - } - }, - "optional": true - }, - "date": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "author": { - "type": "objectAttribute", - "value": { - "type": "object", - "attributes": { - "_ref": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "reference" - } - }, - "_weak": { - "type": "objectAttribute", - "value": { - "type": "boolean" - }, - "optional": true - } - }, - "dereferencesTo": "author" - }, - "optional": true - } - } - }, - { - "name": "author", - "type": "document", - "attributes": { - "_id": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "author" - } - }, - "_createdAt": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_updatedAt": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_rev": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "name": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "picture": { - "type": "objectAttribute", - "value": { - "type": "object", - "attributes": { - "asset": { - "type": "objectAttribute", - "value": { - "type": "object", - "attributes": { - "_ref": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "reference" - } - }, - "_weak": { - "type": "objectAttribute", - "value": { - "type": "boolean" - }, - "optional": true - } - }, - "dereferencesTo": "sanity.imageAsset" - }, - "optional": true - }, - "hotspot": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imageHotspot" - }, - "optional": true - }, - "crop": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imageCrop" - }, - "optional": true - }, - "alt": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "image" - } - } - } - }, - "optional": true - } - } - }, - { - "name": "slug", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "slug" - } - }, - "current": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "source": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - } - } - } - }, - { - "name": "settings", - "type": "document", - "attributes": { - "_id": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "settings" - } - }, - "_createdAt": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_updatedAt": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_rev": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "title": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "description": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "children": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "marks": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "string" - } - }, - "optional": true - }, - "text": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "span" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - } - }, - "optional": true - }, - "style": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "normal" - } - ] - }, - "optional": true - }, - "listItem": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [] - }, - "optional": true - }, - "markDefs": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "href": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "link" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - } - }, - "optional": true - }, - "level": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "block" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - } - }, - "optional": true - }, - "footer": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "children": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "marks": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "string" - } - }, - "optional": true - }, - "text": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "span" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - } - }, - "optional": true - }, - "style": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "normal" - }, - { - "type": "string", - "value": "h1" - }, - { - "type": "string", - "value": "h2" - }, - { - "type": "string", - "value": "h3" - }, - { - "type": "string", - "value": "h4" - }, - { - "type": "string", - "value": "h5" - }, - { - "type": "string", - "value": "h6" - }, - { - "type": "string", - "value": "blockquote" - } - ] - }, - "optional": true - }, - "listItem": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "bullet" - }, - { - "type": "string", - "value": "number" - } - ] - }, - "optional": true - }, - "markDefs": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "href": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "link" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - } - }, - "optional": true - }, - "level": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "block" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - } - }, - "optional": true - }, - "ogImage": { - "type": "objectAttribute", - "value": { - "type": "object", - "attributes": { - "asset": { - "type": "objectAttribute", - "value": { - "type": "object", - "attributes": { - "_ref": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "reference" - } - }, - "_weak": { - "type": "objectAttribute", - "value": { - "type": "boolean" - }, - "optional": true - } - }, - "dereferencesTo": "sanity.imageAsset" - }, - "optional": true - }, - "hotspot": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imageHotspot" - }, - "optional": true - }, - "crop": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imageCrop" - }, - "optional": true - }, - "alt": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "metadataBase": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "image" - } - } - } - }, - "optional": true - } - } - }, - { - "name": "sanity.imageCrop", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.imageCrop" - } - }, - "top": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "bottom": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "left": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "right": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - } - } - } - }, - { - "name": "sanity.imageHotspot", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.imageHotspot" - } - }, - "x": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "y": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "height": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "width": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - } - } - } - }, - { - "name": "sanity.imageAsset", - "type": "document", - "attributes": { - "_id": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.imageAsset" - } - }, - "_createdAt": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_updatedAt": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_rev": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "originalFilename": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "label": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "title": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "description": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "altText": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "sha1hash": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "extension": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "mimeType": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "size": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "assetId": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "uploadId": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "path": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "url": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "metadata": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imageMetadata" - }, - "optional": true - }, - "source": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.assetSourceData" - }, - "optional": true - } - } - }, - { - "name": "sanity.assetSourceData", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.assetSourceData" - } - }, - "name": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "id": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "url": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - } - } - } - }, - { - "name": "sanity.imageMetadata", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.imageMetadata" - } - }, - "location": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "geopoint" - }, - "optional": true - }, - "dimensions": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imageDimensions" - }, - "optional": true - }, - "palette": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.imagePalette" - }, - "optional": true - }, - "lqip": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "blurHash": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "hasAlpha": { - "type": "objectAttribute", - "value": { - "type": "boolean" - }, - "optional": true - }, - "isOpaque": { - "type": "objectAttribute", - "value": { - "type": "boolean" - }, - "optional": true - } - } - } - }, - { - "name": "sanity.assist.instructionTask", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.assist.instructionTask" - } - }, - "path": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "instructionKey": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "started": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "updated": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "info": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - } - } - } - }, - { - "name": "sanity.assist.task.status", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.assist.task.status" - } - }, - "tasks": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - }, - "rest": { - "type": "inline", - "name": "sanity.assist.instructionTask" - } - } - }, - "optional": true - } - } - } - }, - { - "name": "sanity.assist.schemaType.annotations", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.assist.schemaType.annotations" - } - }, - "title": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "fields": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - }, - "rest": { - "type": "inline", - "name": "sanity.assist.schemaType.field" - } - } - }, - "optional": true - } - } - } - }, - { - "name": "sanity.assist.output.type", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.assist.output.type" - } - }, - "type": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - } - } - } - }, - { - "name": "sanity.assist.output.field", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.assist.output.field" - } - }, - "path": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - } - } - } - }, - { - "name": "sanity.assist.instruction.context", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.assist.instruction.context" - } - }, - "reference": { - "type": "objectAttribute", - "value": { - "type": "object", - "attributes": { - "_ref": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "reference" - } - }, - "_weak": { - "type": "objectAttribute", - "value": { - "type": "boolean" - }, - "optional": true - } - }, - "dereferencesTo": "assist.instruction.context" - }, - "optional": true - } - } - } - }, - { - "name": "assist.instruction.context", - "type": "document", - "attributes": { - "_id": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "assist.instruction.context" - } - }, - "_createdAt": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_updatedAt": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "_rev": { - "type": "objectAttribute", - "value": { - "type": "string" - } - }, - "title": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "context": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "children": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "marks": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "string" - } - }, - "optional": true - }, - "text": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "span" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - } - }, - "optional": true - }, - "style": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "normal" - } - ] - }, - "optional": true - }, - "listItem": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [] - }, - "optional": true - }, - "markDefs": { - "type": "objectAttribute", - "value": { - "type": "null" - }, - "optional": true - }, - "level": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "block" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - } - }, - "optional": true - } - } - }, - { - "name": "sanity.assist.instruction.userInput", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.assist.instruction.userInput" - } - }, - "message": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "description": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - } - } - } - }, - { - "name": "sanity.assist.instruction.prompt", - "type": "type", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "children": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "union", - "of": [ - { - "type": "object", - "attributes": { - "marks": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "string" - } - }, - "optional": true - }, - "text": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "span" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - }, - { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - }, - "rest": { - "type": "inline", - "name": "sanity.assist.instruction.fieldRef" - } - }, - { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - }, - "rest": { - "type": "inline", - "name": "sanity.assist.instruction.context" - } - }, - { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - }, - "rest": { - "type": "inline", - "name": "sanity.assist.instruction.userInput" - } - } - ] - } - }, - "optional": true - }, - "style": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [ - { - "type": "string", - "value": "normal" - } - ] - }, - "optional": true - }, - "listItem": { - "type": "objectAttribute", - "value": { - "type": "union", - "of": [] - }, - "optional": true - }, - "markDefs": { - "type": "objectAttribute", - "value": { - "type": "null" - }, - "optional": true - }, - "level": { - "type": "objectAttribute", - "value": { - "type": "number" - }, - "optional": true - }, - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "block" - } - } - }, - "rest": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - } - } - } - } - }, - { - "name": "sanity.assist.instruction.fieldRef", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.assist.instruction.fieldRef" - } - }, - "path": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - } - } - } - }, - { - "name": "sanity.assist.instruction", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.assist.instruction" - } - }, - "prompt": { - "type": "objectAttribute", - "value": { - "type": "inline", - "name": "sanity.assist.instruction.prompt" - }, - "optional": true - }, - "icon": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "title": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "userId": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "createdById": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "output": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "union", - "of": [ - { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - }, - "rest": { - "type": "inline", - "name": "sanity.assist.output.field" - } - }, - { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - }, - "rest": { - "type": "inline", - "name": "sanity.assist.output.type" - } - } - ] - } - }, - "optional": true - } - } - } - }, - { - "name": "sanity.assist.schemaType.field", - "type": "type", - "value": { - "type": "object", - "attributes": { - "_type": { - "type": "objectAttribute", - "value": { - "type": "string", - "value": "sanity.assist.schemaType.field" - } - }, - "path": { - "type": "objectAttribute", - "value": { - "type": "string" - }, - "optional": true - }, - "instructions": { - "type": "objectAttribute", - "value": { - "type": "array", - "of": { - "type": "object", - "attributes": { - "_key": { - "type": "objectAttribute", - "value": { - "type": "string" - } - } - }, - "rest": { - "type": "inline", - "name": "sanity.assist.instruction" - } - } - }, - "optional": true - } - } - } - } -] diff --git a/packages/@sanity/cli/test/test-template/tailwind.config.ts b/packages/@sanity/cli/test/test-template/tailwind.config.ts deleted file mode 100644 index 48364a13764..00000000000 --- a/packages/@sanity/cli/test/test-template/tailwind.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -import type {Config} from 'tailwindcss' -import typography from '@tailwindcss/typography' - -export default { - content: ['./app/**/*.{ts,tsx}', './sanity/**/*.{ts,tsx}'], - theme: { - extend: { - fontFamily: { - sans: ['var(--font-inter)'], - }, - }, - }, - future: { - hoverOnlyWhenSupported: true, - }, - plugins: [typography], -} satisfies Config diff --git a/packages/@sanity/cli/test/test-template/tsconfig.json b/packages/@sanity/cli/test/test-template/tsconfig.json deleted file mode 100644 index 2d9e949e103..00000000000 --- a/packages/@sanity/cli/test/test-template/tsconfig.json +++ /dev/null @@ -1,25 +0,0 @@ -{ - "compilerOptions": { - "target": "esnext", - "lib": ["dom", "dom.iterable", "esnext"], - "allowJs": true, - "skipLibCheck": true, - "strict": true, - "forceConsistentCasingInFileNames": true, - "noEmit": true, - "module": "preserve", - "isolatedModules": true, - "jsx": "preserve", - "incremental": true, - "plugins": [ - { - "name": "next" - } - ], - "paths": { - "@/*": ["./*"] - } - }, - "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"], - "exclude": ["node_modules"] -}