@sanity/cli-test 0.0.2-alpha.1 → 0.0.2-alpha.11
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/README.md +228 -0
- package/dist/index.d.ts +516 -3
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/test/constants.js +21 -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 +5 -3
- package/dist/test/mockApi.js.map +1 -1
- package/dist/test/mockSanityCommand.js +68 -0
- package/dist/test/mockSanityCommand.js.map +1 -0
- package/dist/test/mockTelemetry.js +22 -0
- package/dist/test/mockTelemetry.js.map +1 -0
- package/dist/test/setupFixtures.js +138 -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 +11 -4
- package/dist/test/testCommand.js.map +1 -1
- package/dist/test/testFixture.js +112 -0
- package/dist/test/testFixture.js.map +1 -0
- package/dist/test/testHook.js +23 -7
- package/dist/test/testHook.js.map +1 -1
- 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 +116 -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 +26 -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-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/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 +26 -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/README.md +21 -0
- package/fixtures/worst-case-studio/package.json +32 -0
- package/fixtures/worst-case-studio/sanity.cli.ts +16 -0
- package/fixtures/worst-case-studio/sanity.config.tsx +49 -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 +52 -22
- package/dist/test/captureOutput.d.ts +0 -33
- package/dist/test/mockApi.d.ts +0 -34
- package/dist/test/testCommand.d.ts +0 -6
- package/dist/test/testHook.d.ts +0 -8
|
@@ -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,28 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "multi-workspace-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": "sanity deploy",
|
|
13
|
+
"deploy-graphql": "sanity graphql deploy",
|
|
14
|
+
"dev": "sanity dev",
|
|
15
|
+
"start": "sanity start"
|
|
16
|
+
},
|
|
17
|
+
"dependencies": {
|
|
18
|
+
"@sanity/vision": "^5.9.0",
|
|
19
|
+
"react": "^19.2.3",
|
|
20
|
+
"react-dom": "^19.2.3",
|
|
21
|
+
"sanity": "^5.9.0",
|
|
22
|
+
"styled-components": "^6.3.8"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@types/react": "^19.2.9",
|
|
26
|
+
"typescript": "^5.9.3"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
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
|
+
{
|
|
9
|
+
basePath: '/prod',
|
|
10
|
+
name: 'production',
|
|
11
|
+
title: 'Production',
|
|
12
|
+
|
|
13
|
+
dataset: 'test',
|
|
14
|
+
projectId: 'ppsg7ml5',
|
|
15
|
+
|
|
16
|
+
plugins: [structureTool(), visionTool()],
|
|
17
|
+
|
|
18
|
+
schema: {
|
|
19
|
+
types: schemaTypes,
|
|
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: schemaTypes,
|
|
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,70 @@
|
|
|
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
|
+
* ```ts
|
|
8
|
+
* {
|
|
9
|
+
* name: 'someName',
|
|
10
|
+
* title: 'Some title',
|
|
11
|
+
* type: 'blockContent'
|
|
12
|
+
* }
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export default defineType({
|
|
16
|
+
name: 'blockContent',
|
|
17
|
+
title: 'Block Content',
|
|
18
|
+
type: 'array',
|
|
19
|
+
|
|
20
|
+
of: [
|
|
21
|
+
defineArrayMember({
|
|
22
|
+
lists: [{title: 'Bullet', value: 'bullet'}],
|
|
23
|
+
// Marks let you mark up inline text in the block editor.
|
|
24
|
+
marks: {
|
|
25
|
+
// Annotations can be any object structure – e.g. a link or a footnote.
|
|
26
|
+
annotations: [
|
|
27
|
+
{
|
|
28
|
+
fields: [
|
|
29
|
+
{
|
|
30
|
+
name: 'href',
|
|
31
|
+
title: 'URL',
|
|
32
|
+
type: 'url',
|
|
33
|
+
},
|
|
34
|
+
],
|
|
35
|
+
name: 'link',
|
|
36
|
+
title: 'URL',
|
|
37
|
+
type: 'object',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
// Decorators usually describe a single property – e.g. a typographic
|
|
41
|
+
// preference or highlighting by editors.
|
|
42
|
+
decorators: [
|
|
43
|
+
{title: 'Strong', value: 'strong'},
|
|
44
|
+
{title: 'Emphasis', value: 'em'},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
// Styles let you set what your user can mark up blocks with. These
|
|
48
|
+
// correspond with HTML tags, but you can set any title or value
|
|
49
|
+
// you want and decide how you want to deal with it where you want to
|
|
50
|
+
// use your content.
|
|
51
|
+
styles: [
|
|
52
|
+
{title: 'Normal', value: 'normal'},
|
|
53
|
+
{title: 'H1', value: 'h1'},
|
|
54
|
+
{title: 'H2', value: 'h2'},
|
|
55
|
+
{title: 'H3', value: 'h3'},
|
|
56
|
+
{title: 'H4', value: 'h4'},
|
|
57
|
+
{title: 'Quote', value: 'blockquote'},
|
|
58
|
+
],
|
|
59
|
+
title: 'Block',
|
|
60
|
+
type: 'block',
|
|
61
|
+
}),
|
|
62
|
+
// You can add additional types here. Note that you can't use
|
|
63
|
+
// primitive types such as 'string' and 'number' in the same array
|
|
64
|
+
// as a block type.
|
|
65
|
+
defineArrayMember({
|
|
66
|
+
options: {hotspot: true},
|
|
67
|
+
type: 'image',
|
|
68
|
+
}),
|
|
69
|
+
],
|
|
70
|
+
})
|
|
@@ -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
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<meta content="width=device-width, initial-scale=1, viewport-fit=cover" name="viewport" />
|
|
6
|
+
<meta content="noindex" name="robots" />
|
|
7
|
+
<meta content="same-origin" name="referrer" />
|
|
8
|
+
<title>Sanity CORE App</title>
|
|
9
|
+
<link href="/static/sanity-CtOxKsdo.css" rel="stylesheet" />
|
|
10
|
+
<script type="application/json" id="__imports">
|
|
11
|
+
{
|
|
12
|
+
"imports": {
|
|
13
|
+
"react": "/vendor/react/index-CVS62ceT.mjs",
|
|
14
|
+
"react/compiler-runtime": "/vendor/react/compiler-runtime-DFvlMPQC.mjs",
|
|
15
|
+
"react/jsx-dev-runtime": "/vendor/react/jsx-dev-runtime-DYLplPiq.mjs",
|
|
16
|
+
"react/jsx-runtime": "/vendor/react/jsx-runtime-CInpRuN4.mjs",
|
|
17
|
+
"react/package.json": "/vendor/react/package.json-B3Sv_Ots.mjs",
|
|
18
|
+
"react-dom": "/vendor/react-dom/index-B3pchmCn.mjs",
|
|
19
|
+
"react-dom/client": "/vendor/react-dom/client-BptInOSw.mjs",
|
|
20
|
+
"react-dom/package.json": "/vendor/react-dom/package.json-CNqBlmzA.mjs",
|
|
21
|
+
"react-dom/server": "/vendor/react-dom/server-FfCSsckh.mjs",
|
|
22
|
+
"react-dom/static": "/vendor/react-dom/static-CN1Myo0a.mjs",
|
|
23
|
+
"styled-components": "/vendor/styled-components/index-X329-4Jb.mjs",
|
|
24
|
+
"styled-components/package.json": "/vendor/styled-components/package.json-DqoIBjAO.mjs",
|
|
25
|
+
"react-dom/server.browser": "/vendor/react-dom/server.browser-BzpYnHww.mjs",
|
|
26
|
+
"react-dom/static.browser": "/vendor/react-dom/static.browser-BCHXHC4T.mjs",
|
|
27
|
+
"@sanity/sdk": "https://sanity-cdn.com/v1/modules/by-app/app-id/t1769729422/%5E2.6.0/@sanity__sdk",
|
|
28
|
+
"@sanity/sdk/": "https://sanity-cdn.com/v1/modules/by-app/app-id/t1769729422/%5E2.6.0/@sanity__sdk/",
|
|
29
|
+
"@sanity/sdk-react": "https://sanity-cdn.com/v1/modules/by-app/app-id/t1769729422/%5E2.6.0/@sanity__sdk-react",
|
|
30
|
+
"@sanity/sdk-react/": "https://sanity-cdn.com/v1/modules/by-app/app-id/t1769729422/%5E2.6.0/@sanity__sdk-react/",
|
|
31
|
+
"sanity": "https://sanity-cdn.com/v1/modules/by-app/app-id/t1769729422/%5E5.7.0/sanity",
|
|
32
|
+
"sanity/": "https://sanity-cdn.com/v1/modules/by-app/app-id/t1769729422/%5E5.7.0/sanity/"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
</script>
|
|
36
|
+
<script>
|
|
37
|
+
// auto-generated script to add import map with timestamp
|
|
38
|
+
const importsJson = document.getElementById('__imports')?.textContent
|
|
39
|
+
const {imports = {}, ...rest} = importsJson ? JSON.parse(importsJson) : {}
|
|
40
|
+
const importMapEl = document.createElement('script')
|
|
41
|
+
importMapEl.type = 'importmap'
|
|
42
|
+
const newTimestamp = `/t${Math.floor(Date.now() / 1000)}`
|
|
43
|
+
importMapEl.textContent = JSON.stringify({
|
|
44
|
+
imports: Object.fromEntries(
|
|
45
|
+
Object.entries(imports).map(([specifier, path]) => {
|
|
46
|
+
try {
|
|
47
|
+
const url = new URL(path)
|
|
48
|
+
if (/^sanity-cdn\.[a-zA-Z]+$/.test(url.hostname)) {
|
|
49
|
+
url.pathname = url.pathname.replace(/\/t\d+/, newTimestamp)
|
|
50
|
+
}
|
|
51
|
+
return [specifier, url.toString()]
|
|
52
|
+
} catch {
|
|
53
|
+
return [specifier, path]
|
|
54
|
+
}
|
|
55
|
+
}),
|
|
56
|
+
),
|
|
57
|
+
...rest,
|
|
58
|
+
})
|
|
59
|
+
document.head.appendChild(importMapEl)
|
|
60
|
+
</script>
|
|
61
|
+
<script
|
|
62
|
+
src="https://core.sanity-cdn.com/bridge.js"
|
|
63
|
+
async
|
|
64
|
+
type="module"
|
|
65
|
+
data-sanity-core
|
|
66
|
+
></script>
|
|
67
|
+
</head>
|
|
68
|
+
<body>
|
|
69
|
+
<div id="root"></div>
|
|
70
|
+
<script src="/static/sanity-D4a4eOYZ.js" type="module"></script>
|
|
71
|
+
<noscript
|
|
72
|
+
><div class="sanity-app-no-js__root">
|
|
73
|
+
<div class="sanity-app-no-js__content">
|
|
74
|
+
<style type="text/css">
|
|
75
|
+
.sanity-app-no-js__root {
|
|
76
|
+
position: absolute;
|
|
77
|
+
top: 0;
|
|
78
|
+
right: 0;
|
|
79
|
+
left: 0;
|
|
80
|
+
bottom: 0;
|
|
81
|
+
background: #fff;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.sanity-app-no-js__content {
|
|
85
|
+
position: absolute;
|
|
86
|
+
top: 50%;
|
|
87
|
+
left: 50%;
|
|
88
|
+
transform: translate(-50%, -50%);
|
|
89
|
+
text-align: center;
|
|
90
|
+
font-family: helvetica, arial, sans-serif;
|
|
91
|
+
}
|
|
92
|
+
</style>
|
|
93
|
+
<h1>JavaScript disabled</h1>
|
|
94
|
+
<p>
|
|
95
|
+
Please <a href="https://www.enable-javascript.com/">enable JavaScript</a> in your
|
|
96
|
+
browser and reload the page to proceed.
|
|
97
|
+
</p>
|
|
98
|
+
</div>
|
|
99
|
+
</div></noscript
|
|
100
|
+
>
|
|
101
|
+
</body>
|
|
102
|
+
</html>
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
.app-container {
|
|
2
|
+
max-width: 1200px;
|
|
3
|
+
margin: 0 auto;
|
|
4
|
+
padding: 2rem;
|
|
5
|
+
font-family:
|
|
6
|
+
-apple-system,
|
|
7
|
+
BlinkMacSystemFont,
|
|
8
|
+
Segoe UI,
|
|
9
|
+
Roboto,
|
|
10
|
+
Oxygen,
|
|
11
|
+
Ubuntu,
|
|
12
|
+
Cantarell,
|
|
13
|
+
Open Sans,
|
|
14
|
+
Helvetica Neue,
|
|
15
|
+
sans-serif;
|
|
16
|
+
}
|
|
17
|
+
* {
|
|
18
|
+
box-sizing: border-box;
|
|
19
|
+
}
|
|
20
|
+
body {
|
|
21
|
+
margin: 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
background-color: #f9f9f9;
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {createRoot as e} from 'react-dom/client'
|
|
2
|
+
import {createElement as o} from 'react'
|
|
3
|
+
import {jsx as t} from 'react/jsx-runtime'
|
|
4
|
+
import {SanityApp as n} from '@sanity/sdk-react'
|
|
5
|
+
function r() {
|
|
6
|
+
return t('div', {
|
|
7
|
+
className: 'app-container',
|
|
8
|
+
children: t(n, {
|
|
9
|
+
config: [{dataset: 'dataset-name', projectId: 'project-id'}],
|
|
10
|
+
fallback: t('div', {children: 'Loading...'}),
|
|
11
|
+
children: t('div', {}),
|
|
12
|
+
}),
|
|
13
|
+
})
|
|
14
|
+
}
|
|
15
|
+
const i = e(document.getElementById('root')),
|
|
16
|
+
a = o(r)
|
|
17
|
+
i.render(a)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "prebuilt-app",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"keywords": [
|
|
6
|
+
"sanity"
|
|
7
|
+
],
|
|
8
|
+
"license": "UNLICENSED",
|
|
9
|
+
"main": "package.json",
|
|
10
|
+
"scripts": {
|
|
11
|
+
"dev": "sanity dev",
|
|
12
|
+
"preview": "sanity preview"
|
|
13
|
+
},
|
|
14
|
+
"dependencies": {
|
|
15
|
+
"@sanity/sdk": "^2.6.0",
|
|
16
|
+
"@sanity/sdk-react": "^2.6.0",
|
|
17
|
+
"react": "^19.2.3",
|
|
18
|
+
"react-dom": "^19.2.3",
|
|
19
|
+
"sanity": "^5.9.0"
|
|
20
|
+
},
|
|
21
|
+
"devDependencies": {
|
|
22
|
+
"@types/react": "^19.2.9",
|
|
23
|
+
"sanity": "^5.9.0",
|
|
24
|
+
"typescript": "^5.9.3"
|
|
25
|
+
}
|
|
26
|
+
}
|