-
-
Notifications
You must be signed in to change notification settings - Fork 52
/
sanity.config.ts
63 lines (56 loc) · 1.42 KB
/
sanity.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
'use client'
import { defineConfig } from 'sanity'
import { projectId, dataset } from '@/sanity/lib/env'
import { structure } from './src/sanity/structure'
import { presentation } from './src/sanity/presentation'
import {
dashboardTool,
projectInfoWidget,
projectUsersWidget,
} from '@sanity/dashboard'
import { infoWidget } from './src/sanity/InfoWidget'
import { vercelWidget } from 'sanity-plugin-dashboard-widget-vercel'
import { visionTool } from '@sanity/vision'
import { codeInput } from '@sanity/code-input'
import { schemaTypes } from './src/sanity/schemaTypes'
const singletonTypes = ['site']
export default defineConfig({
projectId,
dataset,
basePath: '/admin',
plugins: [
structure,
presentation,
dashboardTool({
name: 'deployment',
title: 'Deployment',
widgets: [vercelWidget()],
}),
dashboardTool({
name: 'info',
title: 'Info',
widgets: [projectInfoWidget(), projectUsersWidget(), infoWidget()],
}),
visionTool(),
codeInput(),
],
tasks: { enabled: false },
scheduledPublishing: { enabled: false },
schema: {
types: schemaTypes,
templates: (templates) =>
templates.filter(
({ schemaType }) => !singletonTypes.includes(schemaType),
),
},
document: {
actions: (input, { schemaType }) =>
singletonTypes.includes(schemaType)
? input.filter(
({ action }) =>
action &&
['publish', 'discardChanges', 'restore'].includes(action),
)
: input,
},
})