@sanity/cli-test 0.0.0-20260410130107
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +260 -0
- package/dist/index.d.ts +531 -0
- package/dist/index.js +13 -0
- package/dist/index.js.map +1 -0
- package/dist/test/captureOutput.js +83 -0
- package/dist/test/captureOutput.js.map +1 -0
- package/dist/test/constants.js +24 -0
- package/dist/test/constants.js.map +1 -0
- package/dist/test/createTestClient.js +53 -0
- package/dist/test/createTestClient.js.map +1 -0
- package/dist/test/createTestToken.js +13 -0
- package/dist/test/createTestToken.js.map +1 -0
- package/dist/test/mockApi.js +16 -0
- package/dist/test/mockApi.js.map +1 -0
- package/dist/test/mockSanityCommand.js +71 -0
- package/dist/test/mockSanityCommand.js.map +1 -0
- package/dist/test/mockTelemetry.js +24 -0
- package/dist/test/mockTelemetry.js.map +1 -0
- package/dist/test/setupFixtures.js +140 -0
- package/dist/test/setupFixtures.js.map +1 -0
- package/dist/test/snapshotSerializer.js +12 -0
- package/dist/test/snapshotSerializer.js.map +1 -0
- package/dist/test/testCommand.js +19 -0
- package/dist/test/testCommand.js.map +1 -0
- package/dist/test/testFixture.js +112 -0
- package/dist/test/testFixture.js.map +1 -0
- package/dist/test/testHook.js +43 -0
- package/dist/test/testHook.js.map +1 -0
- package/dist/utils/fileExists.js +13 -0
- package/dist/utils/fileExists.js.map +1 -0
- package/dist/utils/paths.js +66 -0
- package/dist/utils/paths.js.map +1 -0
- package/dist/vitest.d.ts +121 -0
- package/dist/vitest.js +22 -0
- package/dist/vitest.js.map +1 -0
- package/dist/vitestWorker.js +135 -0
- package/dist/vitestWorker.js.map +1 -0
- package/fixtures/basic-app/package.json +25 -0
- package/fixtures/basic-app/sanity.cli.ts +12 -0
- package/fixtures/basic-app/src/App.css +20 -0
- package/fixtures/basic-app/src/App.tsx +26 -0
- package/fixtures/basic-app/src/ExampleComponent.css +84 -0
- package/fixtures/basic-app/src/ExampleComponent.tsx +38 -0
- package/fixtures/basic-app/tsconfig.json +17 -0
- package/fixtures/basic-functions/functions/test-function/index.ts +7 -0
- package/fixtures/basic-functions/package.json +14 -0
- package/fixtures/basic-functions/sanity.blueprint.ts +5 -0
- package/fixtures/basic-studio/package.json +28 -0
- package/fixtures/basic-studio/sanity.cli.ts +11 -0
- package/fixtures/basic-studio/sanity.config.ts +18 -0
- package/fixtures/basic-studio/schemaTypes/author.ts +52 -0
- package/fixtures/basic-studio/schemaTypes/blockContent.ts +71 -0
- package/fixtures/basic-studio/schemaTypes/category.ts +20 -0
- package/fixtures/basic-studio/schemaTypes/index.ts +6 -0
- package/fixtures/basic-studio/schemaTypes/post.ts +67 -0
- package/fixtures/basic-studio/tsconfig.json +17 -0
- package/fixtures/federated-studio/package.json +24 -0
- package/fixtures/federated-studio/sanity.cli.ts +14 -0
- package/fixtures/federated-studio/sanity.config.ts +17 -0
- package/fixtures/federated-studio/schemaTypes/index.ts +1 -0
- package/fixtures/federated-studio/tsconfig.json +17 -0
- package/fixtures/graphql-studio/package.json +25 -0
- package/fixtures/graphql-studio/sanity.cli.ts +20 -0
- package/fixtures/graphql-studio/sanity.config.ts +37 -0
- package/fixtures/graphql-studio/schemaTypes/author.ts +52 -0
- package/fixtures/graphql-studio/schemaTypes/blockContent.ts +71 -0
- package/fixtures/graphql-studio/schemaTypes/category.ts +20 -0
- package/fixtures/graphql-studio/schemaTypes/event.ts +25 -0
- package/fixtures/graphql-studio/schemaTypes/index.ts +10 -0
- package/fixtures/graphql-studio/schemaTypes/post.ts +67 -0
- package/fixtures/graphql-studio/tsconfig.json +17 -0
- package/fixtures/multi-workspace-studio/package.json +28 -0
- package/fixtures/multi-workspace-studio/sanity.cli.ts +11 -0
- package/fixtures/multi-workspace-studio/sanity.config.ts +37 -0
- package/fixtures/multi-workspace-studio/schemaTypes/author.ts +52 -0
- package/fixtures/multi-workspace-studio/schemaTypes/blockContent.ts +70 -0
- package/fixtures/multi-workspace-studio/schemaTypes/category.ts +20 -0
- package/fixtures/multi-workspace-studio/schemaTypes/index.ts +6 -0
- package/fixtures/multi-workspace-studio/schemaTypes/post.ts +67 -0
- package/fixtures/multi-workspace-studio/tsconfig.json +17 -0
- package/fixtures/prebuilt-app/README.md +3 -0
- package/fixtures/prebuilt-app/dist/favicon.ico +0 -0
- package/fixtures/prebuilt-app/dist/index.html +102 -0
- package/fixtures/prebuilt-app/dist/static/sanity-CtOxKsdo.css +24 -0
- package/fixtures/prebuilt-app/dist/static/sanity-D4a4eOYZ.js +17 -0
- package/fixtures/prebuilt-app/package.json +25 -0
- package/fixtures/prebuilt-app/sanity.cli.ts +12 -0
- package/fixtures/prebuilt-app/src/App.css +20 -0
- package/fixtures/prebuilt-app/src/App.tsx +24 -0
- package/fixtures/prebuilt-app/tsconfig.json +17 -0
- package/fixtures/prebuilt-studio/README.md +3 -0
- package/fixtures/prebuilt-studio/dist/favicon.ico +0 -0
- package/fixtures/prebuilt-studio/dist/index.html +113 -0
- package/fixtures/prebuilt-studio/dist/static/sanity-DxH-rpFr.js +9 -0
- package/fixtures/prebuilt-studio/package.json +25 -0
- package/fixtures/prebuilt-studio/sanity.cli.ts +11 -0
- package/fixtures/prebuilt-studio/sanity.config.ts +11 -0
- package/fixtures/prebuilt-studio/tsconfig.json +17 -0
- package/fixtures/worst-case-studio/.env +1 -0
- package/fixtures/worst-case-studio/README.md +22 -0
- package/fixtures/worst-case-studio/fieldComponentsTest.tsx +80 -0
- package/fixtures/worst-case-studio/package.json +33 -0
- package/fixtures/worst-case-studio/sanity.cli.ts +16 -0
- package/fixtures/worst-case-studio/sanity.config.tsx +55 -0
- package/fixtures/worst-case-studio/src/browserGlobalsCheck.ts +14 -0
- package/fixtures/worst-case-studio/src/defines.ts +8 -0
- package/fixtures/worst-case-studio/src/descriptionIcon.svg +7 -0
- package/fixtures/worst-case-studio/src/descriptionInput.module.css +13 -0
- package/fixtures/worst-case-studio/src/descriptionInput.tsx +55 -0
- package/fixtures/worst-case-studio/src/schemaTypes/author.ts +52 -0
- package/fixtures/worst-case-studio/src/schemaTypes/blockContent.ts +70 -0
- package/fixtures/worst-case-studio/src/schemaTypes/category.ts +20 -0
- package/fixtures/worst-case-studio/src/schemaTypes/index.ts +6 -0
- package/fixtures/worst-case-studio/src/schemaTypes/post.ts +71 -0
- package/fixtures/worst-case-studio/src/typings.d.ts +37 -0
- package/fixtures/worst-case-studio/tsconfig.json +22 -0
- package/package.json +97 -0
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import {visionTool} from '@sanity/vision'
|
|
2
|
+
import {defineConfig} from 'sanity'
|
|
3
|
+
import {structureTool} from 'sanity/structure'
|
|
4
|
+
|
|
5
|
+
import {schemaTypes} from './schemaTypes'
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
title: 'Basic Studio',
|
|
9
|
+
|
|
10
|
+
dataset: 'test',
|
|
11
|
+
projectId: 'ppsg7ml5',
|
|
12
|
+
|
|
13
|
+
plugins: [structureTool(), visionTool()],
|
|
14
|
+
|
|
15
|
+
schema: {
|
|
16
|
+
types: schemaTypes,
|
|
17
|
+
},
|
|
18
|
+
})
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {defineField, defineType} from 'sanity'
|
|
2
|
+
|
|
3
|
+
export default defineType({
|
|
4
|
+
name: 'author',
|
|
5
|
+
title: 'Author',
|
|
6
|
+
type: 'document',
|
|
7
|
+
|
|
8
|
+
fields: [
|
|
9
|
+
defineField({
|
|
10
|
+
name: 'name',
|
|
11
|
+
title: 'Name',
|
|
12
|
+
type: 'string',
|
|
13
|
+
}),
|
|
14
|
+
defineField({
|
|
15
|
+
name: 'slug',
|
|
16
|
+
options: {
|
|
17
|
+
maxLength: 96,
|
|
18
|
+
source: 'name',
|
|
19
|
+
},
|
|
20
|
+
title: 'Slug',
|
|
21
|
+
type: 'slug',
|
|
22
|
+
}),
|
|
23
|
+
defineField({
|
|
24
|
+
name: 'image',
|
|
25
|
+
options: {
|
|
26
|
+
hotspot: true,
|
|
27
|
+
},
|
|
28
|
+
title: 'Image',
|
|
29
|
+
type: 'image',
|
|
30
|
+
}),
|
|
31
|
+
defineField({
|
|
32
|
+
name: 'bio',
|
|
33
|
+
of: [
|
|
34
|
+
{
|
|
35
|
+
lists: [],
|
|
36
|
+
styles: [{title: 'Normal', value: 'normal'}],
|
|
37
|
+
title: 'Block',
|
|
38
|
+
type: 'block',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
title: 'Bio',
|
|
42
|
+
type: 'array',
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
preview: {
|
|
47
|
+
select: {
|
|
48
|
+
media: 'image',
|
|
49
|
+
title: 'name',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
})
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {defineArrayMember, defineType} from 'sanity'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is the schema definition for the rich text fields used for
|
|
5
|
+
* for this blog studio. When you import it in schemas.js it can be
|
|
6
|
+
* reused in other parts of the studio with:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* {
|
|
10
|
+
* name: 'someName',
|
|
11
|
+
* title: 'Some title',
|
|
12
|
+
* type: 'blockContent'
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export default defineType({
|
|
17
|
+
name: 'blockContent',
|
|
18
|
+
title: 'Block Content',
|
|
19
|
+
type: 'array',
|
|
20
|
+
|
|
21
|
+
of: [
|
|
22
|
+
defineArrayMember({
|
|
23
|
+
lists: [{title: 'Bullet', value: 'bullet'}],
|
|
24
|
+
// Marks let you mark up inline text in the block editor.
|
|
25
|
+
marks: {
|
|
26
|
+
// Annotations can be any object structure – e.g. a link or a footnote.
|
|
27
|
+
annotations: [
|
|
28
|
+
{
|
|
29
|
+
fields: [
|
|
30
|
+
{
|
|
31
|
+
name: 'href',
|
|
32
|
+
title: 'URL',
|
|
33
|
+
type: 'url',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
name: 'link',
|
|
37
|
+
title: 'URL',
|
|
38
|
+
type: 'object',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
// Decorators usually describe a single property – e.g. a typographic
|
|
42
|
+
// preference or highlighting by editors.
|
|
43
|
+
decorators: [
|
|
44
|
+
{title: 'Strong', value: 'strong'},
|
|
45
|
+
{title: 'Emphasis', value: 'em'},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
// Styles let you set what your user can mark up blocks with. These
|
|
49
|
+
// correspond with HTML tags, but you can set any title or value
|
|
50
|
+
// you want and decide how you want to deal with it where you want to
|
|
51
|
+
// use your content.
|
|
52
|
+
styles: [
|
|
53
|
+
{title: 'Normal', value: 'normal'},
|
|
54
|
+
{title: 'H1', value: 'h1'},
|
|
55
|
+
{title: 'H2', value: 'h2'},
|
|
56
|
+
{title: 'H3', value: 'h3'},
|
|
57
|
+
{title: 'H4', value: 'h4'},
|
|
58
|
+
{title: 'Quote', value: 'blockquote'},
|
|
59
|
+
],
|
|
60
|
+
title: 'Block',
|
|
61
|
+
type: 'block',
|
|
62
|
+
}),
|
|
63
|
+
// You can add additional types here. Note that you can't use
|
|
64
|
+
// primitive types such as 'string' and 'number' in the same array
|
|
65
|
+
// as a block type.
|
|
66
|
+
defineArrayMember({
|
|
67
|
+
options: {hotspot: true},
|
|
68
|
+
type: 'image',
|
|
69
|
+
}),
|
|
70
|
+
],
|
|
71
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {defineField, defineType} from 'sanity'
|
|
2
|
+
|
|
3
|
+
export default defineType({
|
|
4
|
+
name: 'category',
|
|
5
|
+
title: 'Category',
|
|
6
|
+
type: 'document',
|
|
7
|
+
|
|
8
|
+
fields: [
|
|
9
|
+
defineField({
|
|
10
|
+
name: 'title',
|
|
11
|
+
title: 'Title',
|
|
12
|
+
type: 'string',
|
|
13
|
+
}),
|
|
14
|
+
defineField({
|
|
15
|
+
name: 'description',
|
|
16
|
+
title: 'Description',
|
|
17
|
+
type: 'text',
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
})
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {defineField, defineType} from 'sanity'
|
|
2
|
+
|
|
3
|
+
export default defineType({
|
|
4
|
+
name: 'post',
|
|
5
|
+
title: 'Post',
|
|
6
|
+
type: 'document',
|
|
7
|
+
|
|
8
|
+
fields: [
|
|
9
|
+
defineField({
|
|
10
|
+
name: 'title',
|
|
11
|
+
title: 'Title',
|
|
12
|
+
type: 'string',
|
|
13
|
+
}),
|
|
14
|
+
defineField({
|
|
15
|
+
name: 'slug',
|
|
16
|
+
options: {
|
|
17
|
+
maxLength: 96,
|
|
18
|
+
source: 'title',
|
|
19
|
+
},
|
|
20
|
+
title: 'Slug',
|
|
21
|
+
type: 'slug',
|
|
22
|
+
}),
|
|
23
|
+
defineField({
|
|
24
|
+
name: 'author',
|
|
25
|
+
title: 'Author',
|
|
26
|
+
to: {type: 'author'},
|
|
27
|
+
type: 'reference',
|
|
28
|
+
}),
|
|
29
|
+
defineField({
|
|
30
|
+
name: 'mainImage',
|
|
31
|
+
options: {
|
|
32
|
+
hotspot: true,
|
|
33
|
+
},
|
|
34
|
+
title: 'Main image',
|
|
35
|
+
type: 'image',
|
|
36
|
+
}),
|
|
37
|
+
defineField({
|
|
38
|
+
name: 'categories',
|
|
39
|
+
of: [{to: {type: 'category'}, type: 'reference'}],
|
|
40
|
+
title: 'Categories',
|
|
41
|
+
type: 'array',
|
|
42
|
+
}),
|
|
43
|
+
defineField({
|
|
44
|
+
name: 'publishedAt',
|
|
45
|
+
title: 'Published at',
|
|
46
|
+
type: 'datetime',
|
|
47
|
+
}),
|
|
48
|
+
defineField({
|
|
49
|
+
name: 'body',
|
|
50
|
+
title: 'Body',
|
|
51
|
+
type: 'blockContent',
|
|
52
|
+
}),
|
|
53
|
+
],
|
|
54
|
+
|
|
55
|
+
preview: {
|
|
56
|
+
select: {
|
|
57
|
+
author: 'author.name',
|
|
58
|
+
media: 'mainImage',
|
|
59
|
+
title: 'title',
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
prepare(selection) {
|
|
63
|
+
const {author} = selection
|
|
64
|
+
return {...selection, subtitle: author && `by ${author}`}
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
})
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"module": "Preserve",
|
|
10
|
+
"moduleDetection": "force",
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"jsx": "preserve",
|
|
13
|
+
"incremental": true
|
|
14
|
+
},
|
|
15
|
+
"include": ["**/*.ts", "**/*.tsx"],
|
|
16
|
+
"exclude": ["node_modules"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "federated-studio",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"keywords": [
|
|
6
|
+
"sanity"
|
|
7
|
+
],
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "sanity dev",
|
|
12
|
+
"build:fixture": "sanity build"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"react": "^19.2.3",
|
|
16
|
+
"react-dom": "^19.2.3",
|
|
17
|
+
"sanity": "^5.18.0",
|
|
18
|
+
"styled-components": "^6.3.8"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/react": "^19.2.9",
|
|
22
|
+
"typescript": "^5.9.3"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {defineConfig} from 'sanity'
|
|
2
|
+
import {structureTool} from 'sanity/structure'
|
|
3
|
+
|
|
4
|
+
import {schemaTypes} from './schemaTypes'
|
|
5
|
+
|
|
6
|
+
export default defineConfig({
|
|
7
|
+
title: 'Basic Studio',
|
|
8
|
+
|
|
9
|
+
dataset: 'test',
|
|
10
|
+
projectId: 'ppsg7ml5',
|
|
11
|
+
|
|
12
|
+
plugins: [structureTool()],
|
|
13
|
+
|
|
14
|
+
schema: {
|
|
15
|
+
types: schemaTypes,
|
|
16
|
+
},
|
|
17
|
+
})
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const schemaTypes = []
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ES2017",
|
|
4
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
5
|
+
"allowJs": true,
|
|
6
|
+
"skipLibCheck": true,
|
|
7
|
+
"strict": true,
|
|
8
|
+
"forceConsistentCasingInFileNames": true,
|
|
9
|
+
"module": "Preserve",
|
|
10
|
+
"moduleDetection": "force",
|
|
11
|
+
"isolatedModules": true,
|
|
12
|
+
"jsx": "preserve",
|
|
13
|
+
"incremental": true
|
|
14
|
+
},
|
|
15
|
+
"include": ["**/*.ts", "**/*.tsx"],
|
|
16
|
+
"exclude": ["node_modules"]
|
|
17
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "graphql-studio",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"keywords": [
|
|
6
|
+
"sanity"
|
|
7
|
+
],
|
|
8
|
+
"license": "MIT",
|
|
9
|
+
"type": "module",
|
|
10
|
+
"main": "package.json",
|
|
11
|
+
"scripts": {
|
|
12
|
+
"deploy-graphql": "sanity graphql deploy"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@sanity/vision": "^5.18.0",
|
|
16
|
+
"react": "^19.2.3",
|
|
17
|
+
"react-dom": "^19.2.3",
|
|
18
|
+
"sanity": "^5.18.0",
|
|
19
|
+
"styled-components": "^6.3.8"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/react": "^19.2.9",
|
|
23
|
+
"typescript": "^5.9.3"
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {defineCliConfig} from 'sanity/cli'
|
|
2
|
+
|
|
3
|
+
export default defineCliConfig({
|
|
4
|
+
api: {
|
|
5
|
+
dataset: 'production',
|
|
6
|
+
projectId: 'ppsg7ml5',
|
|
7
|
+
},
|
|
8
|
+
graphql: [
|
|
9
|
+
{
|
|
10
|
+
id: 'production-api',
|
|
11
|
+
tag: 'default',
|
|
12
|
+
workspace: 'production',
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
id: 'staging-api',
|
|
16
|
+
tag: 'staging',
|
|
17
|
+
workspace: 'staging',
|
|
18
|
+
},
|
|
19
|
+
],
|
|
20
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import {visionTool} from '@sanity/vision'
|
|
2
|
+
import {defineConfig} from 'sanity'
|
|
3
|
+
import {structureTool} from 'sanity/structure'
|
|
4
|
+
|
|
5
|
+
import {productionSchemaTypes, stagingSchemaTypes} from './schemaTypes'
|
|
6
|
+
|
|
7
|
+
export default defineConfig([
|
|
8
|
+
{
|
|
9
|
+
basePath: '/production',
|
|
10
|
+
name: 'production',
|
|
11
|
+
title: 'Production',
|
|
12
|
+
|
|
13
|
+
dataset: 'production',
|
|
14
|
+
projectId: 'ppsg7ml5',
|
|
15
|
+
|
|
16
|
+
plugins: [structureTool(), visionTool()],
|
|
17
|
+
|
|
18
|
+
schema: {
|
|
19
|
+
types: productionSchemaTypes,
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
|
|
23
|
+
{
|
|
24
|
+
basePath: '/staging',
|
|
25
|
+
name: 'staging',
|
|
26
|
+
title: 'Staging',
|
|
27
|
+
|
|
28
|
+
dataset: 'staging',
|
|
29
|
+
projectId: 'ppsg7ml5',
|
|
30
|
+
|
|
31
|
+
plugins: [structureTool(), visionTool()],
|
|
32
|
+
|
|
33
|
+
schema: {
|
|
34
|
+
types: stagingSchemaTypes,
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
])
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import {defineField, defineType} from 'sanity'
|
|
2
|
+
|
|
3
|
+
export default defineType({
|
|
4
|
+
name: 'author',
|
|
5
|
+
title: 'Author',
|
|
6
|
+
type: 'document',
|
|
7
|
+
|
|
8
|
+
fields: [
|
|
9
|
+
defineField({
|
|
10
|
+
name: 'name',
|
|
11
|
+
title: 'Name',
|
|
12
|
+
type: 'string',
|
|
13
|
+
}),
|
|
14
|
+
defineField({
|
|
15
|
+
name: 'slug',
|
|
16
|
+
options: {
|
|
17
|
+
maxLength: 96,
|
|
18
|
+
source: 'name',
|
|
19
|
+
},
|
|
20
|
+
title: 'Slug',
|
|
21
|
+
type: 'slug',
|
|
22
|
+
}),
|
|
23
|
+
defineField({
|
|
24
|
+
name: 'image',
|
|
25
|
+
options: {
|
|
26
|
+
hotspot: true,
|
|
27
|
+
},
|
|
28
|
+
title: 'Image',
|
|
29
|
+
type: 'image',
|
|
30
|
+
}),
|
|
31
|
+
defineField({
|
|
32
|
+
name: 'bio',
|
|
33
|
+
of: [
|
|
34
|
+
{
|
|
35
|
+
lists: [],
|
|
36
|
+
styles: [{title: 'Normal', value: 'normal'}],
|
|
37
|
+
title: 'Block',
|
|
38
|
+
type: 'block',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
title: 'Bio',
|
|
42
|
+
type: 'array',
|
|
43
|
+
}),
|
|
44
|
+
],
|
|
45
|
+
|
|
46
|
+
preview: {
|
|
47
|
+
select: {
|
|
48
|
+
media: 'image',
|
|
49
|
+
title: 'name',
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
})
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import {defineArrayMember, defineType} from 'sanity'
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* This is the schema definition for the rich text fields used for
|
|
5
|
+
* for this blog studio. When you import it in schemas.js it can be
|
|
6
|
+
* reused in other parts of the studio with:
|
|
7
|
+
*
|
|
8
|
+
* ```ts
|
|
9
|
+
* {
|
|
10
|
+
* name: 'someName',
|
|
11
|
+
* title: 'Some title',
|
|
12
|
+
* type: 'blockContent'
|
|
13
|
+
* }
|
|
14
|
+
* ```
|
|
15
|
+
*/
|
|
16
|
+
export default defineType({
|
|
17
|
+
name: 'blockContent',
|
|
18
|
+
title: 'Block Content',
|
|
19
|
+
type: 'array',
|
|
20
|
+
|
|
21
|
+
of: [
|
|
22
|
+
defineArrayMember({
|
|
23
|
+
lists: [{title: 'Bullet', value: 'bullet'}],
|
|
24
|
+
// Marks let you mark up inline text in the block editor.
|
|
25
|
+
marks: {
|
|
26
|
+
// Annotations can be any object structure – e.g. a link or a footnote.
|
|
27
|
+
annotations: [
|
|
28
|
+
{
|
|
29
|
+
fields: [
|
|
30
|
+
{
|
|
31
|
+
name: 'href',
|
|
32
|
+
title: 'URL',
|
|
33
|
+
type: 'url',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
name: 'link',
|
|
37
|
+
title: 'URL',
|
|
38
|
+
type: 'object',
|
|
39
|
+
},
|
|
40
|
+
],
|
|
41
|
+
// Decorators usually describe a single property – e.g. a typographic
|
|
42
|
+
// preference or highlighting by editors.
|
|
43
|
+
decorators: [
|
|
44
|
+
{title: 'Strong', value: 'strong'},
|
|
45
|
+
{title: 'Emphasis', value: 'em'},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
// Styles let you set what your user can mark up blocks with. These
|
|
49
|
+
// correspond with HTML tags, but you can set any title or value
|
|
50
|
+
// you want and decide how you want to deal with it where you want to
|
|
51
|
+
// use your content.
|
|
52
|
+
styles: [
|
|
53
|
+
{title: 'Normal', value: 'normal'},
|
|
54
|
+
{title: 'H1', value: 'h1'},
|
|
55
|
+
{title: 'H2', value: 'h2'},
|
|
56
|
+
{title: 'H3', value: 'h3'},
|
|
57
|
+
{title: 'H4', value: 'h4'},
|
|
58
|
+
{title: 'Quote', value: 'blockquote'},
|
|
59
|
+
],
|
|
60
|
+
title: 'Block',
|
|
61
|
+
type: 'block',
|
|
62
|
+
}),
|
|
63
|
+
// You can add additional types here. Note that you can't use
|
|
64
|
+
// primitive types such as 'string' and 'number' in the same array
|
|
65
|
+
// as a block type.
|
|
66
|
+
defineArrayMember({
|
|
67
|
+
options: {hotspot: true},
|
|
68
|
+
type: 'image',
|
|
69
|
+
}),
|
|
70
|
+
],
|
|
71
|
+
})
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import {defineField, defineType} from 'sanity'
|
|
2
|
+
|
|
3
|
+
export default defineType({
|
|
4
|
+
name: 'category',
|
|
5
|
+
title: 'Category',
|
|
6
|
+
type: 'document',
|
|
7
|
+
|
|
8
|
+
fields: [
|
|
9
|
+
defineField({
|
|
10
|
+
name: 'title',
|
|
11
|
+
title: 'Title',
|
|
12
|
+
type: 'string',
|
|
13
|
+
}),
|
|
14
|
+
defineField({
|
|
15
|
+
name: 'description',
|
|
16
|
+
title: 'Description',
|
|
17
|
+
type: 'text',
|
|
18
|
+
}),
|
|
19
|
+
],
|
|
20
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import {defineField, defineType} from 'sanity'
|
|
2
|
+
|
|
3
|
+
export default defineType({
|
|
4
|
+
name: 'event',
|
|
5
|
+
title: 'Event',
|
|
6
|
+
type: 'document',
|
|
7
|
+
|
|
8
|
+
fields: [
|
|
9
|
+
defineField({
|
|
10
|
+
name: 'title',
|
|
11
|
+
title: 'Title',
|
|
12
|
+
type: 'string',
|
|
13
|
+
}),
|
|
14
|
+
defineField({
|
|
15
|
+
name: 'date',
|
|
16
|
+
title: 'Date',
|
|
17
|
+
type: 'datetime',
|
|
18
|
+
}),
|
|
19
|
+
defineField({
|
|
20
|
+
name: 'venue',
|
|
21
|
+
title: 'Venue',
|
|
22
|
+
type: 'string',
|
|
23
|
+
}),
|
|
24
|
+
],
|
|
25
|
+
})
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import author from './author'
|
|
2
|
+
import blockContent from './blockContent'
|
|
3
|
+
import category from './category'
|
|
4
|
+
import event from './event'
|
|
5
|
+
import post from './post'
|
|
6
|
+
|
|
7
|
+
// Both workspaces share post, author, category, blockContent
|
|
8
|
+
// Staging additionally includes event
|
|
9
|
+
export const productionSchemaTypes = [post, author, category, blockContent]
|
|
10
|
+
export const stagingSchemaTypes = [post, author, category, event, blockContent]
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import {defineField, defineType} from 'sanity'
|
|
2
|
+
|
|
3
|
+
export default defineType({
|
|
4
|
+
name: 'post',
|
|
5
|
+
title: 'Post',
|
|
6
|
+
type: 'document',
|
|
7
|
+
|
|
8
|
+
fields: [
|
|
9
|
+
defineField({
|
|
10
|
+
name: 'title',
|
|
11
|
+
title: 'Title',
|
|
12
|
+
type: 'string',
|
|
13
|
+
}),
|
|
14
|
+
defineField({
|
|
15
|
+
name: 'slug',
|
|
16
|
+
options: {
|
|
17
|
+
maxLength: 96,
|
|
18
|
+
source: 'title',
|
|
19
|
+
},
|
|
20
|
+
title: 'Slug',
|
|
21
|
+
type: 'slug',
|
|
22
|
+
}),
|
|
23
|
+
defineField({
|
|
24
|
+
name: 'author',
|
|
25
|
+
title: 'Author',
|
|
26
|
+
to: {type: 'author'},
|
|
27
|
+
type: 'reference',
|
|
28
|
+
}),
|
|
29
|
+
defineField({
|
|
30
|
+
name: 'mainImage',
|
|
31
|
+
options: {
|
|
32
|
+
hotspot: true,
|
|
33
|
+
},
|
|
34
|
+
title: 'Main image',
|
|
35
|
+
type: 'image',
|
|
36
|
+
}),
|
|
37
|
+
defineField({
|
|
38
|
+
name: 'categories',
|
|
39
|
+
of: [{to: {type: 'category'}, type: 'reference'}],
|
|
40
|
+
title: 'Categories',
|
|
41
|
+
type: 'array',
|
|
42
|
+
}),
|
|
43
|
+
defineField({
|
|
44
|
+
name: 'publishedAt',
|
|
45
|
+
title: 'Published at',
|
|
46
|
+
type: 'datetime',
|
|
47
|
+
}),
|
|
48
|
+
defineField({
|
|
49
|
+
name: 'body',
|
|
50
|
+
title: 'Body',
|
|
51
|
+
type: 'blockContent',
|
|
52
|
+
}),
|
|
53
|
+
],
|
|
54
|
+
|
|
55
|
+
preview: {
|
|
56
|
+
select: {
|
|
57
|
+
author: 'author.name',
|
|
58
|
+
media: 'mainImage',
|
|
59
|
+
title: 'title',
|
|
60
|
+
},
|
|
61
|
+
|
|
62
|
+
prepare(selection) {
|
|
63
|
+
const {author} = selection
|
|
64
|
+
return {...selection, subtitle: author && `by ${author}`}
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
})
|