@sanity/cli 3.93.1-next.9.198ab74452 → 3.94.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.
Files changed (149) hide show
  1. package/lib/_chunks-cjs/cli.js +1 -1
  2. package/lib/_chunks-cjs/cli.js.map +1 -1
  3. package/package.json +10 -11
  4. package/templates/blog/README.md +1 -1
  5. package/templates/clean/README.md +1 -1
  6. package/templates/ecommerce/README.md +1 -1
  7. package/templates/get-started/README.md +1 -1
  8. package/templates/moviedb/README.md +1 -1
  9. package/templates/quickstart/README.md +1 -1
  10. package/src/CommandRunner.ts +0 -219
  11. package/src/__telemetry__/cli.telemetry.ts +0 -29
  12. package/src/__telemetry__/init.telemetry.ts +0 -95
  13. package/src/actions/codemod/codemodAction.ts +0 -109
  14. package/src/actions/codemod/mods/deskRename.ts +0 -19
  15. package/src/actions/codemod/mods/index.ts +0 -9
  16. package/src/actions/codemod/mods/partsTypeDirective.ts +0 -28
  17. package/src/actions/codemod/mods/reactIconsV3.ts +0 -54
  18. package/src/actions/codemod/types.ts +0 -10
  19. package/src/actions/init-plugin/bootstrapFromTemplate.ts +0 -196
  20. package/src/actions/init-project/bootstrapLocalTemplate.ts +0 -201
  21. package/src/actions/init-project/bootstrapRemoteTemplate.ts +0 -118
  22. package/src/actions/init-project/createAppCliConfig.ts +0 -24
  23. package/src/actions/init-project/createCliConfig.ts +0 -31
  24. package/src/actions/init-project/createPackageManifest.ts +0 -102
  25. package/src/actions/init-project/createStudioConfig.ts +0 -53
  26. package/src/actions/init-project/determineAppTemplate.ts +0 -13
  27. package/src/actions/init-project/fsUtils.ts +0 -40
  28. package/src/actions/init-project/git.ts +0 -59
  29. package/src/actions/init-project/initProject.ts +0 -1708
  30. package/src/actions/init-project/processTemplate.ts +0 -55
  31. package/src/actions/init-project/promptForDatasetName.ts +0 -68
  32. package/src/actions/init-project/prompts/index.ts +0 -51
  33. package/src/actions/init-project/prompts/nextjs.ts +0 -59
  34. package/src/actions/init-project/readPackageJson.ts +0 -17
  35. package/src/actions/init-project/templates/appQuickstart.ts +0 -23
  36. package/src/actions/init-project/templates/appSanityUi.ts +0 -25
  37. package/src/actions/init-project/templates/blog.ts +0 -5
  38. package/src/actions/init-project/templates/clean.ts +0 -5
  39. package/src/actions/init-project/templates/getStarted.ts +0 -37
  40. package/src/actions/init-project/templates/index.ts +0 -24
  41. package/src/actions/init-project/templates/moviedb.ts +0 -35
  42. package/src/actions/init-project/templates/nextjs/index.ts +0 -238
  43. package/src/actions/init-project/templates/nextjs/schemaTypes/blog.ts +0 -252
  44. package/src/actions/init-project/templates/quickstart.ts +0 -5
  45. package/src/actions/init-project/templates/shopify.ts +0 -78
  46. package/src/actions/init-project/templates/shopifyOnline.ts +0 -50
  47. package/src/actions/init-project/updateInitialTemplateMetadata.ts +0 -24
  48. package/src/actions/login/login.telemetry.ts +0 -18
  49. package/src/actions/login/login.ts +0 -350
  50. package/src/actions/login/types.ts +0 -19
  51. package/src/actions/project/createProject.ts +0 -36
  52. package/src/actions/telemetry/setTelemetryConsent.ts +0 -101
  53. package/src/actions/typegen/generate.telemetry.ts +0 -20
  54. package/src/actions/typegen/generateAction.ts +0 -210
  55. package/src/actions/versions/findSanityModuleVersions.ts +0 -185
  56. package/src/actions/yarn/events.ts +0 -73
  57. package/src/cli.ts +0 -350
  58. package/src/cliClient.ts +0 -62
  59. package/src/commands/blueprints/addBlueprintsCommand.ts +0 -155
  60. package/src/commands/blueprints/blueprintsGroup.ts +0 -10
  61. package/src/commands/blueprints/configBlueprintsCommand.ts +0 -86
  62. package/src/commands/blueprints/deployBlueprintsCommand.ts +0 -63
  63. package/src/commands/blueprints/destroyBlueprintsCommand.ts +0 -78
  64. package/src/commands/blueprints/infoBlueprintsCommand.ts +0 -55
  65. package/src/commands/blueprints/initBlueprintsCommand.ts +0 -99
  66. package/src/commands/blueprints/logsBlueprintsCommand.ts +0 -66
  67. package/src/commands/blueprints/planBlueprintsCommand.ts +0 -51
  68. package/src/commands/blueprints/stacksBlueprintsCommand.ts +0 -66
  69. package/src/commands/codemod/codemodCommand.ts +0 -32
  70. package/src/commands/debug/debugCommand.ts +0 -26
  71. package/src/commands/debug/printDebugInfo.ts +0 -243
  72. package/src/commands/docs/docsCommand.ts +0 -20
  73. package/src/commands/functions/devFunctionsCommand.ts +0 -73
  74. package/src/commands/functions/envFunctionsCommand.ts +0 -105
  75. package/src/commands/functions/functionsGroup.ts +0 -10
  76. package/src/commands/functions/logsFunctionsCommand.ts +0 -94
  77. package/src/commands/functions/testFunctionsCommand.ts +0 -93
  78. package/src/commands/help/helpCommand.ts +0 -21
  79. package/src/commands/help/showHelp.ts +0 -58
  80. package/src/commands/index.ts +0 -72
  81. package/src/commands/init/initCommand.ts +0 -123
  82. package/src/commands/install/installCommand.ts +0 -38
  83. package/src/commands/learn/learnCommand.ts +0 -20
  84. package/src/commands/login/loginCommand.ts +0 -29
  85. package/src/commands/logout/logoutCommand.ts +0 -52
  86. package/src/commands/manage/manageCommand.ts +0 -24
  87. package/src/commands/projects/listProjectsCommand.ts +0 -62
  88. package/src/commands/projects/projectsGroup.ts +0 -10
  89. package/src/commands/telemetry/disableTelemetryCommand.ts +0 -19
  90. package/src/commands/telemetry/enableTelemetryCommand.ts +0 -19
  91. package/src/commands/telemetry/telemetryGroup.ts +0 -10
  92. package/src/commands/telemetry/telemetryStatusCommand.ts +0 -89
  93. package/src/commands/typegen/generateTypesCommand.ts +0 -56
  94. package/src/commands/typegen/typegenGroup.ts +0 -10
  95. package/src/commands/versions/printVersionResult.ts +0 -51
  96. package/src/commands/versions/versionsCommand.ts +0 -13
  97. package/src/config.ts +0 -14
  98. package/src/debug.ts +0 -3
  99. package/src/index.ts +0 -6
  100. package/src/outputters/cliOutputter.ts +0 -47
  101. package/src/packageManager/getInstallCommand.ts +0 -26
  102. package/src/packageManager/getUpgradeCommand.ts +0 -52
  103. package/src/packageManager/index.ts +0 -33
  104. package/src/packageManager/installPackages.ts +0 -99
  105. package/src/packageManager/packageManagerChoice.ts +0 -204
  106. package/src/packageManager/uninstallPackages.ts +0 -44
  107. package/src/packageManager/yarnStub.ts +0 -22
  108. package/src/prompters/cliPrompter.ts +0 -9
  109. package/src/run.ts +0 -8
  110. package/src/studioDependencies.ts +0 -25
  111. package/src/types.ts +0 -387
  112. package/src/util/canLaunchBrowser.ts +0 -12
  113. package/src/util/cliWorker.ts +0 -34
  114. package/src/util/clientWrapper.ts +0 -119
  115. package/src/util/copy.ts +0 -50
  116. package/src/util/createExpiringConfig.ts +0 -80
  117. package/src/util/createTelemetryStore.ts +0 -204
  118. package/src/util/detectRuntime.ts +0 -12
  119. package/src/util/dynamicRequire.ts +0 -17
  120. package/src/util/frameworkPort.ts +0 -63
  121. package/src/util/generateCommandsDocumentation.ts +0 -62
  122. package/src/util/getCliConfig.ts +0 -172
  123. package/src/util/getCliVersion.ts +0 -22
  124. package/src/util/getLocalVersion.ts +0 -35
  125. package/src/util/getProjectDefaults.ts +0 -103
  126. package/src/util/getProviderName.ts +0 -9
  127. package/src/util/getUserConfig.ts +0 -15
  128. package/src/util/isCi.ts +0 -7
  129. package/src/util/isCommandGroup.ts +0 -7
  130. package/src/util/isInteractive.ts +0 -3
  131. package/src/util/isTrueish.ts +0 -8
  132. package/src/util/journeyConfig.ts +0 -280
  133. package/src/util/loadEnv.ts +0 -110
  134. package/src/util/mergeCommands.ts +0 -78
  135. package/src/util/neatStack.ts +0 -30
  136. package/src/util/noSuchCommandText.ts +0 -91
  137. package/src/util/parseArguments.ts +0 -76
  138. package/src/util/pathExists.ts +0 -14
  139. package/src/util/readJson.ts +0 -6
  140. package/src/util/readdirRecursive.ts +0 -26
  141. package/src/util/remoteTemplate.ts +0 -320
  142. package/src/util/resolveLatestVersions.ts +0 -24
  143. package/src/util/resolveRootDir.ts +0 -59
  144. package/src/util/telemetryDisclosure.ts +0 -45
  145. package/src/util/updateNotifier.ts +0 -158
  146. package/src/util/writeJson.ts +0 -6
  147. package/src/workers/getAndWriteJourneySchema.ts +0 -7
  148. package/src/workers/getCliConfig.ts +0 -14
  149. package/src/workers/typegenGenerate.ts +0 -228
