From 41580c40eedcb5744c5237e6cdbbcfa8686eef4f Mon Sep 17 00:00:00 2001 From: Rostislav Melkumyan Date: Mon, 13 Jan 2025 15:37:57 +0100 Subject: [PATCH] feat(cli): slim down remote test template (#8224) --- packages/@sanity/cli/.eslintignore | 1 - .../@sanity/cli/src/util/remoteTemplate.ts | 20 +- .../remote-template/.env.local.example | 5 + .../__fixtures__/remote-template/README.md | 1 + .../remote-template/next.config.ts | 7 + .../__fixtures__/remote-template/package.json | 13 + .../remote-template/sanity.cli.ts | 8 + .../remote-template/sanity.config.ts | 13 + packages/@sanity/cli/test/init.test.ts | 12 +- .../cli/test/test-template/.env.local.example | 3 - .../cli/test/test-template/.eslintignore | 2 - .../@sanity/cli/test/test-template/.eslintrc | 4 - .../@sanity/cli/test/test-template/.gitignore | 42 - .../cli/test/test-template/.prettierignore | 3 - .../@sanity/cli/test/test-template/README.md | 4 - .../test/test-template/app/(blog)/actions.ts | 12 - .../test-template/app/(blog)/alert-banner.tsx | 52 - .../test/test-template/app/(blog)/avatar.tsx | 30 - .../test-template/app/(blog)/cover-image.tsx | 31 - .../test/test-template/app/(blog)/date.tsx | 5 - .../test/test-template/app/(blog)/layout.tsx | 101 - .../test-template/app/(blog)/more-stories.tsx | 39 - .../test-template/app/(blog)/onboarding.tsx | 71 - .../test/test-template/app/(blog)/page.tsx | 105 - .../app/(blog)/portable-text.tsx | 41 - .../app/(blog)/posts/[slug]/page.tsx | 107 - .../test-template/app/(sanity)/apple-icon.png | Bin 3682 -> 0 bytes .../test/test-template/app/(sanity)/icon.ico | Bin 4286 -> 0 bytes .../test/test-template/app/(sanity)/icon.png | Bin 10466 -> 0 bytes .../test/test-template/app/(sanity)/icon.svg | 7 - .../test-template/app/(sanity)/layout.tsx | 19 - .../app/(sanity)/studio/[[...tool]]/page.tsx | 9 - .../app/api/draft-mode/enable/route.ts | 8 - .../cli/test/test-template/app/favicon.ico | Bin 15086 -> 0 bytes .../cli/test/test-template/app/globals.css | 3 - .../cli/test/test-template/next.config.ts | 10 - .../cli/test/test-template/package.json | 45 - .../cli/test/test-template/postcss.config.js | 6 - .../cli/test/test-template/sanity.cli.ts | 19 - .../cli/test/test-template/sanity.config.ts | 88 - .../cli/test/test-template/sanity.types.ts | 649 ----- .../cli/test/test-template/sanity/lib/api.ts | 32 - .../test/test-template/sanity/lib/client.ts | 22 - .../cli/test/test-template/sanity/lib/demo.ts | 59 - .../test/test-template/sanity/lib/fetch.ts | 52 - .../test/test-template/sanity/lib/queries.ts | 34 - .../test/test-template/sanity/lib/token.ts | 7 - .../test/test-template/sanity/lib/utils.ts | 34 - .../test-template/sanity/plugins/assist.ts | 265 -- .../test-template/sanity/plugins/settings.tsx | 55 - .../sanity/schemas/documents/author.ts | 45 - .../sanity/schemas/documents/post.ts | 111 - .../sanity/schemas/singletons/settings.tsx | 127 - .../cli/test/test-template/schema.json | 2329 ----------------- .../cli/test/test-template/tailwind.config.ts | 17 - .../cli/test/test-template/tsconfig.json | 25 - 56 files changed, 65 insertions(+), 4744 deletions(-) create mode 100644 packages/@sanity/cli/test/__fixtures__/remote-template/.env.local.example create mode 100644 packages/@sanity/cli/test/__fixtures__/remote-template/README.md create mode 100644 packages/@sanity/cli/test/__fixtures__/remote-template/next.config.ts create mode 100644 packages/@sanity/cli/test/__fixtures__/remote-template/package.json create mode 100644 packages/@sanity/cli/test/__fixtures__/remote-template/sanity.cli.ts create mode 100644 packages/@sanity/cli/test/__fixtures__/remote-template/sanity.config.ts delete mode 100644 packages/@sanity/cli/test/test-template/.env.local.example delete mode 100644 packages/@sanity/cli/test/test-template/.eslintignore delete mode 100644 packages/@sanity/cli/test/test-template/.eslintrc delete mode 100644 packages/@sanity/cli/test/test-template/.gitignore delete mode 100644 packages/@sanity/cli/test/test-template/.prettierignore delete mode 100644 packages/@sanity/cli/test/test-template/README.md delete mode 100644 packages/@sanity/cli/test/test-template/app/(blog)/actions.ts delete mode 100644 packages/@sanity/cli/test/test-template/app/(blog)/alert-banner.tsx delete mode 100644 packages/@sanity/cli/test/test-template/app/(blog)/avatar.tsx delete mode 100644 packages/@sanity/cli/test/test-template/app/(blog)/cover-image.tsx delete mode 100644 packages/@sanity/cli/test/test-template/app/(blog)/date.tsx delete mode 100644 packages/@sanity/cli/test/test-template/app/(blog)/layout.tsx delete mode 100644 packages/@sanity/cli/test/test-template/app/(blog)/more-stories.tsx delete mode 100644 packages/@sanity/cli/test/test-template/app/(blog)/onboarding.tsx delete mode 100644 packages/@sanity/cli/test/test-template/app/(blog)/page.tsx delete mode 100644 packages/@sanity/cli/test/test-template/app/(blog)/portable-text.tsx delete mode 100644 packages/@sanity/cli/test/test-template/app/(blog)/posts/[slug]/page.tsx delete mode 100644 packages/@sanity/cli/test/test-template/app/(sanity)/apple-icon.png delete mode 100644 packages/@sanity/cli/test/test-template/app/(sanity)/icon.ico delete mode 100644 packages/@sanity/cli/test/test-template/app/(sanity)/icon.png delete mode 100644 packages/@sanity/cli/test/test-template/app/(sanity)/icon.svg delete mode 100644 packages/@sanity/cli/test/test-template/app/(sanity)/layout.tsx delete mode 100644 packages/@sanity/cli/test/test-template/app/(sanity)/studio/[[...tool]]/page.tsx delete mode 100644 packages/@sanity/cli/test/test-template/app/api/draft-mode/enable/route.ts delete mode 100644 packages/@sanity/cli/test/test-template/app/favicon.ico delete mode 100644 packages/@sanity/cli/test/test-template/app/globals.css delete mode 100644 packages/@sanity/cli/test/test-template/next.config.ts delete mode 100644 packages/@sanity/cli/test/test-template/package.json delete mode 100644 packages/@sanity/cli/test/test-template/postcss.config.js delete mode 100644 packages/@sanity/cli/test/test-template/sanity.cli.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity.config.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity.types.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity/lib/api.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity/lib/client.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity/lib/demo.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity/lib/fetch.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity/lib/queries.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity/lib/token.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity/lib/utils.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity/plugins/assist.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity/plugins/settings.tsx delete mode 100644 packages/@sanity/cli/test/test-template/sanity/schemas/documents/author.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity/schemas/documents/post.ts delete mode 100644 packages/@sanity/cli/test/test-template/sanity/schemas/singletons/settings.tsx delete mode 100644 packages/@sanity/cli/test/test-template/schema.json delete mode 100644 packages/@sanity/cli/test/test-template/tailwind.config.ts delete mode 100644 packages/@sanity/cli/test/test-template/tsconfig.json 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 bc571d60bf69a93d5debb376809e95effe5b9421..0000000000000000000000000000000000000000 GIT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#Lf=jY%_FG^Y?8?YSDZLGDd>zwzvP%hgovpl@~F z83b;2@`WNLs`|x-=qUmDLwTm1nEopg2t!+8_HL z0Dn?6$6{M{cy(^K18IUwUmi3;0i8%4bg?(t%h(R?WWo^t%r zl-gQvk3n^ie{Nz(%K#B+O~)7#mwQm*G}K`7xmdny>6tS31YaE|m$Xx;z+w7TuFc)v z;{*amtKel0)$P#&ZhEaGBM zAsHO>J*u~Gg{Oa4d)f#>#KRBao)@M}v1jEBdH5!=%}ym5Ze-@7Nw`^Scw1qaR(=D3^kdN&Z{j+gVf0ru#N&Ov bE2>4$rH`-UA(7WFA&HKrKKw1rF8cofs=mk# 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 3f67d3e8e86ed351662fe8528516d0e8662c38e2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4286 zcmeHLOKa3n6psJEmFsQ_E`*{*MSL*U5w(<3>-$xu+KRfp=bm%sjvy@J zpQuEN-2L0BRP!cs1LN=R^_d8_ef?p9qh)ljoR%y2=hvR=$oFRKuCk!$?Ci`enn z`ya%utrM|&vk2*t=!A@c8w?M}G>lK`1-U<>p)bwQctDComxg^3?maHWbmBY5 zscQ@?H-%@Drh^hjpB1?}vAo8^cNVZJ8C(bQ?*ndIHxBvW=xGIekI85|s~|nZO5XYK z$-vcN7T6cZyOff3pFG#Gz2(n7roCb7IseVX%&ZX@zb~!g?jx-rJ^iZhn(3PiuixZg z7=X(1zVAj6GncP3C~6+mG(8@C+Gicz3f{iYS-AFPZr+T9e_c}+=XzC)jBA*kGc2Aq zrn65C2H$^9AN39}j%PX{JjWkD8(6V1c>EDQ*_YP)n?^pTcnu@=ZSE5)$<#l z@mw-Bo%5}4$>uEDxW2aRZsFoSjD`tl1)B?Y68nrh4bZraF;m3}-L4bd=U0Cyv+n%=vJ*+cs%E zsem|n;W_6!FNTY4>yT`g(0_$tbfR1jnxooRzbD#wBwcEGUL~B}tupt$jIFz*P=9aP eeE;|5aUOw9DtQLXRP6lC&-`@$cK;s`_x&%0O+m;2 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 6320b50010db12663587352ea09d398afbe2e04d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 10466 zcmeHt=U-Dx)b6B!p-C?mqzH&~gd-{~s3=7URhmEm0TB=o0VyG&h&08cfb>KZDN3)R zKr9gjDbhO_rT5-Ka<}Kb_xt?=-Vgch?AdF|-ZN{h=Xqx0OpLE`upVUv0C4E*T{Z&% z4*i7#6f<<$xZkq}U08heZ2SRWk*;y!F~)b4Gbd$7pLww>qlpv&PLzt({mXAM3P+pLg8{cFniHD1Pi)93%p z#9S!Qb3O7;!sUnry+T{=E(ep-#jFMja{qqg`oi==@MFP8bkC8bLb1aWM+8r%CwBQI z#&YK6lt0qkue#neJzQC{y)gK&y3gU^^2)w`X0=;KPL$h^4~*sDoNZjCs#}Lhy%XNn z_@PvrB! zeyX4?=i{O?WxoOT*C9gO`Ru$U_X}*riVLc!1!<6V{yt8QMl=uz2WhWz#eG-Hn;W0R zs9J#7kBwgMLLKQZIVAzs);K`0;`3(C$pPKd+Zy+%OO1^+M8ylZ z74pm7Rt^>*U3=$3{q_sqhqe0^-tK_^~j zbt(Q`Lvf>9w*dK_CY`7c(2@b~M=>|nI$e&HOdewO+<%EZ3NThXJFm1qC-DuK=fdIey z;g+$G?>~R%hZ4_~!ntbqBonkjPup0}Y?c+1bukd4AqckWrK~HrnXtjTCKWpfw0$=8 zgag?0?HwRN&-K)b@!1ANINE`(oxDMZk(Rc!7-PNC0j<4O{ea9bG`fLB>tI z1FY)BL24s`VtxX z=)9Z${-@jQlPfes%>q|*Xa`F)|M%we)CSpcB0hX^elAIU`yg|+(RYvLLp<;Qao?E! z&**OD=}D1M!S=V|<9i}($wUAo`4R%=y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a9b7579..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 af98450595e8b8efd9e505cddc5ed705b665a4d8..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 15086 zcmdU$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$VNX@qMmWifEgC6yB+S|Ng&-_q*kY6P-PKR*oJ$D&4wui>NOkgH3F=P`Ve$ z3oFArk%&op&JP9oiCbR3eqHX}yJupw-hGKM`tJs8Gp0rz*J9ak*s!6TKY!j}B<@Qe z2xHHihfO=4d&@$equD1uh)vR!D_5jhvt}W(F>o+n#QfeP*=Ky4KYza26Uxue7xt`( zwGs1UFEoa2%CXJd6_q!V{lS9=%abQh(nAuU?8F#8U%^agA*f5vUU zO`A5Rzftd-H*XGp=j=}sgJvHomR>El^LJEU_xn@7oB=$3{5YoN^y$-PoVT`!UrwAj z(d>cRyeL=eJNUAXP0n?!TD8j9&dbY_&Ye4l$oA~n)9gP*+v9QJq3wP5KkQGLGDTj# zd};PI#*Q5uVjI0fh76HSn>LxVdoDY_;0u&tn{OaexyiTnfB*h{;fw|QLCcpf4;xpW zFkyme8_o^J(yQeMlzfjrrqcE2$dM!Fd_g$&SWBkEa^gaG!|Jt={ z=KFH#39++i(IT_Yx^(H%ko++GcKr1<|Ih~0rcI04uj!BQ`Z)V#=O2Y;=E9`s-!ShO zsSe!pFZPSf|L}>y>wkcu$o#Ju7{d8q*e4a4|Eapd)ji*PB>xlpq$2UZRgc#`wqyC< z*e8K8>Gg-|00V0nbj5maWeG|22l`3AlJ{NwJ|l|`ufMHXz7k^tYsg%g=)+?N8;M_9LtdS2KI3UcQZk+)cWFG|X4L^R?nKNgM zJp7#1#y{fx7Zcyn1ijH<*t+zGuIF{p8Z6OUCbF zJuqm{AfqFUdUSJ))2_z+s>OeFWelDY)Ji4$N2uccI^tDkzj4ezJD0s z6WNgVqu%*n4eJGq6%4dL{ ({ - 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"] -}