@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,71 @@
|
|
|
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: 'code',
|
|
39
|
+
type: 'code',
|
|
40
|
+
}),
|
|
41
|
+
defineField({
|
|
42
|
+
name: 'categories',
|
|
43
|
+
of: [{to: {type: 'category'}, type: 'reference'}],
|
|
44
|
+
title: 'Categories',
|
|
45
|
+
type: 'array',
|
|
46
|
+
}),
|
|
47
|
+
defineField({
|
|
48
|
+
name: 'publishedAt',
|
|
49
|
+
title: 'Published at',
|
|
50
|
+
type: 'datetime',
|
|
51
|
+
}),
|
|
52
|
+
defineField({
|
|
53
|
+
name: 'body',
|
|
54
|
+
title: 'Body',
|
|
55
|
+
type: 'blockContent',
|
|
56
|
+
}),
|
|
57
|
+
],
|
|
58
|
+
|
|
59
|
+
preview: {
|
|
60
|
+
select: {
|
|
61
|
+
author: 'author.name',
|
|
62
|
+
media: 'mainImage',
|
|
63
|
+
title: 'title',
|
|
64
|
+
},
|
|
65
|
+
|
|
66
|
+
prepare(selection) {
|
|
67
|
+
const {author} = selection
|
|
68
|
+
return {...selection, subtitle: author && `by ${author}`}
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
})
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/// <reference types="vite/client" />
|
|
2
|
+
|
|
3
|
+
interface ImportMetaEnv {
|
|
4
|
+
readonly SANITY_STUDIO_PREFIXED_VAR: string
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
interface ImportMeta {
|
|
8
|
+
readonly env: ImportMetaEnv
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
declare module 'https://themer.sanity.build/api/hues?*' {
|
|
12
|
+
interface Hue extends Omit<import('@sanity/color').ColorHueConfig, 'midPoint' | 'title'> {
|
|
13
|
+
midPoint: 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900 | 950
|
|
14
|
+
}
|
|
15
|
+
interface Hues {
|
|
16
|
+
caution: Hue
|
|
17
|
+
critical: Hue
|
|
18
|
+
default: Hue
|
|
19
|
+
positive: Hue
|
|
20
|
+
primary: Hue
|
|
21
|
+
transparent: Hue
|
|
22
|
+
}
|
|
23
|
+
export const hues: Hues
|
|
24
|
+
type Theme = import('sanity').StudioTheme
|
|
25
|
+
export function createTheme(_hues: Hues): Theme
|
|
26
|
+
export const theme: Theme
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
declare module '*.module.css' {
|
|
30
|
+
const classes: {[key: string]: string}
|
|
31
|
+
export default classes
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
declare module '*.svg' {
|
|
35
|
+
const path: string
|
|
36
|
+
export default path
|
|
37
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/tsconfig",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"target": "ES2017",
|
|
5
|
+
"lib": ["dom", "dom.iterable", "esnext"],
|
|
6
|
+
"allowJs": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"strict": true,
|
|
9
|
+
"forceConsistentCasingInFileNames": true,
|
|
10
|
+
"module": "Preserve",
|
|
11
|
+
"moduleDetection": "force",
|
|
12
|
+
"isolatedModules": true,
|
|
13
|
+
"jsx": "preserve",
|
|
14
|
+
"incremental": true,
|
|
15
|
+
"noEmit": true,
|
|
16
|
+
"paths": {
|
|
17
|
+
"@/*": ["./src/*"]
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"include": ["**/*.ts", "**/*.tsx"],
|
|
21
|
+
"exclude": ["node_modules"],
|
|
22
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sanity/cli-test",
|
|
3
|
+
"version": "0.0.0-20260410130107",
|
|
4
|
+
"description": "Sanity CLI test helpers and utilities",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"cli",
|
|
7
|
+
"cms",
|
|
8
|
+
"content",
|
|
9
|
+
"headless",
|
|
10
|
+
"realtime",
|
|
11
|
+
"sanity",
|
|
12
|
+
"tool"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/sanity-io/cli",
|
|
15
|
+
"bugs": "https://github.com/sanity-io/cli/issues",
|
|
16
|
+
"license": "MIT",
|
|
17
|
+
"author": "Sanity.io <hello@sanity.io>",
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/sanity-io/cli.git",
|
|
21
|
+
"directory": "packages/@sanity/cli-test"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"./dist",
|
|
25
|
+
"./fixtures"
|
|
26
|
+
],
|
|
27
|
+
"type": "module",
|
|
28
|
+
"sideEffects": false,
|
|
29
|
+
"main": "./dist/index.js",
|
|
30
|
+
"types": "./dist/index.d.ts",
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"source": "./src/index.ts",
|
|
34
|
+
"default": "./dist/index.js"
|
|
35
|
+
},
|
|
36
|
+
"./vitest": {
|
|
37
|
+
"source": "./src/vitest.ts",
|
|
38
|
+
"default": "./dist/vitest.js"
|
|
39
|
+
},
|
|
40
|
+
"./package.json": "./package.json"
|
|
41
|
+
},
|
|
42
|
+
"publishConfig": {
|
|
43
|
+
"access": "public"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@swc/core": "^1.15.24",
|
|
47
|
+
"ansis": "^4.2.0",
|
|
48
|
+
"esbuild": "^0.27.4",
|
|
49
|
+
"nock": "^14.0.11",
|
|
50
|
+
"ora": "^9.0.0",
|
|
51
|
+
"tinyglobby": "^0.2.15"
|
|
52
|
+
},
|
|
53
|
+
"devDependencies": {
|
|
54
|
+
"@eslint/compat": "^2.0.3",
|
|
55
|
+
"@oclif/core": "^4.10.3",
|
|
56
|
+
"@sanity/client": "^7.20.0",
|
|
57
|
+
"@sanity/pkg-utils": "^10.4.13",
|
|
58
|
+
"@swc/cli": "^0.8.1",
|
|
59
|
+
"@types/node": "^20.19.39",
|
|
60
|
+
"eslint": "^10.1.0",
|
|
61
|
+
"publint": "^0.3.18",
|
|
62
|
+
"rimraf": "^6.0.1",
|
|
63
|
+
"tsx": "^4.21.0",
|
|
64
|
+
"typescript": "^5.9.3",
|
|
65
|
+
"vitest": "^4.1.2",
|
|
66
|
+
"yaml": "^2.8.3",
|
|
67
|
+
"@repo/package.config": "0.0.1",
|
|
68
|
+
"@repo/tsconfig": "3.70.0",
|
|
69
|
+
"@sanity/cli-core": "0.0.0-20260410130107",
|
|
70
|
+
"@sanity/eslint-config-cli": "1.1.0"
|
|
71
|
+
},
|
|
72
|
+
"peerDependencies": {
|
|
73
|
+
"@oclif/core": "^4.0.0",
|
|
74
|
+
"@sanity/client": "^7.0.0",
|
|
75
|
+
"vitest": ">=3.0.0 <5.0.0",
|
|
76
|
+
"@sanity/cli-core": "0.0.0-20260410130107"
|
|
77
|
+
},
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": ">=20.19.1 <22 || >=22.12"
|
|
80
|
+
},
|
|
81
|
+
"scripts": {
|
|
82
|
+
"prebuild": "pnpm run clean",
|
|
83
|
+
"build": "pnpm run build:js && pnpm run copy:fixtures",
|
|
84
|
+
"build:js": "swc --delete-dir-on-start --strip-leading-paths --out-dir dist/ src",
|
|
85
|
+
"build:types": "pkg-utils build --emitDeclarationOnly",
|
|
86
|
+
"check:types": "tsc --noEmit",
|
|
87
|
+
"clean": "rimraf dist fixtures",
|
|
88
|
+
"copy:fixtures": "tsx scripts/copy-fixtures.ts",
|
|
89
|
+
"lint": "eslint .",
|
|
90
|
+
"publint": "publint",
|
|
91
|
+
"test": "vitest run",
|
|
92
|
+
"posttest": "pnpm run lint",
|
|
93
|
+
"test:coverage": "vitest run --coverage",
|
|
94
|
+
"test:watch": "vitest",
|
|
95
|
+
"watch": "swc --delete-dir-on-start --strip-leading-paths --out-dir dist/ --watch src"
|
|
96
|
+
}
|
|
97
|
+
}
|