@sanity/cli 3.81.1-sdk-295.36 → 3.83.0

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/lib/index.d.mts CHANGED
@@ -10,6 +10,15 @@ import {SanityClient} from '@sanity/client'
10
10
  import {Separator} from 'inquirer'
11
11
  import {TelemetryLogger} from '@sanity/telemetry'
12
12
 
13
+ declare interface AppConfig {
14
+ organizationId: string
15
+ /**
16
+ * Defaults to './src/App'
17
+ */
18
+ entry?: string
19
+ id?: string
20
+ }
21
+
13
22
  export declare type CliApiClient = (options?: ClientRequirements) => SanityClient
14
23
 
15
24
  export declare interface CliApiConfig {
@@ -117,13 +126,8 @@ export declare interface CliConfig {
117
126
  /**
118
127
  * Parameter used to configure other kinds of applications.
119
128
  * Signals to `sanity` commands that this is not a studio.
120
- * @internal
121
129
  */
122
- __experimental_appConfiguration?: {
123
- organizationId: string
124
- appLocation?: string
125
- appId?: string
126
- }
130
+ app?: AppConfig
127
131
  }
128
132
 
129
133
  declare type CliConfigResult =
package/lib/index.d.ts CHANGED
@@ -10,6 +10,15 @@ import {SanityClient} from '@sanity/client'
10
10
  import {Separator} from 'inquirer'
11
11
  import {TelemetryLogger} from '@sanity/telemetry'
12
12
 
13
+ declare interface AppConfig {
14
+ organizationId: string
15
+ /**
16
+ * Defaults to './src/App'
17
+ */
18
+ entry?: string
19
+ id?: string
20
+ }
21
+
13
22
  export declare type CliApiClient = (options?: ClientRequirements) => SanityClient
14
23
 
15
24
  export declare interface CliApiConfig {
@@ -117,13 +126,8 @@ export declare interface CliConfig {
117
126
  /**
118
127
  * Parameter used to configure other kinds of applications.
119
128
  * Signals to `sanity` commands that this is not a studio.
120
- * @internal
121
129
  */
122
- __experimental_appConfiguration?: {
123
- organizationId: string
124
- appLocation?: string
125
- appId?: string
126
- }
130
+ app?: AppConfig
127
131
  }
128
132
 
129
133
  declare type CliConfigResult =
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli",
3
- "version": "3.81.1-sdk-295.36+8bc6ac382d",
3
+ "version": "3.83.0",
4
4
  "description": "Sanity CLI tool for managing Sanity installations, managing plugins, schemas and datasets",
5
5
  "keywords": [
6
6
  "sanity",
@@ -23,6 +23,7 @@
23
23
  "license": "MIT",
24
24
  "author": "Sanity.io <hello@sanity.io>",
25
25
  "sideEffects": false,
26
+ "type": "commonjs",
26
27
  "exports": {
27
28
  ".": {
28
29
  "source": "./src/index.ts",
@@ -33,7 +34,7 @@
33
34
  "./package.json": "./package.json"
34
35
  },
35
36
  "main": "./lib/index.js",
36
- "module": "./lib/index.esm.js",
37
+ "module": "./lib/index.mjs",
37
38
  "types": "./lib/index.d.ts",
38
39
  "bin": {
39
40
  "sanity": "./bin/sanity"
@@ -58,11 +59,11 @@
58
59
  "dependencies": {
59
60
  "@babel/traverse": "^7.23.5",
60
61
  "@sanity/client": "^6.28.4",
61
- "@sanity/codegen": "3.81.1-sdk-295.36+8bc6ac382d",
62
+ "@sanity/codegen": "3.83.0",
62
63
  "@sanity/runtime-cli": "^1.1.1",
63
64
  "@sanity/telemetry": "^0.8.0",
64
65
  "@sanity/template-validator": "^2.4.3",
65
- "@sanity/util": "3.81.1-sdk-295.36+8bc6ac382d",
66
+ "@sanity/util": "3.83.0",
66
67
  "chalk": "^4.1.2",
67
68
  "debug": "^4.3.4",
68
69
  "decompress": "^4.2.0",
@@ -76,13 +77,13 @@
76
77
  "validate-npm-package-name": "^3.0.0"
77
78
  },
78
79
  "devDependencies": {
79
- "@repo/package.config": "3.81.0",
80
- "@repo/test-config": "3.81.0",
80
+ "@repo/package.config": "3.83.0",
81
+ "@repo/test-config": "3.83.0",
81
82
  "@rexxars/gitconfiglocal": "^3.0.1",
82
83
  "@rollup/plugin-node-resolve": "^15.2.3",
83
84
  "@sanity/eslint-config-studio": "^4.0.0",
84
85
  "@sanity/generate-help-url": "^3.0.0",
85
- "@sanity/types": "3.81.1-sdk-295.36+8bc6ac382d",
86
+ "@sanity/types": "3.83.0",
86
87
  "@types/babel__traverse": "^7.20.5",
87
88
  "@types/configstore": "^5.0.1",
88
89
  "@types/cpx": "^1.5.2",
@@ -126,7 +127,7 @@
126
127
  "semver": "^7.3.5",
127
128
  "semver-compare": "^1.0.0",
128
129
  "tar": "^6.1.11",
129
- "vite": "^6.2.3",
130
+ "vite": "^6.2.4",
130
131
  "vitest": "^3.1.1",
131
132
  "which": "^2.0.2",
132
133
  "xdg-basedir": "^4.0.0"
@@ -134,5 +135,5 @@
134
135
  "engines": {
135
136
  "node": ">=18"
136
137
  },
137
- "gitHead": "8bc6ac382d950780ee8627e2b9d1b9064294009a"
138
+ "gitHead": "33425815221b8705b9d83b9786475c01492bf6a0"
138
139
  }
@@ -143,7 +143,7 @@ export async function bootstrapLocalTemplate(
143
143
  // ...and a CLI config (`sanity.cli.[ts|js]`)
144
144
  const cliConfig = isAppTemplate
145
145
  ? createAppCliConfig({
146
- appLocation: template.appLocation!,
146
+ entry: template.entry!,
147
147
  organizationId: variables.organizationId,
148
148
  })
149
149
  : createCliConfig({
@@ -4,16 +4,16 @@ const defaultAppTemplate = `
4
4
  import {defineCliConfig} from 'sanity/cli'
5
5
 
6
6
  export default defineCliConfig({
7
- __experimental_appConfiguration: {
7
+ app: {
8
8
  organizationId: '%organizationId%',
9
- appLocation: '%appLocation%',
9
+ entry: '%entry%',
10
10
  },
11
11
  })
12
12
  `
13
13
 
14
14
  export interface GenerateCliConfigOptions {
15
15
  organizationId?: string
16
- appLocation: string
16
+ entry: string
17
17
  }
18
18
 
19
19
  export function createAppCliConfig(options: GenerateCliConfigOptions): string {
@@ -1,4 +1,4 @@
1
- const appTemplates = ['app-quickstart']
1
+ const appTemplates = ['app-quickstart', 'app-sanity-ui']
2
2
 
3
3
  /**
4
4
  * Determine if a given template is a studio template.
@@ -98,7 +98,7 @@ export interface ProjectTemplate {
98
98
  importPrompt?: string
99
99
  configTemplate?: string | ((variables: GenerateConfigOptions['variables']) => string)
100
100
  typescriptOnly?: boolean
101
- appLocation?: string
101
+ entry?: string
102
102
  scripts?: Record<string, string>
103
103
  }
104
104
 
@@ -19,7 +19,7 @@ const appTemplate: ProjectTemplate = {
19
19
  'sanity': '^3',
20
20
  'typescript': '^5.1.6',
21
21
  },
22
- appLocation: './src/App.tsx',
22
+ entry: './src/App.tsx',
23
23
  scripts: {
24
24
  dev: 'sanity dev',
25
25
  build: 'sanity build',
@@ -0,0 +1,32 @@
1
+ import {type ProjectTemplate} from '../initProject'
2
+
3
+ const appSanityUiTemplate: ProjectTemplate = {
4
+ dependencies: {
5
+ '@sanity/sdk': '^0.0.0-rc',
6
+ '@sanity/sdk-react': '^0.0.0-rc',
7
+ '@sanity/ui': '^2',
8
+ 'react': '^19',
9
+ 'react-dom': '^19',
10
+ 'styled-components': '^6.1.17',
11
+ },
12
+ devDependencies: {
13
+ /*
14
+ * this will be changed to eslint-config sanity,
15
+ * eslint.config generation will be a fast follow
16
+ */
17
+ '@sanity/eslint-config-studio': '^5.0.1',
18
+ '@types/react': '^18.0.25',
19
+ 'eslint': '^9.9.0',
20
+ 'prettier': '^3.0.2',
21
+ 'sanity': '^3',
22
+ 'typescript': '^5.1.6',
23
+ },
24
+ entry: './src/App.tsx',
25
+ scripts: {
26
+ dev: 'sanity dev',
27
+ build: 'sanity build',
28
+ start: 'sanity start',
29
+ },
30
+ }
31
+
32
+ export default appSanityUiTemplate
@@ -1,5 +1,6 @@
1
1
  import {type ProjectTemplate} from '../initProject'
2
2
  import appTemplate from './appQuickstart'
3
+ import appSanityUiTemplate from './appSanityUi'
3
4
  import blog from './blog'
4
5
  import clean from './clean'
5
6
  import getStartedTemplate from './getStarted'
@@ -12,6 +13,7 @@ const templates: Record<string, ProjectTemplate | undefined> = {
12
13
  blog,
13
14
  clean,
14
15
  'app-quickstart': appTemplate,
16
+ 'app-sanity-ui': appSanityUiTemplate,
15
17
  'get-started': getStartedTemplate,
16
18
  moviedb,
17
19
  shopify,
@@ -10,7 +10,7 @@ export const studioDependencies = {
10
10
  // Non-Sanity dependencies
11
11
  'react': '^18.2.0',
12
12
  'react-dom': '^18.2.0',
13
- 'styled-components': '^6.1.8',
13
+ 'styled-components': '^6.1.15',
14
14
  },
15
15
 
16
16
  devDependencies: {
package/src/types.ts CHANGED
@@ -311,6 +311,15 @@ export interface ReactCompilerConfig {
311
311
  compilationMode?: 'infer' | 'syntax' | 'annotation' | 'all'
312
312
  }
313
313
 
314
+ interface AppConfig {
315
+ organizationId: string
316
+ /**
317
+ * Defaults to './src/App'
318
+ */
319
+ entry?: string
320
+ id?: string
321
+ }
322
+
314
323
  export interface CliConfig {
315
324
  api?: CliApiConfig
316
325
 
@@ -349,13 +358,8 @@ export interface CliConfig {
349
358
  /**
350
359
  * Parameter used to configure other kinds of applications.
351
360
  * Signals to `sanity` commands that this is not a studio.
352
- * @internal
353
361
  */
354
- __experimental_appConfiguration?: {
355
- organizationId: string
356
- appLocation?: string
357
- appId?: string
358
- }
362
+ app?: AppConfig
359
363
  }
360
364
 
361
365
  export type UserViteConfig =
@@ -5,13 +5,70 @@
5
5
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
6
6
  }
7
7
 
8
+ .example-avatar-container {
9
+ position: relative;
10
+ margin-block-end: 1rem;
11
+ }
12
+
13
+ @keyframes wave {
14
+ 0% {
15
+ rotate: 0deg;
16
+ }
17
+ 2% {
18
+ rotate: 20deg;
19
+ filter: blur(1px);
20
+ }
21
+ 4% {
22
+ rotate: 0deg;
23
+ }
24
+ 6% {
25
+ rotate: -20deg;
26
+ }
27
+ 8% {
28
+ rotate: 0deg;
29
+ }
30
+ 10% {
31
+ rotate: 20deg;
32
+ }
33
+ 12% {
34
+ rotate: 0deg;
35
+ }
36
+ 14% {
37
+ rotate: -20deg;
38
+ }
39
+ 16% {
40
+ rotate: 0deg;
41
+ filter: blur(0);
42
+ }
43
+ }
44
+
45
+ .example-avatar-container:after {
46
+ content: '👋';
47
+ position: absolute;
48
+ font-size: 1.5rem;
49
+ display: flex;
50
+ align-items: center;
51
+ justify-container: center;
52
+ inset-inline-start: 0;
53
+ inset-block-start: 0;
54
+ translate: -25% -25%;
55
+ transform-origin: 100% 100%;
56
+ animation: wave 4s infinite linear;
57
+ }
58
+
59
+ .example-avatar {
60
+ inline-size: 4rem;
61
+ aspect-ratio: 1;
62
+ border-radius: 50%;
63
+ }
64
+
8
65
  .example-heading {
9
66
  color: #333;
10
67
  margin-top: 0;
11
- font-size: 1.8rem;
68
+ font-size: 2rem;
12
69
  }
13
70
 
14
- .example-text {
71
+ p {
15
72
  color: #666;
16
73
  line-height: 1.6;
17
74
  }
@@ -23,4 +80,5 @@
23
80
  font-family: monospace;
24
81
  margin-top: 1.5rem;
25
82
  border-left: 3px solid #e0e0e0;
83
+ line-height: 1.5;
26
84
  }
@@ -1,18 +1,33 @@
1
+ import {useCurrentUser, type CurrentUser} from '@sanity/sdk-react'
1
2
  import './ExampleComponent.css'
2
3
 
3
4
  export function ExampleComponent() {
5
+ const user: CurrentUser | null = useCurrentUser()
6
+
4
7
  return (
5
8
  <div className="example-container">
6
- <h1 className="example-heading">Welcome to your Sanity App!</h1>
9
+ {user?.profileImage ? (
10
+ <div className="example-avatar-container">
11
+ <img src={user.profileImage} alt="" className="example-avatar" />
12
+ </div>
13
+ ) : (
14
+ ''
15
+ )}
16
+ <h1 className="example-heading">
17
+ Welcome to your Sanity App{user?.name ? `, ${user.name}` : ''}!
18
+ </h1>
7
19
  <p className="example-text">
8
- This is an example component. You can replace this with your own content
9
- by creating a new component and importing it in App.tsx.
20
+ This is an example component. You can replace this with your own content by creating a new
21
+ component and importing it in App.tsx.
10
22
  </p>
11
23
  <div className="code-hint">
12
- <p>Quick tip: Create new components in separate files and import them like this in App.tsx / App.jsx:</p>
24
+ <p>
25
+ Quick tip: Create new components in separate files and import them like this in App.tsx /
26
+ App.jsx:
27
+ </p>
13
28
  <pre>{`import {YourComponent} from './YourComponent'
14
29
 
15
- // Then use it in your JSX
30
+ // Then use it in your JSX
16
31
  <SanityApp sanityConfigs={sanityConfigs}>
17
32
  <YourComponent />
18
33
  </SanityApp>`}</pre>
@@ -0,0 +1,30 @@
1
+ import {type SanityConfig} from '@sanity/sdk'
2
+ import {SanityApp} from '@sanity/sdk-react'
3
+ import {ThemeProvider} from '@sanity/ui'
4
+ import {buildTheme} from '@sanity/ui/theme'
5
+ import {ExampleComponent} from './ExampleComponent'
6
+
7
+ const theme = buildTheme()
8
+
9
+ export function App() {
10
+ // apps can access many different projects or other sources of data
11
+ const sanityConfigs: SanityConfig[] = [
12
+ {
13
+ projectId: 'project-id',
14
+ dataset: 'dataset-name',
15
+ }
16
+ ]
17
+
18
+ return (
19
+ <div className="app-container">
20
+ <SanityApp sanityConfigs={sanityConfigs} fallback={<div>Loading...</div>}>
21
+ <ThemeProvider theme={theme}>
22
+ {/* add your own components here! */}
23
+ <ExampleComponent />
24
+ </ThemeProvider>
25
+ </SanityApp>
26
+ </div>
27
+ )
28
+ }
29
+
30
+ export default App
@@ -0,0 +1,33 @@
1
+ import {type CurrentUser, useCurrentUser} from '@sanity/sdk-react'
2
+ import {Avatar, Card, Container, Flex, Heading, Stack, Text} from '@sanity/ui'
3
+
4
+ export function ExampleComponent() {
5
+ const user: CurrentUser | null = useCurrentUser()
6
+
7
+ return (
8
+ <Container width={1}>
9
+ <Card padding={5} shadow={3} radius={3} marginY={5}>
10
+ <Flex align="center" direction="column" gap={5} marginY={4}>
11
+ <Avatar size={3} src={user?.profileImage} />
12
+ <Heading as="h1">Welcome to your Sanity App, {user?.name}!</Heading>
13
+ <Stack space={4}>
14
+ <Text muted>
15
+ This is an example component, rendered with Sanity UI and the{' '}
16
+ <code>useCurrentUser</code> hook from the Sanity App SDK. You can import and use any
17
+ Sanity UI components and App SDK hooks anywhere in this application.
18
+ </Text>
19
+ <Text muted>
20
+ You can also replace this component with components of your own. Render them in your
21
+ app by importing and using them in your application’s <code>src/App.tsx|jsx</code>{' '}
22
+ file.
23
+ </Text>
24
+ <Text muted>
25
+ Looking for more guidance? See the <a href="https://sanity.io/ui">Sanity UI docs</a>{' '}
26
+ and the <a href="https://sdk-docs.sanity.dev">Sanity App SDK docs</a>!
27
+ </Text>
28
+ </Stack>
29
+ </Flex>
30
+ </Card>
31
+ </Container>
32
+ )
33
+ }