@@ -1,252 +0,0 @@
1
- // Types
2
-
3
- const authorType = `import {UserIcon} from '@sanity/icons'
4
- import {defineArrayMember, defineField, defineType} from 'sanity'
5
-
6
- export const authorType = defineType({
7
- name: 'author',
8
- title: 'Author',
9
- type: 'document',
10
- icon: UserIcon,
11
- fields: [
12
- defineField({
13
- name: 'name',
14
- type: 'string',
15
- }),
16
- defineField({
17
- name: 'slug',
18
- type: 'slug',
19
- options: {
20
- source: 'name',
21
- },
22
- }),
23
- defineField({
24
- name: 'image',
25
- type: 'image',
26
- options: {
27
- hotspot: true,
28
- },
29
- }),
30
- defineField({
31
- name: 'bio',
32
- type: 'array',
33
- of: [
34
- defineArrayMember({
35
- type: 'block',
36
- styles: [{title: 'Normal', value: 'normal'}],
37
- lists: [],
38
- }),
39
- ],
40
- }),
41
- ],
42
- preview: {
43
- select: {
44
- title: 'name',
45
- media: 'image',
46
- },
47
- },
48
- })
49
- `
50
-
51
- const blockContentType = `import {defineType, defineArrayMember} from 'sanity'
52
- import {ImageIcon} from '@sanity/icons'
53
-
54
- /**
55
- * This is the schema type for block content used in the post document type
56
- * Importing this type into the studio configuration's \`schema\` property
57
- * lets you reuse it in other document types with:
58
- * {
59
- * name: 'someName',
60
- * title: 'Some title',
61
- * type: 'blockContent'
62
- * }
63
- */
64
-
65
- export const blockContentType = defineType({
66
- title: 'Block Content',
67
- name: 'blockContent',
68
- type: 'array',
69
- of: [
70
- defineArrayMember({
71
- type: 'block',
72
- // Styles let you define what blocks can be marked up as. The default
73
- // set corresponds with HTML tags, but you can set any title or value
74
- // you want, and decide how you want to deal with it where you want to
75
- // use your content.
76
- styles: [
77
- {title: 'Normal', value: 'normal'},
78
- {title: 'H1', value: 'h1'},
79
- {title: 'H2', value: 'h2'},
80
- {title: 'H3', value: 'h3'},
81
- {title: 'H4', value: 'h4'},
82
- {title: 'Quote', value: 'blockquote'},
83
- ],
84
- lists: [{title: 'Bullet', value: 'bullet'}],
85
- // Marks let you mark up inline text in the Portable Text Editor
86
- marks: {
87
- // Decorators usually describe a single property – e.g. a typographic
88
- // preference or highlighting
89
- decorators: [
90
- {title: 'Strong', value: 'strong'},
91
- {title: 'Emphasis', value: 'em'},
92
- ],
93
- // Annotations can be any object structure – e.g. a link or a footnote.
94
- annotations: [
95
- {
96
- title: 'URL',
97
- name: 'link',
98
- type: 'object',
99
- fields: [
100
- {
101
- title: 'URL',
102
- name: 'href',
103
- type: 'url',
104
- },
105
- ],
106
- },
107
- ],
108
- },
109
- }),
110
- // You can add additional types here. Note that you can't use
111
- // primitive types such as 'string' and 'number' in the same array
112
- // as a block type.
113
- defineArrayMember({
114
- type: 'image',
115
- icon: ImageIcon,
116
- options: {hotspot: true},
117
- fields: [
118
- {
119
- name: 'alt',
120
- type: 'string',
121
- title: 'Alternative Text',
122
- }
123
- ]
124
- }),
125
- ],
126
- })
127
- `
128
-
129
- const categoryType = `import {TagIcon} from '@sanity/icons'
130
- import {defineField, defineType} from 'sanity'
131
-
132
- export const categoryType = defineType({
133
- name: 'category',
134
- title: 'Category',
135
- type: 'document',
136
- icon: TagIcon,
137
- fields: [
138
- defineField({
139
- name: 'title',
140
- type: 'string',
141
- }),
142
- defineField({
143
- name: 'slug',
144
- type: 'slug',
145
- options: {
146
- source: 'title',
147
- },
148
- }),
149
- defineField({
150
- name: 'description',
151
- type: 'text',
152
- }),
153
- ],
154
- })
155
- `
156
-
157
- const postType = `import {DocumentTextIcon} from '@sanity/icons'
158
- import {defineArrayMember, defineField, defineType} from 'sanity'
159
-
160
- export const postType = defineType({
161
- name: 'post',
162
- title: 'Post',
163
- type: 'document',
164
- icon: DocumentTextIcon,
165
- fields: [
166
- defineField({
167
- name: 'title',
168
- type: 'string',
169
- }),
170
- defineField({
171
- name: 'slug',
172
- type: 'slug',
173
- options: {
174
- source: 'title',
175
- },
176
- }),
177
- defineField({
178
- name: 'author',
179
- type: 'reference',
180
- to: {type: 'author'},
181
- }),
182
- defineField({
183
- name: 'mainImage',
184
- type: 'image',
185
- options: {
186
- hotspot: true,
187
- },
188
- fields: [
189
- defineField({
190
- name: 'alt',
191
- type: 'string',
192
- title: 'Alternative text',
193
- })
194
- ]
195
- }),
196
- defineField({
197
- name: 'categories',
198
- type: 'array',
199
- of: [defineArrayMember({type: 'reference', to: {type: 'category'}})],
200
- }),
201
- defineField({
202
- name: 'publishedAt',
203
- type: 'datetime',
204
- }),
205
- defineField({
206
- name: 'body',
207
- type: 'blockContent',
208
- }),
209
- ],
210
- preview: {
211
- select: {
212
- title: 'title',
213
- author: 'author.name',
214
- media: 'mainImage',
215
- },
216
- prepare(selection) {
217
- const {author} = selection
218
- return {...selection, subtitle: author && \`by \${author}\`}
219
- },
220
- },
221
- })
222
- `
223
-
224
- // Schema definition
225
- export const blogSchemaTS = `import { type SchemaTypeDefinition } from 'sanity'
226
-
227
- import {blockContentType} from './blockContentType'
228
- import {categoryType} from './categoryType'
229
- import {postType} from './postType'
230
- import {authorType} from './authorType'
231
-
232
- export const schema: { types: SchemaTypeDefinition[] } = {
233
- types: [blockContentType, categoryType, postType, authorType],
234
- }
235
- `
236
-
237
- export const blogSchemaJS = `import {blockContentType} from './blockContentType'
238
- import {categoryType} from './categoryType'
239
- import {postType} from './postType'
240
- import {authorType} from './authorType'
241
-
242
- export const schema = {
243
- types: [blockContentType, categoryType, postType, authorType],
244
- }
245
- `
246
-
247
- export const blogSchemaFolder: Record<string, string> = {
248
- 'authorType.': authorType,
249
- 'blockContentType.': blockContentType,
250
- 'categoryType.': categoryType,
251
- 'postType.': postType,
252
- }
@@ -1,5 +0,0 @@
1
- import {type ProjectTemplate} from '../initProject'
2
-
3
- const quickStartTemplate: ProjectTemplate = {}
4
-
5
- export default quickStartTemplate
@@ -1,78 +0,0 @@
1
- import {type ProjectTemplate} from '../initProject'
2
-
3
- const configTemplate = `
4
- import {defineConfig, isDev} from 'sanity'
5
-
6
- import {structureTool} from 'sanity/structure'
7
- import {schemaTypes} from './schemaTypes'
8
- import {structure} from './structure'
9
-
10
- import {visionTool} from '@sanity/vision'
11
- import {colorInput} from '@sanity/color-input'
12
- import {imageHotspotArrayPlugin} from 'sanity-plugin-hotspot-array'
13
- import {media, mediaAssetSource} from 'sanity-plugin-media'
14
- import {customDocumentActions} from './plugins/customDocumentActions'
15
- import Navbar from './components/studio/Navbar'
16
-
17
- const devOnlyPlugins = [visionTool()]
18
-
19
- export default defineConfig({
20
- name: '%sourceName%',
21
- title: '%projectName%',
22
-
23
- projectId: '%projectId%',
24
- dataset: '%dataset%',
25
-
26
- plugins: [
27
- structureTool({structure}),
28
- colorInput(),
29
- imageHotspotArrayPlugin(),
30
- customDocumentActions(),
31
- media(),
32
- ...(isDev ? devOnlyPlugins : []),
33
- ],
34
-
35
- schema: {
36
- types: schemaTypes,
37
- },
38
-
39
- form: {
40
- file: {
41
- assetSources: (previousAssetSources) => {
42
- return previousAssetSources.filter((assetSource) => assetSource !== mediaAssetSource)
43
- },
44
- },
45
- image: {
46
- assetSources: (previousAssetSources) => {
47
- return previousAssetSources.filter((assetSource) => assetSource === mediaAssetSource)
48
- },
49
- },
50
- },
51
-
52
- studio: {
53
- components: {
54
- navbar: Navbar,
55
- },
56
- },
57
- })`
58
-
59
- const shopifyTemplate: ProjectTemplate = {
60
- configTemplate,
61
- dependencies: {
62
- '@sanity/asset-utils': '^1.3.0',
63
- '@sanity/color-input': '^3.0.2',
64
- '@sanity/icons': '^2.11.0',
65
- '@sanity/ui': '^2.0.0',
66
- 'lodash.get': '^4.4.2',
67
- 'pluralize-esm': '^9.0.2',
68
- 'sanity-plugin-hotspot-array': '^1.0.1',
69
- 'sanity-plugin-media': '^2.0.5',
70
- 'slug': '^8.2.2',
71
- },
72
- devDependencies: {
73
- '@portabletext/types': '^2.0.2',
74
- '@types/lodash.get': '^4.4.7',
75
- '@types/slug': '^5.0.3',
76
- },
77
- }
78
- export default shopifyTemplate
@@ -1,50 +0,0 @@
1
- import {type ProjectTemplate} from '../initProject'
2
-
3
- const configTemplate = `
4
- import {shopifyAssets} from 'sanity-plugin-shopify-assets'
5
- import {defineConfig, isDev} from 'sanity'
6
- import {structureTool} from 'sanity/structure'
7
- import {visionTool} from '@sanity/vision'
8
- import {shopifyDocumentActions} from './plugins/shopifyDocumentActions'
9
- import {schemaTypes} from './schemaTypes'
10
- import {structure} from './structure'
11
- import {SHOPIFY_STORE_ID} from './constants'
12
-
13
- const devOnlyPlugins = [visionTool()]
14
-
15
- export default defineConfig({
16
- name: '%sourceName%',
17
- title: '%projectName%',
18
-
19
- projectId: '%projectId%',
20
- dataset: '%dataset%',
21
-
22
- plugins: [
23
- structureTool({structure}),
24
- shopifyDocumentActions(),
25
- shopifyAssets({
26
- shopifyDomain: SHOPIFY_STORE_ID,
27
- }),
28
- ...(isDev ? devOnlyPlugins : []),
29
- ],
30
-
31
- schema: {
32
- types: schemaTypes,
33
- },
34
- })
35
- `
36
-
37
- const shopifyTemplate: ProjectTemplate = {
38
- configTemplate,
39
- typescriptOnly: true,
40
- dependencies: {
41
- '@portabletext/toolkit': '^2.0.1',
42
- '@sanity/icons': '^2.11.0',
43
- '@sanity/ui': '^2.0.0',
44
- '@types/lodash.get': '^4.4.7',
45
- 'lodash.get': '^4.4.2',
46
- 'pluralize-esm': '^9.0.4',
47
- 'sanity-plugin-shopify-assets': '^1.1.0',
48
- },
49
- }
50
- export default shopifyTemplate
@@ -1,24 +0,0 @@
1
- import {debug} from '../../debug'
2
- import {type CliApiClient} from '../../types'
3
-
4
- export async function updateInitialTemplateMetadata(
5
- apiClient: CliApiClient,
6
- projectId: string,
7
- templateName: string,
8
- ): Promise<void> {
9
- try {
10
- await apiClient({api: {projectId}}).request({
11
- method: 'PATCH',
12
- uri: `/projects/${projectId}`,
13
- body: {metadata: {initialTemplate: templateName}},
14
- })
15
- } catch (err: unknown) {
16
- // Non-critical that we update this metadata, and user does not need to be aware
17
- let message = typeof err === 'string' ? err : '<unknown error>'
18
- if (err instanceof Error) {
19
- message = err.message
20
- }
21
-
22
- debug('Failed to update initial template metadata for project: %s', message)
23
- }
24
- }
@@ -1,18 +0,0 @@
1
- import {defineTrace} from '@sanity/telemetry'
2
-
3
- interface SelectProviderStep {
4
- step: 'selectProvider'
5
- provider: string | undefined
6
- }
7
-
8
- interface WaitForTokenStep {
9
- step: 'waitForToken'
10
- }
11
-
12
- type LoginTraceData = SelectProviderStep | WaitForTokenStep
13
-
14
- export const LoginTrace = defineTrace<LoginTraceData>({
15
- name: 'CLI Login Step Completed',
16
- version: 1,
17
- description: 'User completed a step in the CLI login flow',
18
- })