@sanity/cli 3.93.0 → 3.93.1-bump-pkg-utils.10.412e2ab170
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/_chunks-cjs/cli.js +4 -4
- package/lib/_chunks-cjs/cli.js.map +1 -1
- package/lib/cli.d.ts +6 -10
- package/lib/index.d.mts +331 -418
- package/lib/index.d.ts +331 -418
- package/lib/run.d.ts +1 -1
- package/lib/workers/getAndWriteJourneySchema.d.ts +1 -1
- package/lib/workers/getCliConfig.d.ts +1 -1
- package/lib/workers/typegenGenerate.d.ts +35 -42
- package/package.json +5 -5
package/lib/index.d.mts
CHANGED
|
@@ -1,264 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {InlineConfig} from
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
|
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;
|
|
181
14
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
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>
|
|
15
|
+
declare function getCliClient(options?: CliClientOptions): SanityClient$1;
|
|
16
|
+
declare namespace getCliClient {
|
|
17
|
+
var __internal__getToken: () => string | undefined;
|
|
218
18
|
}
|
|
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
|
-
|
|
256
19
|
declare function getInstallCommand(options: {
|
|
257
|
-
workDir: string
|
|
258
|
-
pkgNames?: string[]
|
|
259
|
-
depType?: 'dev' | 'prod' | 'peer'
|
|
260
|
-
}): Promise<string
|
|
261
|
-
|
|
20
|
+
workDir: string;
|
|
21
|
+
pkgNames?: string[];
|
|
22
|
+
depType?: 'dev' | 'prod' | 'peer';
|
|
23
|
+
}): Promise<string>;
|
|
24
|
+
type PackageManager = 'npm' | 'yarn' | 'pnpm' | 'bun' | 'manual';
|
|
262
25
|
/**
|
|
263
26
|
* Attempts to resolve the most optimal package manager to use to install/upgrade
|
|
264
27
|
* packages/dependencies at a given path. It does so by looking for package manager
|
|
@@ -280,45 +43,252 @@ declare function getInstallCommand(options: {
|
|
|
280
43
|
* not available, instead of prompting
|
|
281
44
|
* @returns Object of `chosen` and, if a lockfile is found, the `mostOptimal` choice
|
|
282
45
|
*/
|
|
283
|
-
declare function getPackageManagerChoice(
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
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 {
|
|
299
269
|
/**
|
|
300
270
|
* ID of GraphQL API. Only (currently) required when using the `--api` flag
|
|
301
271
|
* for `sanity graphql deploy`, in order to only deploy a specific API.
|
|
302
272
|
*/
|
|
303
|
-
id?: string
|
|
273
|
+
id?: string;
|
|
304
274
|
/**
|
|
305
275
|
* Name of workspace containing the schema to deploy
|
|
306
276
|
*
|
|
307
277
|
* Optional, defaults to `default` (eg the one used if no `name` is defined)
|
|
308
278
|
*/
|
|
309
|
-
workspace?: string
|
|
279
|
+
workspace?: string;
|
|
310
280
|
/**
|
|
311
281
|
* Name of source containing the schema to deploy, within the configured workspace
|
|
312
282
|
*
|
|
313
283
|
* Optional, defaults to `default` (eg the one used if no `name` is defined)
|
|
314
284
|
*/
|
|
315
|
-
source?: string
|
|
285
|
+
source?: string;
|
|
316
286
|
/**
|
|
317
287
|
* API tag for this API - allows deploying multiple different APIs to a single dataset
|
|
318
288
|
*
|
|
319
289
|
* Optional, defaults to `default`
|
|
320
290
|
*/
|
|
321
|
-
tag?: string
|
|
291
|
+
tag?: string;
|
|
322
292
|
/**
|
|
323
293
|
* Whether or not to deploy a "GraphQL Playground" to the API url - an HTML interface that allows
|
|
324
294
|
* running queries and introspecting the schema from the browser. Note that this interface is not
|
|
@@ -327,13 +297,13 @@ export declare interface GraphQLAPIConfig {
|
|
|
327
297
|
*
|
|
328
298
|
* Optional, defaults to `true`
|
|
329
299
|
*/
|
|
330
|
-
playground?: boolean
|
|
300
|
+
playground?: boolean;
|
|
331
301
|
/**
|
|
332
302
|
* Generation of API to auto-generate from schema. New APIs should use the latest (`gen3`).
|
|
333
303
|
*
|
|
334
304
|
* Optional, defaults to `gen3`
|
|
335
305
|
*/
|
|
336
|
-
generation?: 'gen3' | 'gen2' | 'gen1'
|
|
306
|
+
generation?: 'gen3' | 'gen2' | 'gen1';
|
|
337
307
|
/**
|
|
338
308
|
* Define document interface fields (`_id`, `_type` etc) as non-nullable.
|
|
339
309
|
* If you never use a document type as an object (within other documents) in your schema types,
|
|
@@ -343,69 +313,24 @@ export declare interface GraphQLAPIConfig {
|
|
|
343
313
|
*
|
|
344
314
|
* Optional, defaults to `false`
|
|
345
315
|
*/
|
|
346
|
-
nonNullDocumentFields?: boolean
|
|
316
|
+
nonNullDocumentFields?: boolean;
|
|
347
317
|
/**
|
|
348
318
|
* Suffix to use for generated filter types.
|
|
349
319
|
*
|
|
350
320
|
* Optional, Defaults to `Filter`.
|
|
351
321
|
*
|
|
352
322
|
*/
|
|
353
|
-
filterSuffix?: string
|
|
323
|
+
filterSuffix?: string;
|
|
354
324
|
}
|
|
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
|
-
|
|
400
325
|
/**
|
|
401
326
|
* 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
|
|
402
327
|
* @beta
|
|
403
328
|
*/
|
|
404
|
-
|
|
329
|
+
interface ReactCompilerConfig {
|
|
405
330
|
/**
|
|
406
331
|
* @see https://react.dev/learn/react-compiler#existing-projects
|
|
407
332
|
*/
|
|
408
|
-
sources?: Array<string> | ((filename: string) => boolean) | null
|
|
333
|
+
sources?: Array<string> | ((filename: string) => boolean) | null;
|
|
409
334
|
/**
|
|
410
335
|
* The minimum major version of React that the compiler should emit code for. If the target is 19
|
|
411
336
|
* or higher, the compiler emits direct imports of React runtime APIs needed by the compiler. On
|
|
@@ -413,96 +338,84 @@ export declare interface ReactCompilerConfig {
|
|
|
413
338
|
* a userspace approximation of runtime APIs.
|
|
414
339
|
* @see https://react.dev/learn/react-compiler#using-react-compiler-with-react-17-or-18
|
|
415
340
|
*/
|
|
416
|
-
target: '18' | '19'
|
|
417
|
-
panicThreshold?: 'ALL_ERRORS' | 'CRITICAL_ERRORS' | 'NONE'
|
|
418
|
-
compilationMode?: 'infer' | 'syntax' | 'annotation' | 'all'
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
export declare interface ResolvedCliCommand {
|
|
422
|
-
command: CliCommandDefinition | CliCommandGroupDefinition
|
|
423
|
-
commandName: string
|
|
424
|
-
parentName?: string
|
|
425
|
-
isGroup: boolean
|
|
426
|
-
isCommand: boolean
|
|
341
|
+
target: '18' | '19';
|
|
342
|
+
panicThreshold?: 'ALL_ERRORS' | 'CRITICAL_ERRORS' | 'NONE';
|
|
343
|
+
compilationMode?: 'infer' | 'syntax' | 'annotation' | 'all';
|
|
427
344
|
}
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
345
|
+
interface AppConfig {
|
|
346
|
+
organizationId: string;
|
|
347
|
+
/**
|
|
348
|
+
* Defaults to './src/App'
|
|
349
|
+
*/
|
|
350
|
+
entry?: string;
|
|
351
|
+
id?: string;
|
|
434
352
|
}
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
root?: boolean
|
|
353
|
+
interface CliConfig {
|
|
354
|
+
api?: CliApiConfig;
|
|
438
355
|
project?: {
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
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
|
|
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
|
+
};
|
|
502
394
|
}
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
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 };
|