@sanity/cli 3.93.1-bump-pkg-utils.10.412e2ab170 → 3.93.1-bump-pkg-utils.34.5d0c0b3d22

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 (167) hide show
  1. package/lib/_chunks-cjs/cli.js +1 -1
  2. package/lib/_chunks-cjs/cli.js.map +1 -1
  3. package/lib/_chunks-cjs/cliWorker.js.map +1 -1
  4. package/lib/_chunks-cjs/generateAction.js.map +1 -1
  5. package/lib/_chunks-cjs/getCliConfig.js.map +1 -1
  6. package/lib/_chunks-cjs/journeyConfig.js.map +1 -1
  7. package/lib/_chunks-cjs/loadEnv.js.map +1 -1
  8. package/lib/cli.d.ts +10 -6
  9. package/lib/index.d.mts +418 -331
  10. package/lib/index.d.ts +418 -331
  11. package/lib/index.js.map +1 -1
  12. package/lib/index.mjs.map +1 -1
  13. package/lib/run.d.ts +1 -1
  14. package/lib/run.js.map +1 -1
  15. package/lib/workers/getAndWriteJourneySchema.d.ts +1 -1
  16. package/lib/workers/getAndWriteJourneySchema.js.map +1 -1
  17. package/lib/workers/getCliConfig.d.ts +1 -1
  18. package/lib/workers/getCliConfig.js.map +1 -1
  19. package/lib/workers/typegenGenerate.d.ts +42 -35
  20. package/lib/workers/typegenGenerate.js.map +1 -1
  21. package/package.json +6 -7
  22. package/templates/blog/README.md +1 -1
  23. package/templates/clean/README.md +1 -1
  24. package/templates/ecommerce/README.md +1 -1
  25. package/templates/get-started/README.md +1 -1
  26. package/templates/moviedb/README.md +1 -1
  27. package/templates/quickstart/README.md +1 -1
  28. package/src/CommandRunner.ts +0 -219
  29. package/src/__telemetry__/cli.telemetry.ts +0 -29
  30. package/src/__telemetry__/init.telemetry.ts +0 -95
  31. package/src/actions/codemod/codemodAction.ts +0 -109
  32. package/src/actions/codemod/mods/deskRename.ts +0 -19
  33. package/src/actions/codemod/mods/index.ts +0 -9
  34. package/src/actions/codemod/mods/partsTypeDirective.ts +0 -28
  35. package/src/actions/codemod/mods/reactIconsV3.ts +0 -54
  36. package/src/actions/codemod/types.ts +0 -10
  37. package/src/actions/init-plugin/bootstrapFromTemplate.ts +0 -196
  38. package/src/actions/init-project/bootstrapLocalTemplate.ts +0 -201
  39. package/src/actions/init-project/bootstrapRemoteTemplate.ts +0 -118
  40. package/src/actions/init-project/createAppCliConfig.ts +0 -24
  41. package/src/actions/init-project/createCliConfig.ts +0 -31
  42. package/src/actions/init-project/createPackageManifest.ts +0 -102
  43. package/src/actions/init-project/createStudioConfig.ts +0 -53
  44. package/src/actions/init-project/determineAppTemplate.ts +0 -13
  45. package/src/actions/init-project/fsUtils.ts +0 -40
  46. package/src/actions/init-project/git.ts +0 -59
  47. package/src/actions/init-project/initProject.ts +0 -1708
  48. package/src/actions/init-project/processTemplate.ts +0 -55
  49. package/src/actions/init-project/promptForDatasetName.ts +0 -68
  50. package/src/actions/init-project/prompts/index.ts +0 -51
  51. package/src/actions/init-project/prompts/nextjs.ts +0 -59
  52. package/src/actions/init-project/readPackageJson.ts +0 -17
  53. package/src/actions/init-project/templates/appQuickstart.ts +0 -23
  54. package/src/actions/init-project/templates/appSanityUi.ts +0 -25
  55. package/src/actions/init-project/templates/blog.ts +0 -5
  56. package/src/actions/init-project/templates/clean.ts +0 -5
  57. package/src/actions/init-project/templates/getStarted.ts +0 -37
  58. package/src/actions/init-project/templates/index.ts +0 -24
  59. package/src/actions/init-project/templates/moviedb.ts +0 -35
  60. package/src/actions/init-project/templates/nextjs/index.ts +0 -238
  61. package/src/actions/init-project/templates/nextjs/schemaTypes/blog.ts +0 -252
  62. package/src/actions/init-project/templates/quickstart.ts +0 -5
  63. package/src/actions/init-project/templates/shopify.ts +0 -78
  64. package/src/actions/init-project/templates/shopifyOnline.ts +0 -50
  65. package/src/actions/init-project/updateInitialTemplateMetadata.ts +0 -24
  66. package/src/actions/login/login.telemetry.ts +0 -18
  67. package/src/actions/login/login.ts +0 -350
  68. package/src/actions/login/types.ts +0 -19
  69. package/src/actions/project/createProject.ts +0 -36
  70. package/src/actions/telemetry/setTelemetryConsent.ts +0 -101
  71. package/src/actions/typegen/generate.telemetry.ts +0 -20
  72. package/src/actions/typegen/generateAction.ts +0 -210
  73. package/src/actions/versions/findSanityModuleVersions.ts +0 -185
  74. package/src/actions/yarn/events.ts +0 -73
  75. package/src/cli.ts +0 -350
  76. package/src/cliClient.ts +0 -62
  77. package/src/commands/blueprints/addBlueprintsCommand.ts +0 -155
  78. package/src/commands/blueprints/blueprintsGroup.ts +0 -10
  79. package/src/commands/blueprints/configBlueprintsCommand.ts +0 -86
  80. package/src/commands/blueprints/deployBlueprintsCommand.ts +0 -63
  81. package/src/commands/blueprints/destroyBlueprintsCommand.ts +0 -78
  82. package/src/commands/blueprints/infoBlueprintsCommand.ts +0 -55
  83. package/src/commands/blueprints/initBlueprintsCommand.ts +0 -99
  84. package/src/commands/blueprints/logsBlueprintsCommand.ts +0 -66
  85. package/src/commands/blueprints/planBlueprintsCommand.ts +0 -51
  86. package/src/commands/blueprints/stacksBlueprintsCommand.ts +0 -66
  87. package/src/commands/codemod/codemodCommand.ts +0 -32
  88. package/src/commands/debug/debugCommand.ts +0 -26
  89. package/src/commands/debug/printDebugInfo.ts +0 -243
  90. package/src/commands/docs/docsCommand.ts +0 -20
  91. package/src/commands/functions/devFunctionsCommand.ts +0 -73
  92. package/src/commands/functions/envFunctionsCommand.ts +0 -105
  93. package/src/commands/functions/functionsGroup.ts +0 -10
  94. package/src/commands/functions/logsFunctionsCommand.ts +0 -94
  95. package/src/commands/functions/testFunctionsCommand.ts +0 -93
  96. package/src/commands/help/helpCommand.ts +0 -21
  97. package/src/commands/help/showHelp.ts +0 -58
  98. package/src/commands/index.ts +0 -72
  99. package/src/commands/init/initCommand.ts +0 -123
  100. package/src/commands/install/installCommand.ts +0 -38
  101. package/src/commands/learn/learnCommand.ts +0 -20
  102. package/src/commands/login/loginCommand.ts +0 -29
  103. package/src/commands/logout/logoutCommand.ts +0 -52
  104. package/src/commands/manage/manageCommand.ts +0 -24
  105. package/src/commands/projects/listProjectsCommand.ts +0 -62
  106. package/src/commands/projects/projectsGroup.ts +0 -10
  107. package/src/commands/telemetry/disableTelemetryCommand.ts +0 -19
  108. package/src/commands/telemetry/enableTelemetryCommand.ts +0 -19
  109. package/src/commands/telemetry/telemetryGroup.ts +0 -10
  110. package/src/commands/telemetry/telemetryStatusCommand.ts +0 -89
  111. package/src/commands/typegen/generateTypesCommand.ts +0 -56
  112. package/src/commands/typegen/typegenGroup.ts +0 -10
  113. package/src/commands/versions/printVersionResult.ts +0 -51
  114. package/src/commands/versions/versionsCommand.ts +0 -13
  115. package/src/config.ts +0 -14
  116. package/src/debug.ts +0 -3
  117. package/src/index.ts +0 -6
  118. package/src/outputters/cliOutputter.ts +0 -47
  119. package/src/packageManager/getInstallCommand.ts +0 -26
  120. package/src/packageManager/getUpgradeCommand.ts +0 -52
  121. package/src/packageManager/index.ts +0 -33
  122. package/src/packageManager/installPackages.ts +0 -99
  123. package/src/packageManager/packageManagerChoice.ts +0 -204
  124. package/src/packageManager/uninstallPackages.ts +0 -44
  125. package/src/packageManager/yarnStub.ts +0 -22
  126. package/src/prompters/cliPrompter.ts +0 -9
  127. package/src/run.ts +0 -8
  128. package/src/studioDependencies.ts +0 -25
  129. package/src/types.ts +0 -387
  130. package/src/util/canLaunchBrowser.ts +0 -12
  131. package/src/util/cliWorker.ts +0 -34
  132. package/src/util/clientWrapper.ts +0 -119
  133. package/src/util/copy.ts +0 -50
  134. package/src/util/createExpiringConfig.ts +0 -80
  135. package/src/util/createTelemetryStore.ts +0 -204
  136. package/src/util/detectRuntime.ts +0 -12
  137. package/src/util/dynamicRequire.ts +0 -17
  138. package/src/util/frameworkPort.ts +0 -63
  139. package/src/util/generateCommandsDocumentation.ts +0 -62
  140. package/src/util/getCliConfig.ts +0 -172
  141. package/src/util/getCliVersion.ts +0 -22
  142. package/src/util/getLocalVersion.ts +0 -35
  143. package/src/util/getProjectDefaults.ts +0 -103
  144. package/src/util/getProviderName.ts +0 -9
  145. package/src/util/getUserConfig.ts +0 -15
  146. package/src/util/isCi.ts +0 -7
  147. package/src/util/isCommandGroup.ts +0 -7
  148. package/src/util/isInteractive.ts +0 -3
  149. package/src/util/isTrueish.ts +0 -8
  150. package/src/util/journeyConfig.ts +0 -280
  151. package/src/util/loadEnv.ts +0 -110
  152. package/src/util/mergeCommands.ts +0 -78
  153. package/src/util/neatStack.ts +0 -30
  154. package/src/util/noSuchCommandText.ts +0 -91
  155. package/src/util/parseArguments.ts +0 -76
  156. package/src/util/pathExists.ts +0 -14
  157. package/src/util/readJson.ts +0 -6
  158. package/src/util/readdirRecursive.ts +0 -26
  159. package/src/util/remoteTemplate.ts +0 -320
  160. package/src/util/resolveLatestVersions.ts +0 -24
  161. package/src/util/resolveRootDir.ts +0 -59
  162. package/src/util/telemetryDisclosure.ts +0 -45
  163. package/src/util/updateNotifier.ts +0 -158
  164. package/src/util/writeJson.ts +0 -6
  165. package/src/workers/getAndWriteJourneySchema.ts +0 -7
  166. package/src/workers/getCliConfig.ts +0 -14
  167. package/src/workers/typegenGenerate.ts +0 -228
