@sanity/cli 3.82.0 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sanity/cli",
3
- "version": "3.82.0",
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",
@@ -59,11 +59,11 @@
59
59
  "dependencies": {
60
60
  "@babel/traverse": "^7.23.5",
61
61
  "@sanity/client": "^6.28.4",
62
- "@sanity/codegen": "3.82.0",
62
+ "@sanity/codegen": "3.83.0",
63
63
  "@sanity/runtime-cli": "^1.1.1",
64
64
  "@sanity/telemetry": "^0.8.0",
65
65
  "@sanity/template-validator": "^2.4.3",
66
- "@sanity/util": "3.82.0",
66
+ "@sanity/util": "3.83.0",
67
67
  "chalk": "^4.1.2",
68
68
  "debug": "^4.3.4",
69
69
  "decompress": "^4.2.0",
@@ -77,13 +77,13 @@
77
77
  "validate-npm-package-name": "^3.0.0"
78
78
  },
79
79
  "devDependencies": {
80
- "@repo/package.config": "3.82.0",
81
- "@repo/test-config": "3.82.0",
80
+ "@repo/package.config": "3.83.0",
81
+ "@repo/test-config": "3.83.0",
82
82
  "@rexxars/gitconfiglocal": "^3.0.1",
83
83
  "@rollup/plugin-node-resolve": "^15.2.3",
84
84
  "@sanity/eslint-config-studio": "^4.0.0",
85
85
  "@sanity/generate-help-url": "^3.0.0",
86
- "@sanity/types": "3.82.0",
86
+ "@sanity/types": "3.83.0",
87
87
  "@types/babel__traverse": "^7.20.5",
88
88
  "@types/configstore": "^5.0.1",
89
89
  "@types/cpx": "^1.5.2",
@@ -127,7 +127,7 @@
127
127
  "semver": "^7.3.5",
128
128
  "semver-compare": "^1.0.0",
129
129
  "tar": "^6.1.11",
130
- "vite": "^6.2.3",
130
+ "vite": "^6.2.4",
131
131
  "vitest": "^3.1.1",
132
132
  "which": "^2.0.2",
133
133
  "xdg-basedir": "^4.0.0"
@@ -135,5 +135,5 @@
135
135
  "engines": {
136
136
  "node": ">=18"
137
137
  },
138
- "gitHead": "4e83852759628260ad60f565bcaa61f95881eedc"
138
+ "gitHead": "33425815221b8705b9d83b9786475c01492bf6a0"
139
139
  }
@@ -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.
@@ -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: {
@@ -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
+ }