Skip to content

Commit

Permalink
chore(prettier): 🤖 ✨ (#39)
Browse files Browse the repository at this point in the history
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
ecospark[bot] and github-actions[bot] authored Aug 14, 2023
1 parent 6c34d44 commit 652351d
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 30 deletions.
4 changes: 1 addition & 3 deletions .github/renovate.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
{
"description": "Check the readme: https://github.com/sanity-io/renovate-presets/blob/main/ecosystem/README.md",
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"github>sanity-io/renovate-config:starter-template"
]
"extends": ["github>sanity-io/renovate-config:starter-template"]
}
26 changes: 13 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ You can use this starter to kick-start a clean slate site or learn these technol

# Important files and folders

| File(s) | Description |
| --------------------------------------- | ------------------------------------------------------------------------------------- |
| `sanity.config.ts` | Config file for Sanity Studio |
| `sanity.cli.ts` | Config file for Sanity CLI |
| `/pages/index.tsx` | Landing page for `/`. |
| `/pages/studio/[[...index]].tsx` | Where Sanity Studio is mounted |
| `/pages/api/draft.ts` | Serverless route for triggering Draft mode |
| `/sanity/schemas.ts` | Where Sanity Studio gets its content types from |
| `/sanity/env.ts` | Configuration for the Sanity project and dataset |
| `/sanity/schemas.ts` | Where Sanity Studio gets its content types from |
| `/sanity/lib/client.ts` | Sanity client configured based on `env.ts` |
| `/sanity/lib/image.ts` | Sanity image builder - unused in this template, but is needed to render Sanity images |
| `tailwind.config.js` | Tailwind config. Only applies to files listed under `content` |
| File(s) | Description |
| -------------------------------- | ------------------------------------------------------------------------------------- |
| `sanity.config.ts` | Config file for Sanity Studio |
| `sanity.cli.ts` | Config file for Sanity CLI |
| `/pages/index.tsx` | Landing page for `/`. |
| `/pages/studio/[[...index]].tsx` | Where Sanity Studio is mounted |
| `/pages/api/draft.ts` | Serverless route for triggering Draft mode |
| `/sanity/schemas.ts` | Where Sanity Studio gets its content types from |
| `/sanity/env.ts` | Configuration for the Sanity project and dataset |
| `/sanity/schemas.ts` | Where Sanity Studio gets its content types from |
| `/sanity/lib/client.ts` | Sanity client configured based on `env.ts` |
| `/sanity/lib/image.ts` | Sanity image builder - unused in this template, but is needed to render Sanity images |
| `tailwind.config.js` | Tailwind config. Only applies to files listed under `content` |

All pages are wrapped in `pages/_document.tsx` and `pages/_app.tsx`.

Expand Down
15 changes: 7 additions & 8 deletions sanity.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { schema } from '~/schemas'
const iframeOptions = {
url: defineUrlResolver({
base: '/api/draft',
requiresSlug:['post'],
requiresSlug: ['post'],
}),
urlSecretId: previewSecretId,
reload: { button: true },
Expand All @@ -46,13 +46,12 @@ export default defineConfig({
// It's part of the Studio's “Structure Builder API” and is documented here:
// https://www.sanity.io/docs/structure-builder-reference
defaultDocumentNode: (S, { schemaType }) => {
return S.document().views([
// Default form view
S.view.form(),
// Preview
S.view.component(Iframe).options(iframeOptions).title('Preview'),
])

return S.document().views([
// Default form view
S.view.form(),
// Preview
S.view.component(Iframe).options(iframeOptions).title('Preview'),
])
},
}),
// Add the "Open preview" action
Expand Down
7 changes: 1 addition & 6 deletions src/pages/api/draft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,9 @@ export default async function preview(
token: readToken,
})


// This is the most common way to check for auth, but we encourage you to use your existing auth
// infra to protect your token and securely transmit it to the client
const validSecret = await isValidSecret(
authClient,
previewSecretId,
secret
)
const validSecret = await isValidSecret(authClient, previewSecretId, secret)
if (!validSecret) {
return res.status(401).send('Invalid secret')
}
Expand Down

1 comment on commit 652351d

@vercel
Copy link

@vercel vercel bot commented on 652351d Aug 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

template-nextjs-clean – ./

template-nextjs-clean-git-main.sanity.build
template-nextjs-clean.sanity.build

Please sign in to comment.