package/lib/index.d.mts CHANGED
@@ -1,27 +1,264 @@
1
- import { SanityClient, SanityClient as SanityClient$1 } from "@sanity/client";
2
- import { TelemetryLogger } from "@sanity/telemetry";
3
- import chalk from "chalk";
4
- import { Answers, ChoiceCollection, DistinctQuestion, Separator } from "inquirer";
5
- import { Options, Ora } from "ora";
6
- import { ConfigEnv, InlineConfig } from "vite";
7
- interface CliClientOptions {
8
- cwd?: string;
9
- projectId?: string;
10
- dataset?: string;
11
- useCdn?: boolean;
12
- token?: string;
13
- apiVersion?: string;
1
+ import {Answers} from 'inquirer'
2
+ import type chalk from 'chalk'
3
+ import {ChoiceCollection} from 'inquirer'
4
+ import {ConfigEnv} from 'vite'
5
+ import {DistinctQuestion} from 'inquirer'
6
+ import {InlineConfig} from 'vite'
7
+ import {Options} from 'ora'
8
+ import {Ora} from 'ora'
9
+ import {SanityClient} from '@sanity/client'
10
+ import {Separator} from 'inquirer'
11
+ import {TelemetryLogger} from '@sanity/telemetry'
12
+
13
+ declare interface AppConfig {
14
+ organizationId: string
15
+ /**
16
+ * Defaults to './src/App'
17
+ */
18
+ entry?: string
19
+ id?: string
20
+ }
21
+
22
+ export declare type CliApiClient = (options?: ClientRequirements) => SanityClient
23
+
24
+ export declare interface CliApiConfig {
25
+ projectId?: string
26
+ dataset?: string
27
+ }
28
+
29
+ export declare interface CliBaseCommandContext {
30
+ output: CliOutputter
31
+ prompt: CliPrompter
32
+ apiClient: CliApiClient
33
+ sanityMajorVersion: 2 | 3
34
+ cliConfigPath?: string
35
+ cliRoot: string
36
+ workDir: string
37
+ corePath?: string
38
+ chalk: typeof chalk
39
+ commandRunner: CliCommandRunner
40
+ fromInitCommand?: boolean
41
+ }
42
+
43
+ export declare interface CliClientOptions {
44
+ cwd?: string
45
+ projectId?: string
46
+ dataset?: string
47
+ useCdn?: boolean
48
+ token?: string
49
+ apiVersion?: string
50
+ }
51
+
52
+ export declare type CliCommandAction<F = Record<string, unknown>> = (
53
+ args: CliCommandArguments<F>,
54
+ context: CliCommandContext,
55
+ ) => Promise<unknown>
56
+
57
+ export declare interface CliCommandArguments<F = Record<string, unknown>> {
58
+ groupOrCommand: string
59
+ argv: string[]
60
+ extOptions: F
61
+ argsWithoutOptions: string[]
62
+ extraArguments: string[]
63
+ }
64
+
65
+ export declare type CliCommandContext = CliV2CommandContext | CliV3CommandContext
66
+
67
+ export declare interface CliCommandDefinition<F = Record<string, unknown>> {
68
+ name: string
69
+ group?: string
70
+ signature: string
71
+ description: string
72
+ helpText: string
73
+ action: CliCommandAction<F>
74
+ hideFromHelp?: boolean
75
+ }
76
+
77
+ export declare interface CliCommandGroupDefinition {
78
+ name: string
79
+ signature: string
80
+ isGroupRoot: boolean
81
+ description: string
82
+ hideFromHelp?: boolean
83
+ }
84
+
85
+ export declare interface CliCommandRunner {
86
+ commands: Readonly<(CliCommandDefinition | CliCommandGroupDefinition)[]>
87
+ commandGroups: Readonly<Record<string, (CliCommandDefinition | CliCommandGroupDefinition)[]>>
88
+ runCommand(
89
+ commandOrGroup: string,
90
+ args: CliCommandArguments,
91
+ options: CommandRunnerOptions,
92
+ ): Promise<unknown>
93
+ resolveSubcommand(
94
+ group: (CliCommandDefinition | CliCommandGroupDefinition)[],
95
+ subCommandName: string,
96
+ parentGroupName: string,
97
+ ): ResolvedCliCommand | null
98
+ }
99
+
100
+ export declare interface CliConfig {
101
+ api?: CliApiConfig
102
+ project?: {
103
+ basePath?: string
104
+ }
105
+ /**
106
+ * Wraps the Studio in `<React.StrictMode>` root to aid flagging potential problems related to concurrent features (`startTransition`, `useTransition`, `useDeferredValue`, `Suspense`)
107
+ * Can also be enabled by setting `SANITY_STUDIO_REACT_STRICT_MODE="true"|"false"`.
108
+ * It only applies to `sanity dev` in dev mode, it's ignored in `sanity build` and in production.
109
+ * Defaults to `false`
110
+ */
111
+ reactStrictMode?: boolean
112
+ /**
113
+ * The React Compiler is currently in beta, and is disabled by default.
114
+ * @see https://react.dev/learn/react-compiler
115
+ * @beta
116
+ */
117
+ reactCompiler?: ReactCompilerConfig
118
+ server?: {
119
+ hostname?: string
120
+ port?: number
121
+ }
122
+ graphql?: GraphQLAPIConfig[]
123
+ vite?: UserViteConfig
124
+ autoUpdates?: boolean
125
+ studioHost?: string
126
+ /**
127
+ * Parameter used to configure other kinds of applications.
128
+ * Signals to `sanity` commands that this is not a studio.
129
+ */
130
+ app?: AppConfig
131
+ /**
132
+ * Configuration for Sanity media libraries.
133
+ */
134
+ mediaLibrary?: {
135
+ /**
136
+ * The path to the Media Library aspects directory. When using the CLI to manage aspects, this
137
+ * is the directory they will be read from and written to.
138
+ */
139
+ aspectsPath: string
140
+ }
141
+ }
142
+
143
+ declare type CliConfigResult =
144
+ | {
145
+ config: SanityJson
146
+ path: string
147
+ version: 2
148
+ }
149
+ | {
150
+ config: CliConfig
151
+ path: string
152
+ version: 3
153
+ }
154
+ | {
155
+ config: null
156
+ path: string
157
+ version: CliMajorVersion
158
+ }
159
+
160
+ declare interface ClientRequirements {
161
+ requireUser?: boolean
162
+ requireProject?: boolean
163
+ api?: {
164
+ projectId?: string
165
+ dataset?: string
166
+ apiHost?: string
167
+ apiVersion?: string
168
+ requestTagPrefix?: string
169
+ }
170
+ }
171
+
172
+ declare type CliMajorVersion = 2 | 3
173
+
174
+ export declare interface CliOutputter {
175
+ print: (...args: unknown[]) => void
176
+ success: (...args: unknown[]) => void
177
+ warn: (...args: unknown[]) => void
178
+ error: (...args: unknown[]) => void
179
+ clear: () => void
180
+ spinner(options: Options | string): Ora
14
181
  }
15
- declare function getCliClient(options?: CliClientOptions): SanityClient$1;
16
- declare namespace getCliClient {
17
- var __internal__getToken: () => string | undefined;
182
+
183
+ /**
184
+ * @internal
185
+ */
186
+ declare type CliPackageManager = typeof cliPackageManager
187
+
188
+ /**
189
+ * @internal
190
+ */
191
+ declare const cliPackageManager: {
192
+ getInstallCommand: typeof getInstallCommand
193
+ getPackageManagerChoice: typeof getPackageManagerChoice
194
+ installNewPackages: typeof installNewPackages
195
+ }
196
+
197
+ export declare type CliPrompter = (<T extends Answers = Answers>(
198
+ questions: DistinctQuestion<T>[],
199
+ ) => Promise<T>) & {
200
+ Separator: typeof Separator
201
+ single: <T = string>(question: SinglePrompt) => Promise<T>
202
+ }
203
+
204
+ export declare type CliStubbedYarn = (args: string[], options?: CliYarnOptions) => Promise<void>
205
+
206
+ export declare interface CliUserConfig {
207
+ cliLastUpdateCheck?: number
208
+ cliLastUpdateNag?: number
209
+ authToken?: string
210
+ authType?: string
211
+ }
212
+
213
+ export declare interface CliV2CommandContext extends CliBaseCommandContext {
214
+ sanityMajorVersion: 2
215
+ cliConfig?: SanityJson
216
+ cliPackageManager?: CliPackageManager
217
+ telemetry: TelemetryLogger<TelemetryUserProperties>
18
218
  }
219
+
220
+ export declare interface CliV3CommandContext extends CliBaseCommandContext {
221
+ sanityMajorVersion: 3
222
+ cliConfig?: CliConfig
223
+ cliPackageManager: CliPackageManager
224
+ telemetry: TelemetryLogger<TelemetryUserProperties>
225
+ }
226
+
227
+ export declare interface CliYarnOptions {
228
+ print?: CliOutputter['print']
229
+ error?: CliOutputter['error']
230
+ rootDir?: string
231
+ }
232
+
233
+ export declare interface CommandRunnerOptions {
234
+ cliConfig: CliConfigResult | null
235
+ cliRoot: string
236
+ workDir: string
237
+ corePath: string | undefined
238
+ telemetry: TelemetryLogger<TelemetryUserProperties>
239
+ }
240
+
241
+ /**
242
+ * @deprecated Use `defineCliConfig` instead
243
+ * @beta
244
+ */
245
+ export declare function createCliConfig(config: CliConfig): CliConfig
246
+
247
+ /** @beta */
248
+ export declare function defineCliConfig(config: CliConfig): CliConfig
249
+
250
+ export declare function getCliClient(options?: CliClientOptions): SanityClient
251
+
252
+ export declare namespace getCliClient {
253
+ var __internal__getToken: () => string | undefined
254
+ }
255
+
19
256
  declare function getInstallCommand(options: {
20
- workDir: string;
21
- pkgNames?: string[];
22
- depType?: 'dev' | 'prod' | 'peer';
23
- }): Promise<string>;
24
- type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun' | 'manual';
257
+ workDir: string
258
+ pkgNames?: string[]
259
+ depType?: 'dev' | 'prod' | 'peer'
260
+ }): Promise<string>
261
+
25
262
  /**
26
263
  * Attempts to resolve the most optimal package manager to use to install/upgrade
27
264
  * packages/dependencies at a given path. It does so by looking for package manager
@@ -43,252 +280,45 @@ type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun' | 'manual';
43
280
  * not available, instead of prompting
44
281
  * @returns Object of `chosen` and, if a lockfile is found, the `mostOptimal` choice
45
282
  */
