forked from nuotsu/sanitypress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sanity.config.ts
82 lines (75 loc) · 1.79 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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
'use client'
import { defineConfig } from 'sanity'
import { projectId, dataset } from '@/sanity/lib/env'
import { structureTool } from 'sanity/structure'
import { structure } from './src/sanity/structure'
import { presentationTool } from 'sanity/presentation'
import { resolve } from './src/sanity/presentation/resolve'
import {
dashboardTool,
projectInfoWidget,
projectUsersWidget,
} from '@sanity/dashboard'
import { sanitypressGuideWidget } from './src/sanity/sanitypressGuideWidget'
import { vercelWidget } from 'sanity-plugin-dashboard-widget-vercel'
import { visionTool } from '@sanity/vision'
import { codeInput } from '@sanity/code-input'
import { schemaTypes } from './src/sanity/schemas'
const singletonTypes = ['site']
export default defineConfig({
projectId,
dataset,
basePath: '/admin',
plugins: [
structureTool({
name: 'content',
title: 'Content',
structure,
}),
presentationTool({
name: 'editor',
title: 'Editor',
previewUrl: {
previewMode: {
enable: '/api/draft-mode/enable',
},
},
resolve,
}),
dashboardTool({
name: 'deployment',
title: 'Deployment',
widgets: [vercelWidget()],
}),
dashboardTool({
name: 'info',
title: 'Info',
widgets: [
projectInfoWidget(),
projectUsersWidget(),
sanitypressGuideWidget(),
],
}),
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,
},
})