46
- declare function getPackageManagerChoice(workDir: string, options: {
47
- interactive: false;
48
- } | {
49
- interactive?: true;
50
- prompt: CliPrompter;
51
- }): Promise<{
52
- chosen: PackageManager;
53
- mostOptimal?: PackageManager;
54
- }>;
55
- interface InstallOptions {
56
- packageManager: PackageManager;
57
- packages: string[];
58
- }
59
- declare function installNewPackages(options: InstallOptions, context: Pick<CliCommandContext, 'output' | 'workDir'>): Promise<void>;
60
- /**
61
- * @internal
62
- */
63
- declare const cliPackageManager: {
64
- getInstallCommand: typeof getInstallCommand;
65
- getPackageManagerChoice: typeof getPackageManagerChoice;
66
- installNewPackages: typeof installNewPackages;
67
- };
68
- /**
69
- * @internal
70
- */
71
- type CliPackageManager = typeof cliPackageManager;
72
- interface ClientRequirements {
73
- requireUser?: boolean;
74
- requireProject?: boolean;
75
- api?: {
76
- projectId?: string;
77
- dataset?: string;
78
- apiHost?: string;
79
- apiVersion?: string;
80
- requestTagPrefix?: string;
81
- };
82
- }
83
- type CliMajorVersion = 2 | 3;
84
- type CliConfigResult = {
85
- config: SanityJson;
86
- path: string;
87
- version: 2;
88
- } | {
89
- config: CliConfig;
90
- path: string;
91
- version: 3;
92
- } | {
93
- config: null;
94
- path: string;
95
- version: CliMajorVersion;
96
- };
97
- interface SanityCore {
98
- requiredCliVersionRange: string;
99
- commands: (CliCommandDefinition | CliCommandGroupDefinition)[];
100
- }
101
- interface SanityModuleInternal {
102
- cliProjectCommands: {
103
- requiredCliVersionRange: string;
104
- commands: (CliCommandDefinition | CliCommandGroupDefinition)[];
105
- };
106
- }
107
- interface PackageJson {
108
- name: string;
109
- version: string;
110
- scripts?: Record<string, string>;
111
- description?: string;
112
- author?: string;
113
- license?: string;
114
- private?: boolean;
115
- dependencies?: Record<string, string>;
116
- devDependencies?: Record<string, string>;
117
- peerDependencies?: Record<string, string>;
118
- repository?: {
119
- type: string;
120
- url: string;
121
- };
122
- }
123
- interface CliCommandGroupDefinition {
124
- name: string;
125
- signature: string;
126
- isGroupRoot: boolean;
127
- description: string;
128
- hideFromHelp?: boolean;
129
- }
130
- interface ResolvedCliCommand {
131
- command: CliCommandDefinition | CliCommandGroupDefinition;
132
- commandName: string;
133
- parentName?: string;
134
- isGroup: boolean;
135
- isCommand: boolean;
136
- }
137
- type CliCommandAction<F = Record<string, unknown>> = (args: CliCommandArguments<F>, context: CliCommandContext) => Promise<unknown>;
138
- interface CliCommandDefinition<F = Record<string, unknown>> {
139
- name: string;
140
- group?: string;
141
- signature: string;
142
- description: string;
143
- helpText: string;
144
- action: CliCommandAction<F>;
145
- hideFromHelp?: boolean;
146
- }
147
- interface CliCommandArguments<F = Record<string, unknown>> {
148
- groupOrCommand: string;
149
- argv: string[];
150
- extOptions: F;
151
- argsWithoutOptions: string[];
152
- extraArguments: string[];
153
- }
154
- type CliCommandContext = CliV2CommandContext | CliV3CommandContext;
155
- interface CliBaseCommandContext {
156
- output: CliOutputter;
157
- prompt: CliPrompter;
158
- apiClient: CliApiClient;
159
- sanityMajorVersion: 2 | 3;
160
- cliConfigPath?: string;
161
- cliRoot: string;
162
- workDir: string;
163
- corePath?: string;
164
- chalk: typeof chalk;
165
- commandRunner: CliCommandRunner;
166
- fromInitCommand?: boolean;
167
- }
168
- interface TelemetryUserProperties {
169
- runtime: string;
170
- runtimeVersion: string;
171
- cliVersion: string;
172
- machinePlatform: string;
173
- cpuArchitecture: string;
174
- projectId?: string;
175
- dataset?: string;
176
- }
177
- interface CliV2CommandContext extends CliBaseCommandContext {
178
- sanityMajorVersion: 2;
179
- cliConfig?: SanityJson;
180
- cliPackageManager?: CliPackageManager;
181
- telemetry: TelemetryLogger<TelemetryUserProperties>;
182
- }
183
- interface CliV3CommandContext extends CliBaseCommandContext {
184
- sanityMajorVersion: 3;
185
- cliConfig?: CliConfig;
186
- cliPackageManager: CliPackageManager;
187
- telemetry: TelemetryLogger<TelemetryUserProperties>;
188
- }
189
- interface CliCommandRunner {
190
- commands: Readonly<(CliCommandDefinition | CliCommandGroupDefinition)[]>;
191
- commandGroups: Readonly<Record<string, (CliCommandDefinition | CliCommandGroupDefinition)[]>>;
192
- runCommand(commandOrGroup: string, args: CliCommandArguments, options: CommandRunnerOptions): Promise<unknown>;
193
- resolveSubcommand(group: (CliCommandDefinition | CliCommandGroupDefinition)[], subCommandName: string, parentGroupName: string): ResolvedCliCommand | null;
194
- }
195
- interface CliUserConfig {
196
- cliLastUpdateCheck?: number;
197
- cliLastUpdateNag?: number;
198
- authToken?: string;
199
- authType?: string;
200
- }
201
- interface CommandRunnerOptions {
202
- cliConfig: CliConfigResult | null;
203
- cliRoot: string;
204
- workDir: string;
205
- corePath: string | undefined;
206
- telemetry: TelemetryLogger<TelemetryUserProperties>;
207
- }
208
- interface CliOutputter {
209
- print: (...args: unknown[]) => void;
210
- success: (...args: unknown[]) => void;
211
- warn: (...args: unknown[]) => void;
212
- error: (...args: unknown[]) => void;
213
- clear: () => void;
214
- spinner(options: Options | string): Ora;
215
- }
216
- type SinglePrompt = (Omit<DistinctQuestion, 'name'> & {
217
- type: 'list';
218
- choices: ChoiceCollection;
219
- }) | (Omit<DistinctQuestion, 'name'> & {
220
- type: 'confirm';
221
- }) | (Omit<DistinctQuestion, 'name'> & {
222
- type: 'input';
223
- });
224
- type CliPrompter = (<T extends Answers = Answers>(questions: DistinctQuestion<T>[]) => Promise<T>) & {
225
- Separator: typeof Separator;
226
- single: <T = string>(question: SinglePrompt) => Promise<T>;
227
- };
228
- type CliApiClient = (options?: ClientRequirements) => SanityClient$1;
229
- interface CliYarnOptions {
230
- print?: CliOutputter['print'];
231
- error?: CliOutputter['error'];
232
- rootDir?: string;
233
- }
234
- type CliStubbedYarn = (args: string[], options?: CliYarnOptions) => Promise<void>;
235
- interface CliApiConfig {
236
- projectId?: string;
237
- dataset?: string;
238
- }
239
- interface SanityJson {
240
- root?: boolean;
241
- project?: {
242
- name?: string;
243
- basePath?: string;
244
- };
245
- api?: CliApiConfig;
246
- __experimental_spaces?: {
247
- name: string;
248
- title: string;
249
- default?: true;
250
- api: {
251
- projectId?: string;
252
- dataset?: string;
253
- };
254
- }[];
255
- plugins?: string[];
256
- parts?: {
257
- name?: string;
258
- path?: string;
259
- implements?: string;
260
- description?: string;
261
- }[];
262
- env?: {
263
- production?: SanityJson;
264
- staging?: SanityJson;
265
- development?: SanityJson;
266
- };
267
- }
268
- interface GraphQLAPIConfig {
283
+ declare function getPackageManagerChoice(
284
+ workDir: string,
285
+ options:
286
+ | {
287
+ interactive: false
288
+ }
289
+ | {
290
+ interactive?: true
291
+ prompt: CliPrompter
292
+ },
293
+ ): Promise<{
294
+ chosen: PackageManager
295
+ mostOptimal?: PackageManager
296
+ }>
297
+
298
+ export declare interface GraphQLAPIConfig {
269
299
  /**
270
300
  * ID of GraphQL API. Only (currently) required when using the `--api` flag
271
301
  * for `sanity graphql deploy`, in order to only deploy a specific API.
272
302
  */
273
- id?: string;
303
+ id?: string
274
304
  /**
275
305
  * Name of workspace containing the schema to deploy
276
306
  *
277
307
  * Optional, defaults to `default` (eg the one used if no `name` is defined)
278
308
  */
279
- workspace?: string;
309
+ workspace?: string
280
310
  /**
281
311
  * Name of source containing the schema to deploy, within the configured workspace
282
312
  *
283
313
  * Optional, defaults to `default` (eg the one used if no `name` is defined)
284
314
  */
285
- source?: string;
315
+ source?: string
286
316
  /**
287
317
  * API tag for this API - allows deploying multiple different APIs to a single dataset
288
318
  *
289
319
  * Optional, defaults to `default`
290
320
  */
291
- tag?: string;
321
+ tag?: string
292
322
  /**
293
323
  * Whether or not to deploy a "GraphQL Playground" to the API url - an HTML interface that allows
294
324
  * running queries and introspecting the schema from the browser. Note that this interface is not
@@ -297,13 +327,13 @@ interface GraphQLAPIConfig {
297
327
  *
298
328
  * Optional, defaults to `true`
299
329
  */
300
- playground?: boolean;
330
+ playground?: boolean
301
331
  /**
302
332
  * Generation of API to auto-generate from schema. New APIs should use the latest (`gen3`).
303
333
  *
304
334
  * Optional, defaults to `gen3`
305
335
  */
306
- generation?: 'gen3' | 'gen2' | 'gen1';
336
+ generation?: 'gen3' | 'gen2' | 'gen1'
307
337
  /**
308
338
  * Define document interface fields (`_id`, `_type` etc) as non-nullable.
309
339
  * If you never use a document type as an object (within other documents) in your schema types,
@@ -313,24 +343,69 @@ interface GraphQLAPIConfig {
313
343
  *
314
344
  * Optional, defaults to `false`
315
345
  */
316
- nonNullDocumentFields?: boolean;
346
+ nonNullDocumentFields?: boolean
317
347
  /**
318
348
  * Suffix to use for generated filter types.
319
349
  *
320
350
  * Optional, Defaults to `Filter`.
321
351
  *
322
352
  */
323
- filterSuffix?: string;
353
+ filterSuffix?: string
324
354
  }
355
+
356
+ declare function installNewPackages(
357
+ options: InstallOptions,
358
+ context: Pick<CliCommandContext, 'output' | 'workDir'>,
359
+ ): Promise<void>
360
+
361
+ declare interface InstallOptions {
362
+ packageManager: PackageManager
363
+ packages: string[]
364
+ }
365
+
366
+ /**
367
+ * This is an "inlined" version of Vite's `loadEnv` function,
368
+ * simplified somewhat to only support our use case.
369
+ *
370
+ * Ideally we'd just use `loadEnv` from Vite, but importing it
371
+ * causes bundling issues due to node APIs and downstream dependencies.
372
+ *
373
+ * Vite is MIT licensed, copyright (c) Yuxi (Evan) You and Vite contributors.
374
+ */
375
+ export declare function loadEnv(
376
+ mode: string,
377
+ envDir: string,
378
+ prefixes?: string[],
379
+ ): Record<string, string>
380
+
381
+ export declare interface PackageJson {
382
+ name: string
383
+ version: string
384
+ scripts?: Record<string, string>
385
+ description?: string
386
+ author?: string
387
+ license?: string
388
+ private?: boolean
389
+ dependencies?: Record<string, string>
390
+ devDependencies?: Record<string, string>
391
+ peerDependencies?: Record<string, string>
392
+ repository?: {
393
+ type: string
394
+ url: string
395
+ }
396
+ }
397
+
398
+ declare type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun' | 'manual'
399
+
325
400
  /**
326
401
  * Until these types are on npm: https://github.com/facebook/react/blob/0bc30748730063e561d87a24a4617526fdd38349/compiler/packages/babel-plugin-react-compiler/src/Entrypoint/Options.ts#L39-L122
327
402
  * @beta
328
403
  */
329
- interface ReactCompilerConfig {
404
+ export declare interface ReactCompilerConfig {
330
405
  /**
331
406
  * @see https://react.dev/learn/react-compiler#existing-projects
332
407
  */
333
- sources?: Array<string> | ((filename: string) => boolean) | null;
408
+ sources?: Array<string> | ((filename: string) => boolean) | null
334
409
  /**
335
410
  * The minimum major version of React that the compiler should emit code for. If the target is 19
336
411
  * or higher, the compiler emits direct imports of React runtime APIs needed by the compiler. On
@@ -338,84 +413,96 @@ interface ReactCompilerConfig {
338
413
  * a userspace approximation of runtime APIs.
339
414
  * @see https://react.dev/learn/react-compiler#using-react-compiler-with-react-17-or-18
340
415
  */
341
- target: '18' | '19';
342
- panicThreshold?: 'ALL_ERRORS' | 'CRITICAL_ERRORS' | 'NONE';
343
- compilationMode?: 'infer' | 'syntax' | 'annotation' | 'all';
416
+ target: '18' | '19'
417
+ panicThreshold?: 'ALL_ERRORS' | 'CRITICAL_ERRORS' | 'NONE'
418
+ compilationMode?: 'infer' | 'syntax' | 'annotation' | 'all'
344
419
  }
345
- interface AppConfig {
346
- organizationId: string;
347
- /**
348
- * Defaults to './src/App'
349
- */
350
- entry?: string;
351
- id?: string;
420
+
421
+ export declare interface ResolvedCliCommand {
422
+ command: CliCommandDefinition | CliCommandGroupDefinition
423
+ commandName: string
424
+ parentName?: string
425
+ isGroup: boolean
426
+ isCommand: boolean
352
427
  }
353
- interface CliConfig {
354
- api?: CliApiConfig;
428
+
429
+ export {SanityClient}
430
+
431
+ export declare interface SanityCore {
432
+ requiredCliVersionRange: string
433
+ commands: (CliCommandDefinition | CliCommandGroupDefinition)[]
434
+ }
435
+
436
+ export declare interface SanityJson {
437
+ root?: boolean
355
438
  project?: {
356
- basePath?: string;
357
- };
358
- /**
359
- * Wraps the Studio in `<React.StrictMode>` root to aid flagging potential problems related to concurrent features (`startTransition`, `useTransition`, `useDeferredValue`, `Suspense`)
360
- * Can also be enabled by setting `SANITY_STUDIO_REACT_STRICT_MODE="true"|"false"`.
361
- * It only applies to `sanity dev` in dev mode, it's ignored in `sanity build` and in production.
362
- * Defaults to `false`
363
- */
364
- reactStrictMode?: boolean;
365
- /**
366
- * The React Compiler is currently in beta, and is disabled by default.
367
- * @see https://react.dev/learn/react-compiler
368
- * @beta
369
- */
370
- reactCompiler?: ReactCompilerConfig;
371
- server?: {
372
- hostname?: string;
373
- port?: number;
374
- };
375
- graphql?: GraphQLAPIConfig[];
376
- vite?: UserViteConfig;
377
- autoUpdates?: boolean;
378
- studioHost?: string;
379
- /**
380
- * Parameter used to configure other kinds of applications.
381
- * Signals to `sanity` commands that this is not a studio.
382
- */
383
- app?: AppConfig;
384
- /**
385
- * Configuration for Sanity media libraries.
386
- */
387
- mediaLibrary?: {
388
- /**
389
- * The path to the Media Library aspects directory. When using the CLI to manage aspects, this
390
- * is the directory they will be read from and written to.
391
- */
392
- aspectsPath: string;
393
- };
439
+ name?: string
440
+ basePath?: string
441
+ }
442
+ api?: CliApiConfig
443
+ __experimental_spaces?: {
444
+ name: string
445
+ title: string
446
+ default?: true
447
+ api: {
448
+ projectId?: string
449
+ dataset?: string
450
+ }
451
+ }[]
452
+ plugins?: string[]
453
+ parts?: {
454
+ name?: string
455
+ path?: string
456
+ implements?: string
457
+ description?: string
458
+ }[]
459
+ env?: {
460
+ production?: SanityJson
461
+ staging?: SanityJson
462
+ development?: SanityJson
463
+ }
394
464
  }
395
- type UserViteConfig = InlineConfig | ((config: InlineConfig, env: ConfigEnv) => InlineConfig | Promise<InlineConfig>);
396
- type SanityUser = {
397
- id: string;
398
- name: string;
399
- email: string;
400
- profileImage?: string;
401
- tosAcceptedAt?: string;
402
- provider: 'google' | 'github' | 'sanity' | `saml-${string}`;
403
- };
404
- /** @beta */
405
- declare function defineCliConfig(config: CliConfig): CliConfig;
406
- /**
407
- * @deprecated Use `defineCliConfig` instead
408
- * @beta
409
- */
410
- declare function createCliConfig(config: CliConfig): CliConfig;
411
- /**
412
- * This is an "inlined" version of Vite's `loadEnv` function,
413
- * simplified somewhat to only support our use case.
414
- *
415
- * Ideally we'd just use `loadEnv` from Vite, but importing it
416
- * causes bundling issues due to node APIs and downstream dependencies.
417
- *
418
- * Vite is MIT licensed, copyright (c) Yuxi (Evan) You and Vite contributors.
419
- */
420
- declare function loadEnv(mode: string, envDir: string, prefixes?: string[]): Record<string, string>;
421
- export { CliApiClient, CliApiConfig, CliBaseCommandContext, CliClientOptions, CliCommandAction, CliCommandArguments, CliCommandContext, CliCommandDefinition, CliCommandGroupDefinition, CliCommandRunner, CliConfig, CliOutputter, CliPrompter, CliStubbedYarn, CliUserConfig, CliV2CommandContext, CliV3CommandContext, CliYarnOptions, CommandRunnerOptions, GraphQLAPIConfig, PackageJson, ReactCompilerConfig, ResolvedCliCommand, SanityClient, SanityCore, SanityJson, SanityModuleInternal, SanityUser, SinglePrompt, TelemetryUserProperties, UserViteConfig, createCliConfig, defineCliConfig, getCliClient, loadEnv };
465
+
466
+ export declare interface SanityModuleInternal {
467
+ cliProjectCommands: {
468
+ requiredCliVersionRange: string
469
+ commands: (CliCommandDefinition | CliCommandGroupDefinition)[]
470
+ }
471
+ }
472
+
473
+ export declare type SanityUser = {
474
+ id: string
475
+ name: string
476
+ email: string
477
+ profileImage?: string
478
+ tosAcceptedAt?: string
479
+ provider: 'google' | 'github' | 'sanity' | `saml-${string}`
480
+ }
481
+
482
+ export declare type SinglePrompt =
483
+ | (Omit<DistinctQuestion, 'name'> & {
484
+ type: 'list'
485
+ choices: ChoiceCollection
486
+ })
487
+ | (Omit<DistinctQuestion, 'name'> & {
488
+ type: 'confirm'
489
+ })
490
+ | (Omit<DistinctQuestion, 'name'> & {
491
+ type: 'input'
492
+ })
493
+
494
+ export declare interface TelemetryUserProperties {
495
+ runtime: string
496
+ runtimeVersion: string
497
+ cliVersion: string
498
+ machinePlatform: string
499
+ cpuArchitecture: string
500
+ projectId?: string
501
+ dataset?: string
502
+ }
503
+
504
+ export declare type UserViteConfig =
505
+ | InlineConfig
506
+ | ((config: InlineConfig, env: ConfigEnv) => InlineConfig | Promise<InlineConfig>)
507
+
508
+ export {}