@sanity/cli-core 1.0.0 → 1.1.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/dist/SanityCommand.js +18 -1
- package/dist/SanityCommand.js.map +1 -1
- package/dist/_exports/package-manager.d.ts +33 -0
- package/dist/_exports/package-manager.js +3 -0
- package/dist/_exports/package-manager.js.map +1 -0
- package/dist/_exports/request.d.ts +36 -34
- package/dist/_exports/ux.d.ts +41 -41
- package/dist/config/cli/schemas.js.map +1 -1
- package/dist/config/cli/types/cliConfig.js.map +1 -1
- package/dist/index.d.ts +399 -355
- package/dist/services/apiClient.js +4 -0
- package/dist/services/apiClient.js.map +1 -1
- package/dist/util/getCliTelemetry.js +22 -9
- package/dist/util/getCliTelemetry.js.map +1 -1
- package/dist/util/packageManager.js +55 -0
- package/dist/util/packageManager.js.map +1 -0
- package/package.json +22 -19
package/dist/SanityCommand.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { styleText } from 'node:util';
|
|
1
2
|
import { Command } from '@oclif/core';
|
|
2
3
|
import { getCliConfig } from './config/cli/getCliConfig.js';
|
|
3
4
|
import { findProjectRoot } from './config/findProjectRoot.js';
|
|
@@ -5,7 +6,7 @@ import { subdebug } from './debug.js';
|
|
|
5
6
|
import { NonInteractiveError } from './errors/NonInteractiveError.js';
|
|
6
7
|
import { ProjectRootNotFoundError } from './errors/ProjectRootNotFoundError.js';
|
|
7
8
|
import { getGlobalCliClient, getProjectCliClient } from './services/apiClient.js';
|
|
8
|
-
import { getCliTelemetry } from './util/getCliTelemetry.js';
|
|
9
|
+
import { getCliTelemetry, reportCliTraceError } from './util/getCliTelemetry.js';
|
|
9
10
|
import { isInteractive } from './util/isInteractive.js';
|
|
10
11
|
const debug = subdebug('sanityCommand');
|
|
11
12
|
export class SanityCommand extends Command {
|
|
@@ -47,6 +48,22 @@ export class SanityCommand extends Command {
|
|
|
47
48
|
* @returns The telemetry store.
|
|
48
49
|
*/ telemetry;
|
|
49
50
|
/**
|
|
51
|
+
* Report real command errors to the CLI command trace.
|
|
52
|
+
* User aborts (SIGINT, ExitPromptError) are not reported — the trace is left
|
|
53
|
+
* incomplete, which accurately represents that the command was interrupted.
|
|
54
|
+
*/ async catch(err) {
|
|
55
|
+
// ExitPromptError is thrown by `@inquirer/prompts` when the user cancels a prompt
|
|
56
|
+
// The `message === 'SIGINT'` check matches oclif's own convention (see handle.js in @oclif/core)
|
|
57
|
+
if (err.name === 'ExitPromptError' || err.message === 'SIGINT') {
|
|
58
|
+
// 130 is the standard exit code for script termination by Ctrl+C
|
|
59
|
+
this.logToStderr(styleText('yellow', '\u{203A}') + ' Aborted by user');
|
|
60
|
+
return this.exit(130);
|
|
61
|
+
}
|
|
62
|
+
// In other cases, we _do_ want to report the error
|
|
63
|
+
reportCliTraceError(err);
|
|
64
|
+
return super.catch(err);
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
50
67
|
* Get the CLI config.
|
|
51
68
|
*
|
|
52
69
|
* @returns The CLI config.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/SanityCommand.ts"],"sourcesContent":["import {Command, Interfaces} from '@oclif/core'\n\nimport {getCliConfig} from './config/cli/getCliConfig.js'\nimport {type CliConfig} from './config/cli/types/cliConfig.js'\nimport {findProjectRoot} from './config/findProjectRoot.js'\nimport {type ProjectRootResult} from './config/util/recursivelyResolveProjectRoot.js'\nimport {subdebug} from './debug.js'\nimport {NonInteractiveError} from './errors/NonInteractiveError.js'\nimport {ProjectRootNotFoundError} from './errors/ProjectRootNotFoundError.js'\nimport {\n getGlobalCliClient,\n getProjectCliClient,\n type GlobalCliClientOptions,\n type ProjectCliClientOptions,\n} from './services/apiClient.js'\nimport {type CLITelemetryStore} from './telemetry/types.js'\nimport {type Output} from './types.js'\nimport {getCliTelemetry} from './util/getCliTelemetry.js'\nimport {isInteractive} from './util/isInteractive.js'\n\ntype Flags<T extends typeof Command> = Interfaces.InferredFlags<\n (typeof SanityCommand)['baseFlags'] & T['flags']\n>\n\ntype Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>\n\nconst debug = subdebug('sanityCommand')\n\nexport abstract class SanityCommand<T extends typeof Command> extends Command {\n protected args!: Args<T>\n protected flags!: Flags<T>\n\n /**\n * Get the global API client.\n *\n * @param args - The global API client options.\n * @returns The global API client.\n *\n * @deprecated use `getGlobalCliClient` function directly instead.\n */\n protected getGlobalApiClient = (args: GlobalCliClientOptions) => getGlobalCliClient(args)\n\n /**\n * Get the project API client.\n *\n * @param args - The project API client options.\n * @returns The project API client.\n *\n * @deprecated use `getProjectCliClient` function directly instead.\n */\n protected getProjectApiClient = (args: ProjectCliClientOptions) => getProjectCliClient(args)\n\n /**\n * Helper for outputting to the console.\n *\n * @example\n * ```ts\n * this.output.log('Hello')\n * this.output.warn('Warning')\n * this.output.error('Error')\n * ```\n */\n protected output: Output = {\n error: this.error.bind(this),\n log: this.log.bind(this),\n warn: this.warn.bind(this),\n }\n\n /**\n * The telemetry store.\n *\n * @returns The telemetry store.\n */\n protected telemetry!: CLITelemetryStore\n\n /**\n * Get the CLI config.\n *\n * @returns The CLI config.\n */\n protected async getCliConfig(): Promise<CliConfig> {\n const root = await this.getProjectRoot()\n\n debug(`Using project root`, root)\n return getCliConfig(root.directory)\n }\n\n /**\n * Get the project ID from passed flags or (if not provided) the CLI config.\n *\n * Optionally accepts a `fallback` function that is called when no project ID\n * can be determined from flags or config. This allows commands to provide\n * interactive project selection while keeping the prompt logic in the CLI package.\n *\n * If the fallback throws a `NonInteractiveError` (e.g. because the terminal is\n * not interactive), it falls through to the standard error with suggestions.\n *\n * Optionally accepts a `deprecatedFlagName` for commands that have a deprecated\n * flag (e.g. `--project`) that should be checked after `--project-id` but before\n * the CLI config.\n *\n * @returns The project ID.\n */\n protected async getProjectId(options?: {\n deprecatedFlagName?: string\n fallback?: () => Promise<string>\n }): Promise<string> {\n const hasProjectFlag = this.ctor.flags != null && 'project-id' in this.ctor.flags\n\n // Check --project-id flag first\n if (hasProjectFlag) {\n const flagProjectId =\n 'project-id' in this.flags && typeof this.flags['project-id'] === 'string'\n ? this.flags['project-id']\n : undefined\n\n if (flagProjectId) return flagProjectId\n }\n\n // Check deprecated flag (e.g. --project) before CLI config\n if (options?.deprecatedFlagName) {\n const deprecatedValue =\n options.deprecatedFlagName in this.flags &&\n typeof this.flags[options.deprecatedFlagName] === 'string'\n ? (this.flags[options.deprecatedFlagName] as string)\n : undefined\n\n if (deprecatedValue) return deprecatedValue\n }\n\n // Fall back to CLI config\n try {\n const config = await this.getCliConfig()\n const configProjectId = config.api?.projectId\n if (configProjectId) return configProjectId\n } catch (err) {\n if (!(err instanceof ProjectRootNotFoundError)) throw err\n // No project root — fall through to fallback/error\n }\n\n // Offer interactive selection if a fallback was provided\n if (options?.fallback) {\n try {\n return await options.fallback()\n } catch (err) {\n if (!(err instanceof NonInteractiveError)) throw err\n // Non-interactive: throw with actionable suggestions\n throw new ProjectRootNotFoundError('Unable to determine project ID', {\n cause: err,\n suggestions: [\n ...(hasProjectFlag ? ['Providing a project ID: --project-id <project-id>'] : []),\n 'Running this command from within a Sanity project directory',\n 'Running in an interactive terminal to get a project selection prompt',\n ],\n })\n }\n }\n\n throw new ProjectRootNotFoundError('Unable to determine project ID', {\n suggestions: [\n ...(hasProjectFlag ? ['Providing a project ID: --project-id <project-id>'] : []),\n 'Running this command from within a Sanity project directory',\n ],\n })\n }\n\n /**\n * Get the project's root directory by resolving the config\n *\n * @returns The project root result.\n */\n protected getProjectRoot(): Promise<ProjectRootResult> {\n return findProjectRoot(process.cwd())\n }\n\n public async init(): Promise<void> {\n const {args, flags} = await this.parse({\n args: this.ctor.args,\n baseFlags: (super.ctor as typeof SanityCommand).baseFlags,\n enableJsonFlag: this.ctor.enableJsonFlag,\n flags: this.ctor.flags,\n strict: this.ctor.strict,\n })\n\n this.args = args as Args<T>\n this.flags = flags as Flags<T>\n this.telemetry = getCliTelemetry()\n\n await super.init()\n }\n\n /**\n * Check if the command is running in unattended mode.\n *\n * This means the command should not ask for user input, instead using defaults where\n * possible, and if that does not make sense (eg there's missing information), then we\n * should error out (remember to exit with a non-zero code).\n *\n * Most commands should take an explicit `--yes` flag to enable unattended mode, but\n * some commands may also be run in unattended mode if `process.stdin` is not a TTY\n * (eg when running in a CI environment).\n */\n protected isUnattended(): boolean {\n return this.flags.yes || !this.resolveIsInteractive()\n }\n\n /**\n * Resolver for checking if the terminal is interactive. Override in tests to provide mock values.\n *\n * @returns Whether the terminal is interactive.\n */\n protected resolveIsInteractive(): boolean {\n return isInteractive()\n }\n\n /**\n * Get the CLI config, returning an empty config if no project root is found.\n *\n * Use this instead of `getCliConfig()` in commands that can operate without a\n * project directory (e.g. when `--project-id` and `--dataset` flags are provided).\n *\n * @returns The CLI config, or an empty config object if no project root is found.\n */\n protected async tryGetCliConfig(): Promise<CliConfig> {\n try {\n return await this.getCliConfig()\n } catch (err) {\n if (!(err instanceof ProjectRootNotFoundError)) throw err\n return {}\n }\n }\n}\n"],"names":["Command","getCliConfig","findProjectRoot","subdebug","NonInteractiveError","ProjectRootNotFoundError","getGlobalCliClient","getProjectCliClient","getCliTelemetry","isInteractive","debug","SanityCommand","args","flags","getGlobalApiClient","getProjectApiClient","output","error","bind","log","warn","telemetry","root","getProjectRoot","directory","getProjectId","options","hasProjectFlag","ctor","flagProjectId","undefined","deprecatedFlagName","deprecatedValue","config","configProjectId","api","projectId","err","fallback","cause","suggestions","process","cwd","init","parse","baseFlags","enableJsonFlag","strict","isUnattended","yes","resolveIsInteractive","tryGetCliConfig"],"mappings":"AAAA,SAAQA,OAAO,QAAmB,cAAa;AAE/C,SAAQC,YAAY,QAAO,+BAA8B;AAEzD,SAAQC,eAAe,QAAO,8BAA6B;AAE3D,SAAQC,QAAQ,QAAO,aAAY;AACnC,SAAQC,mBAAmB,QAAO,kCAAiC;AACnE,SAAQC,wBAAwB,QAAO,uCAAsC;AAC7E,SACEC,kBAAkB,EAClBC,mBAAmB,QAGd,0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AI,CAACnB,IAAI,CAACmB,MAAM;QAC1B;QAEA,IAAI,CAACnC,IAAI,GAAGA;QACZ,IAAI,CAACC,KAAK,GAAGA;QACb,IAAI,CAACQ,SAAS,GAAGb;QAEjB,MAAM,KAAK,CAACmC;IACd;IAEA;;;;;;;;;;GAUC,GACD,AAAUK,eAAwB;QAChC,OAAO,IAAI,CAACnC,KAAK,CAACoC,GAAG,IAAI,CAAC,IAAI,CAACC,oBAAoB;IACrD;IAEA;;;;GAIC,GACD,AAAUA,uBAAgC;QACxC,OAAOzC;IACT;IAEA;;;;;;;GAOC,GACD,MAAgB0C,kBAAsC;QACpD,IAAI;YACF,OAAO,MAAM,IAAI,CAAClD,YAAY;QAChC,EAAE,OAAOoC,KAAK;YACZ,IAAI,CAAEA,CAAAA,eAAehC,wBAAuB,GAAI,MAAMgC;YACtD,OAAO,CAAC;QACV;IACF;AACF"}
|
|
1
|
+
{"version":3,"sources":["../src/SanityCommand.ts"],"sourcesContent":["import {styleText} from 'node:util'\n\nimport {Command, Interfaces} from '@oclif/core'\nimport {type CommandError} from '@oclif/core/interfaces'\n\nimport {getCliConfig} from './config/cli/getCliConfig.js'\nimport {type CliConfig} from './config/cli/types/cliConfig.js'\nimport {findProjectRoot} from './config/findProjectRoot.js'\nimport {type ProjectRootResult} from './config/util/recursivelyResolveProjectRoot.js'\nimport {subdebug} from './debug.js'\nimport {NonInteractiveError} from './errors/NonInteractiveError.js'\nimport {ProjectRootNotFoundError} from './errors/ProjectRootNotFoundError.js'\nimport {\n getGlobalCliClient,\n getProjectCliClient,\n type GlobalCliClientOptions,\n type ProjectCliClientOptions,\n} from './services/apiClient.js'\nimport {type CLITelemetryStore} from './telemetry/types.js'\nimport {type Output} from './types.js'\nimport {getCliTelemetry, reportCliTraceError} from './util/getCliTelemetry.js'\nimport {isInteractive} from './util/isInteractive.js'\n\ntype Flags<T extends typeof Command> = Interfaces.InferredFlags<\n (typeof SanityCommand)['baseFlags'] & T['flags']\n>\n\ntype Args<T extends typeof Command> = Interfaces.InferredArgs<T['args']>\n\nconst debug = subdebug('sanityCommand')\n\nexport abstract class SanityCommand<T extends typeof Command> extends Command {\n protected args!: Args<T>\n protected flags!: Flags<T>\n\n /**\n * Get the global API client.\n *\n * @param args - The global API client options.\n * @returns The global API client.\n *\n * @deprecated use `getGlobalCliClient` function directly instead.\n */\n protected getGlobalApiClient = (args: GlobalCliClientOptions) => getGlobalCliClient(args)\n\n /**\n * Get the project API client.\n *\n * @param args - The project API client options.\n * @returns The project API client.\n *\n * @deprecated use `getProjectCliClient` function directly instead.\n */\n protected getProjectApiClient = (args: ProjectCliClientOptions) => getProjectCliClient(args)\n\n /**\n * Helper for outputting to the console.\n *\n * @example\n * ```ts\n * this.output.log('Hello')\n * this.output.warn('Warning')\n * this.output.error('Error')\n * ```\n */\n protected output: Output = {\n error: this.error.bind(this),\n log: this.log.bind(this),\n warn: this.warn.bind(this),\n }\n\n /**\n * The telemetry store.\n *\n * @returns The telemetry store.\n */\n protected telemetry!: CLITelemetryStore\n\n /**\n * Report real command errors to the CLI command trace.\n * User aborts (SIGINT, ExitPromptError) are not reported — the trace is left\n * incomplete, which accurately represents that the command was interrupted.\n */\n protected override async catch(err: CommandError): Promise<void> {\n // ExitPromptError is thrown by `@inquirer/prompts` when the user cancels a prompt\n // The `message === 'SIGINT'` check matches oclif's own convention (see handle.js in @oclif/core)\n if (err.name === 'ExitPromptError' || err.message === 'SIGINT') {\n // 130 is the standard exit code for script termination by Ctrl+C\n this.logToStderr(styleText('yellow', '\\u{203A}') + ' Aborted by user')\n return this.exit(130)\n }\n\n // In other cases, we _do_ want to report the error\n reportCliTraceError(err)\n return super.catch(err)\n }\n\n /**\n * Get the CLI config.\n *\n * @returns The CLI config.\n */\n protected async getCliConfig(): Promise<CliConfig> {\n const root = await this.getProjectRoot()\n\n debug(`Using project root`, root)\n return getCliConfig(root.directory)\n }\n\n /**\n * Get the project ID from passed flags or (if not provided) the CLI config.\n *\n * Optionally accepts a `fallback` function that is called when no project ID\n * can be determined from flags or config. This allows commands to provide\n * interactive project selection while keeping the prompt logic in the CLI package.\n *\n * If the fallback throws a `NonInteractiveError` (e.g. because the terminal is\n * not interactive), it falls through to the standard error with suggestions.\n *\n * Optionally accepts a `deprecatedFlagName` for commands that have a deprecated\n * flag (e.g. `--project`) that should be checked after `--project-id` but before\n * the CLI config.\n *\n * @returns The project ID.\n */\n protected async getProjectId(options?: {\n deprecatedFlagName?: string\n fallback?: () => Promise<string>\n }): Promise<string> {\n const hasProjectFlag = this.ctor.flags != null && 'project-id' in this.ctor.flags\n\n // Check --project-id flag first\n if (hasProjectFlag) {\n const flagProjectId =\n 'project-id' in this.flags && typeof this.flags['project-id'] === 'string'\n ? this.flags['project-id']\n : undefined\n\n if (flagProjectId) return flagProjectId\n }\n\n // Check deprecated flag (e.g. --project) before CLI config\n if (options?.deprecatedFlagName) {\n const deprecatedValue =\n options.deprecatedFlagName in this.flags &&\n typeof this.flags[options.deprecatedFlagName] === 'string'\n ? (this.flags[options.deprecatedFlagName] as string)\n : undefined\n\n if (deprecatedValue) return deprecatedValue\n }\n\n // Fall back to CLI config\n try {\n const config = await this.getCliConfig()\n const configProjectId = config.api?.projectId\n if (configProjectId) return configProjectId\n } catch (err) {\n if (!(err instanceof ProjectRootNotFoundError)) throw err\n // No project root — fall through to fallback/error\n }\n\n // Offer interactive selection if a fallback was provided\n if (options?.fallback) {\n try {\n return await options.fallback()\n } catch (err) {\n if (!(err instanceof NonInteractiveError)) throw err\n // Non-interactive: throw with actionable suggestions\n throw new ProjectRootNotFoundError('Unable to determine project ID', {\n cause: err,\n suggestions: [\n ...(hasProjectFlag ? ['Providing a project ID: --project-id <project-id>'] : []),\n 'Running this command from within a Sanity project directory',\n 'Running in an interactive terminal to get a project selection prompt',\n ],\n })\n }\n }\n\n throw new ProjectRootNotFoundError('Unable to determine project ID', {\n suggestions: [\n ...(hasProjectFlag ? ['Providing a project ID: --project-id <project-id>'] : []),\n 'Running this command from within a Sanity project directory',\n ],\n })\n }\n\n /**\n * Get the project's root directory by resolving the config\n *\n * @returns The project root result.\n */\n protected getProjectRoot(): Promise<ProjectRootResult> {\n return findProjectRoot(process.cwd())\n }\n\n public async init(): Promise<void> {\n const {args, flags} = await this.parse({\n args: this.ctor.args,\n baseFlags: (super.ctor as typeof SanityCommand).baseFlags,\n enableJsonFlag: this.ctor.enableJsonFlag,\n flags: this.ctor.flags,\n strict: this.ctor.strict,\n })\n\n this.args = args as Args<T>\n this.flags = flags as Flags<T>\n this.telemetry = getCliTelemetry()\n\n await super.init()\n }\n\n /**\n * Check if the command is running in unattended mode.\n *\n * This means the command should not ask for user input, instead using defaults where\n * possible, and if that does not make sense (eg there's missing information), then we\n * should error out (remember to exit with a non-zero code).\n *\n * Most commands should take an explicit `--yes` flag to enable unattended mode, but\n * some commands may also be run in unattended mode if `process.stdin` is not a TTY\n * (eg when running in a CI environment).\n */\n protected isUnattended(): boolean {\n return this.flags.yes || !this.resolveIsInteractive()\n }\n\n /**\n * Resolver for checking if the terminal is interactive. Override in tests to provide mock values.\n *\n * @returns Whether the terminal is interactive.\n */\n protected resolveIsInteractive(): boolean {\n return isInteractive()\n }\n\n /**\n * Get the CLI config, returning an empty config if no project root is found.\n *\n * Use this instead of `getCliConfig()` in commands that can operate without a\n * project directory (e.g. when `--project-id` and `--dataset` flags are provided).\n *\n * @returns The CLI config, or an empty config object if no project root is found.\n */\n protected async tryGetCliConfig(): Promise<CliConfig> {\n try {\n return await this.getCliConfig()\n } catch (err) {\n if (!(err instanceof ProjectRootNotFoundError)) throw err\n return {}\n }\n }\n}\n"],"names":["styleText","Command","getCliConfig","findProjectRoot","subdebug","NonInteractiveError","ProjectRootNotFoundError","getGlobalCliClient","getProjectCliClient","getCliTelemetry","reportCliTraceError","isInteractive","debug","SanityCommand","args","flags","getGlobalApiClient","getProjectApiClient","output","error","bind","log","warn","telemetry","catch","err","name","message","logToStderr","exit","root","getProjectRoot","directory","getProjectId","options","hasProjectFlag","ctor","flagProjectId","undefined","deprecatedFlagName","deprecatedValue","config","configProjectId","api","projectId","fallback","cause","suggestions","process","cwd","init","parse","baseFlags","enableJsonFlag","strict","isUnattended","yes","resolveIsInteractive","tryGetCliConfig"],"mappings":"AAAA,SAAQA,SAAS,QAAO,YAAW;AAEnC,SAAQC,OAAO,QAAmB,cAAa;AAG/C,SAAQC,YAAY,QAAO,+BAA8B;AAEzD,SAAQC,eAAe,QAAO,8BAA6B;AAE3D,SAAQC,QAAQ,QAAO,aAAY;AACnC,SAAQC,mBAAmB,QAAO,kCAAiC;AACnE,SAAQC,wBAAwB,QAAO,uCAAsC;AAC7E,SACEC,kBAAkB,EAClBC,mBAAmB,QAGd,0BAAyB;AAGhC,SAAQC,eAAe,EAAEC,mBAAmB,QAAO,4BAA2B;AAC9E,SAAQC,aAAa,QAAO,0BAAyB;AAQrD,MAAMC,QAAQR,SAAS;AAEvB,OAAO,MAAeS,sBAAgDZ;IAC1Da,KAAc;IACdC,MAAgB;IAE1B;;;;;;;GAOC,GACD,AAAUC,qBAAqB,CAACF,OAAiCP,mBAAmBO,MAAK;IAEzF;;;;;;;GAOC,GACD,AAAUG,sBAAsB,CAACH,OAAkCN,oBAAoBM,MAAK;IAE5F;;;;;;;;;GASC,GACD,AAAUI,SAAiB;QACzBC,OAAO,IAAI,CAACA,KAAK,CAACC,IAAI,CAAC,IAAI;QAC3BC,KAAK,IAAI,CAACA,GAAG,CAACD,IAAI,CAAC,IAAI;QACvBE,MAAM,IAAI,CAACA,IAAI,CAACF,IAAI,CAAC,IAAI;IAC3B,EAAC;IAED;;;;GAIC,GACD,AAAUG,UAA6B;IAEvC;;;;GAIC,GACD,MAAyBC,MAAMC,GAAiB,EAAiB;QAC/D,kFAAkF;QAClF,iGAAiG;QACjG,IAAIA,IAAIC,IAAI,KAAK,qBAAqBD,IAAIE,OAAO,KAAK,UAAU;YAC9D,iEAAiE;YACjE,IAAI,CAACC,WAAW,CAAC5B,UAAU,UAAU,cAAc;YACnD,OAAO,IAAI,CA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OuB,KAAK;YACZ,IAAI,CAAEA,CAAAA,eAAenB,wBAAuB,GAAI,MAAMmB;YACtD,OAAO,CAAC;QACV;IACF;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Runtime-detectable package managers (excludes 'manual' which is a UI-only choice).
|
|
3
|
+
*/
|
|
4
|
+
export declare type DetectedPackageManager = "bun" | "npm" | "pnpm" | "yarn";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Return the CLI invocation command for the detected (or provided) package manager.
|
|
8
|
+
*
|
|
9
|
+
* @param options - Optional `bin` (defaults to `'sanity'`) and `userAgent` override.
|
|
10
|
+
* @returns A string like `"npx sanity"`, `"pnpm exec sanity"`, etc.
|
|
11
|
+
*/
|
|
12
|
+
export declare function getBinCommand(options?: {
|
|
13
|
+
bin?: string;
|
|
14
|
+
userAgent?: string;
|
|
15
|
+
}): string;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Convenience wrapper that reads `process.env.npm_config_user_agent` and returns
|
|
19
|
+
* the detected package manager.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getRunningPackageManager():
|
|
22
|
+
| DetectedPackageManager
|
|
23
|
+
| undefined;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Extract the yarn major version from a `npm_config_user_agent` string.
|
|
27
|
+
*
|
|
28
|
+
* @param ua - User-agent string. Defaults to `process.env.npm_config_user_agent`.
|
|
29
|
+
* @returns The major version number, or `undefined` if yarn isn't detected.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getYarnMajorVersion(ua?: string): number | undefined;
|
|
32
|
+
|
|
33
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/_exports/package-manager.ts"],"sourcesContent":["export {\n type DetectedPackageManager,\n getBinCommand,\n getRunningPackageManager,\n getYarnMajorVersion,\n} from '../util/packageManager.js'\n"],"names":["getBinCommand","getRunningPackageManager","getYarnMajorVersion"],"mappings":"AAAA,SAEEA,aAAa,EACbC,wBAAwB,EACxBC,mBAAmB,QACd,4BAA2B"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import {agent} from
|
|
2
|
-
import {base} from
|
|
3
|
-
import {injectResponse} from
|
|
4
|
-
import {jsonRequest} from
|
|
5
|
-
import {jsonResponse} from
|
|
6
|
-
import {keepAlive} from
|
|
7
|
-
import {observable} from
|
|
8
|
-
import {progress} from
|
|
9
|
-
import {proxy} from
|
|
10
|
-
import {Requester} from
|
|
11
|
-
import {retry} from
|
|
12
|
-
import {urlEncoded} from
|
|
1
|
+
import { agent } from "get-it/middleware";
|
|
2
|
+
import { base } from "get-it/middleware";
|
|
3
|
+
import { injectResponse } from "get-it/middleware";
|
|
4
|
+
import { jsonRequest } from "get-it/middleware";
|
|
5
|
+
import { jsonResponse } from "get-it/middleware";
|
|
6
|
+
import { keepAlive } from "get-it/middleware";
|
|
7
|
+
import { observable } from "get-it/middleware";
|
|
8
|
+
import { progress } from "get-it/middleware";
|
|
9
|
+
import { proxy } from "get-it/middleware";
|
|
10
|
+
import { Requester } from "get-it";
|
|
11
|
+
import { retry } from "get-it/middleware";
|
|
12
|
+
import { urlEncoded } from "get-it/middleware";
|
|
13
13
|
|
|
14
|
-
export {agent}
|
|
14
|
+
export { agent };
|
|
15
15
|
|
|
16
|
-
export {base}
|
|
16
|
+
export { base };
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Creates a `get-it` requester with a standard set of middleware.
|
|
@@ -28,15 +28,17 @@ export {base}
|
|
|
28
28
|
* @returns A configured `get-it` requester
|
|
29
29
|
* @public
|
|
30
30
|
*/
|
|
31
|
-
export declare function createRequester(options?: {
|
|
31
|
+
export declare function createRequester(options?: {
|
|
32
|
+
middleware?: MiddlewareOptions;
|
|
33
|
+
}): Requester;
|
|
32
34
|
|
|
33
|
-
export {injectResponse}
|
|
35
|
+
export { injectResponse };
|
|
34
36
|
|
|
35
|
-
export {jsonRequest}
|
|
37
|
+
export { jsonRequest };
|
|
36
38
|
|
|
37
|
-
export {jsonResponse}
|
|
39
|
+
export { jsonResponse };
|
|
38
40
|
|
|
39
|
-
export {keepAlive}
|
|
41
|
+
export { keepAlive };
|
|
40
42
|
|
|
41
43
|
/**
|
|
42
44
|
* Options for configuring individual middleware in {@link createRequester}.
|
|
@@ -50,28 +52,28 @@ export declare type MiddlewareOptions = {
|
|
|
50
52
|
debug?:
|
|
51
53
|
| false
|
|
52
54
|
| {
|
|
53
|
-
namespace?: string
|
|
54
|
-
verbose?: boolean
|
|
55
|
-
}
|
|
56
|
-
headers?: false | Record<string, string
|
|
57
|
-
httpErrors?: false
|
|
55
|
+
namespace?: string;
|
|
56
|
+
verbose?: boolean;
|
|
57
|
+
};
|
|
58
|
+
headers?: false | Record<string, string>;
|
|
59
|
+
httpErrors?: false;
|
|
58
60
|
promise?:
|
|
59
61
|
| false
|
|
60
62
|
| {
|
|
61
|
-
onlyBody?: boolean
|
|
62
|
-
}
|
|
63
|
-
}
|
|
63
|
+
onlyBody?: boolean;
|
|
64
|
+
};
|
|
65
|
+
};
|
|
64
66
|
|
|
65
|
-
export {observable}
|
|
67
|
+
export { observable };
|
|
66
68
|
|
|
67
|
-
export {progress}
|
|
69
|
+
export { progress };
|
|
68
70
|
|
|
69
|
-
export {proxy}
|
|
71
|
+
export { proxy };
|
|
70
72
|
|
|
71
|
-
export {Requester}
|
|
73
|
+
export { Requester };
|
|
72
74
|
|
|
73
|
-
export {retry}
|
|
75
|
+
export { retry };
|
|
74
76
|
|
|
75
|
-
export {urlEncoded}
|
|
77
|
+
export { urlEncoded };
|
|
76
78
|
|
|
77
|
-
export {}
|
|
79
|
+
export {};
|
package/dist/_exports/ux.d.ts
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import {default as boxen} from
|
|
2
|
-
import {Options as BoxenOptions} from
|
|
3
|
-
import {Boxes} from
|
|
4
|
-
import {CLIError} from
|
|
5
|
-
import {CustomBorderStyle} from
|
|
6
|
-
import * as inquirer from
|
|
7
|
-
import {default as logSymbols} from
|
|
8
|
-
import {Separator} from
|
|
9
|
-
import {Spacing} from
|
|
10
|
-
import {Spinner} from
|
|
11
|
-
import {default as spinner} from
|
|
12
|
-
import {Ora as SpinnerInstance} from
|
|
13
|
-
import {Options as SpinnerOptions} from
|
|
14
|
-
import {oraPromise as spinnerPromise} from
|
|
15
|
-
import {PromiseOptions as SpinnerPromiseOptions} from
|
|
1
|
+
import { default as boxen } from "boxen";
|
|
2
|
+
import { Options as BoxenOptions } from "boxen";
|
|
3
|
+
import { Boxes } from "boxen";
|
|
4
|
+
import { CLIError } from "@oclif/core/errors";
|
|
5
|
+
import { CustomBorderStyle } from "boxen";
|
|
6
|
+
import * as inquirer from "@inquirer/prompts";
|
|
7
|
+
import { default as logSymbols } from "log-symbols";
|
|
8
|
+
import { Separator } from "@inquirer/prompts";
|
|
9
|
+
import { Spacing } from "boxen";
|
|
10
|
+
import { Spinner } from "ora";
|
|
11
|
+
import { default as spinner } from "ora";
|
|
12
|
+
import { Ora as SpinnerInstance } from "ora";
|
|
13
|
+
import { Options as SpinnerOptions } from "ora";
|
|
14
|
+
import { oraPromise as spinnerPromise } from "ora";
|
|
15
|
+
import { PromiseOptions as SpinnerPromiseOptions } from "ora";
|
|
16
16
|
|
|
17
|
-
export {boxen}
|
|
17
|
+
export { boxen };
|
|
18
18
|
|
|
19
|
-
export {BoxenOptions}
|
|
19
|
+
export { BoxenOptions };
|
|
20
20
|
|
|
21
|
-
export {Boxes}
|
|
21
|
+
export { Boxes };
|
|
22
22
|
|
|
23
|
-
export declare const checkbox: typeof inquirer.checkbox
|
|
23
|
+
export declare const checkbox: typeof inquirer.checkbox;
|
|
24
24
|
|
|
25
|
-
declare const confirm_2: typeof inquirer.confirm
|
|
26
|
-
export {confirm_2 as confirm}
|
|
25
|
+
declare const confirm_2: typeof inquirer.confirm;
|
|
26
|
+
export { confirm_2 as confirm };
|
|
27
27
|
|
|
28
|
-
export {CustomBorderStyle}
|
|
28
|
+
export { CustomBorderStyle };
|
|
29
29
|
|
|
30
|
-
export declare const editor: typeof inquirer.editor
|
|
30
|
+
export declare const editor: typeof inquirer.editor;
|
|
31
31
|
|
|
32
|
-
export declare const expand: typeof inquirer.expand
|
|
32
|
+
export declare const expand: typeof inquirer.expand;
|
|
33
33
|
|
|
34
|
-
export declare const input: typeof inquirer.input
|
|
34
|
+
export declare const input: typeof inquirer.input;
|
|
35
35
|
|
|
36
|
-
export {logSymbols}
|
|
36
|
+
export { logSymbols };
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* Error thrown when a prompt is attempted in a non-interactive environment
|
|
@@ -43,33 +43,33 @@ export {logSymbols}
|
|
|
43
43
|
* Extends `CLIError` to suppress stack traces in user-facing output.
|
|
44
44
|
*/
|
|
45
45
|
export declare class NonInteractiveError extends CLIError {
|
|
46
|
-
constructor(promptName: string)
|
|
46
|
+
constructor(promptName: string);
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
-
export declare const number: typeof inquirer.number
|
|
49
|
+
export declare const number: typeof inquirer.number;
|
|
50
50
|
|
|
51
|
-
export declare const password: typeof inquirer.password
|
|
51
|
+
export declare const password: typeof inquirer.password;
|
|
52
52
|
|
|
53
|
-
export declare const rawlist: typeof inquirer.rawlist
|
|
53
|
+
export declare const rawlist: typeof inquirer.rawlist;
|
|
54
54
|
|
|
55
|
-
export declare const search: typeof inquirer.search
|
|
55
|
+
export declare const search: typeof inquirer.search;
|
|
56
56
|
|
|
57
|
-
export declare const select: typeof inquirer.select
|
|
57
|
+
export declare const select: typeof inquirer.select;
|
|
58
58
|
|
|
59
|
-
export {Separator}
|
|
59
|
+
export { Separator };
|
|
60
60
|
|
|
61
|
-
export {Spacing}
|
|
61
|
+
export { Spacing };
|
|
62
62
|
|
|
63
|
-
export {Spinner}
|
|
63
|
+
export { Spinner };
|
|
64
64
|
|
|
65
|
-
export {spinner}
|
|
65
|
+
export { spinner };
|
|
66
66
|
|
|
67
|
-
export {SpinnerInstance}
|
|
67
|
+
export { SpinnerInstance };
|
|
68
68
|
|
|
69
|
-
export {SpinnerOptions}
|
|
69
|
+
export { SpinnerOptions };
|
|
70
70
|
|
|
71
|
-
export {spinnerPromise}
|
|
71
|
+
export { spinnerPromise };
|
|
72
72
|
|
|
73
|
-
export {SpinnerPromiseOptions}
|
|
73
|
+
export { SpinnerPromiseOptions };
|
|
74
74
|
|
|
75
|
-
export {}
|
|
75
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/config/cli/schemas.ts"],"sourcesContent":["import {type
|
|
1
|
+
{"version":3,"sources":["../../../src/config/cli/schemas.ts"],"sourcesContent":["import {type PluginOptions as ReactCompilerConfig} from 'babel-plugin-react-compiler'\nimport {z} from 'zod'\n\nimport {type CliConfig, type TypeGenConfig} from './types/cliConfig'\nimport {type UserViteConfig} from './types/userViteConfig'\n\n/**\n * @public\n */\nexport const cliConfigSchema = z.object({\n api: z\n .object({\n dataset: z.string().optional(),\n projectId: z.string().optional(),\n })\n .optional(),\n\n app: z\n .object({\n entry: z.string().optional(),\n icon: z.string().optional(),\n id: z.string().optional(),\n organizationId: z.string().optional(),\n title: z.string().optional(),\n })\n .optional(),\n\n autoUpdates: z.boolean().optional(),\n\n deployment: z\n .object({\n appId: z.string().optional(),\n autoUpdates: z.boolean().optional(),\n })\n .optional(),\n\n graphql: z\n .array(\n z.object({\n filterSuffix: z.string().optional(),\n generation: z.enum(['gen1', 'gen2', 'gen3']).optional(),\n id: z.string().optional(),\n nonNullDocumentFields: z.boolean().optional(),\n playground: z.boolean().optional(),\n source: z.string().optional(),\n tag: z.string().optional(),\n workspace: z.string().optional(),\n }),\n )\n .optional(),\n\n mediaLibrary: z\n .object({\n aspectsPath: z.string().optional(),\n })\n .optional(),\n\n project: z\n .object({\n basePath: z.string().optional(),\n })\n .optional(),\n\n reactCompiler: z.custom<ReactCompilerConfig>().optional(),\n\n reactStrictMode: z.boolean().optional(),\n\n schemaExtraction: z\n .object({\n enabled: z.boolean().optional(),\n enforceRequiredFields: z.boolean().optional(),\n path: z.string().optional(),\n watchPatterns: z.array(z.string()).optional(),\n workspace: z.string().optional(),\n })\n .optional(),\n\n server: z\n .object({\n hostname: z.string().optional(),\n port: z.number().optional(),\n })\n .optional(),\n\n studioHost: z.string().optional(),\n\n vite: z.custom<UserViteConfig>().optional(),\n\n typegen: z.custom<Partial<TypeGenConfig> & {enabled?: boolean}>().optional(),\n}) satisfies z.ZodType<CliConfig>\n"],"names":["z","cliConfigSchema","object","api","dataset","string","optional","projectId","app","entry","icon","id","organizationId","title","autoUpdates","boolean","deployment","appId","graphql","array","filterSuffix","generation","enum","nonNullDocumentFields","playground","source","tag","workspace","mediaLibrary","aspectsPath","project","basePath","reactCompiler","custom","reactStrictMode","schemaExtraction","enabled","enforceRequiredFields","path","watchPatterns","server","hostname","port","number","studioHost","vite","typegen"],"mappings":"AACA,SAAQA,CAAC,QAAO,MAAK;AAKrB;;CAEC,GACD,OAAO,MAAMC,kBAAkBD,EAAEE,MAAM,CAAC;IACtCC,KAAKH,EACFE,MAAM,CAAC;QACNE,SAASJ,EAAEK,MAAM,GAAGC,QAAQ;QAC5BC,WAAWP,EAAEK,MAAM,GAAGC,QAAQ;IAChC,GACCA,QAAQ;IAEXE,KAAKR,EACFE,MAAM,CAAC;QACNO,OAAOT,EAAEK,MAAM,GAAGC,QAAQ;QAC1BI,MAAMV,EAAEK,MAAM,GAAGC,QAAQ;QACzBK,IAAIX,EAAEK,MAAM,GAAGC,QAAQ;QACvBM,gBAAgBZ,EAAEK,MAAM,GAAGC,QAAQ;QACnCO,OAAOb,EAAEK,MAAM,GAAGC,QAAQ;IAC5B,GACCA,QAAQ;IAEXQ,aAAad,EAAEe,OAAO,GAAGT,QAAQ;IAEjCU,YAAYhB,EACTE,MAAM,CAAC;QACNe,OAAOjB,EAAEK,MAAM,GAAGC,QAAQ;QAC1BQ,aAAad,EAAEe,OAAO,GAAGT,QAAQ;IACnC,GACC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,EAAEK,MAAM,GAAGC,QAAQ;IAE/BuC,MAAM7C,EAAEiC,MAAM,GAAmB3B,QAAQ;IAEzCwC,SAAS9C,EAAEiC,MAAM,GAAiD3B,QAAQ;AAC5E,GAAiC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/config/cli/types/cliConfig.ts"],"sourcesContent":["import {type
|
|
1
|
+
{"version":3,"sources":["../../../../src/config/cli/types/cliConfig.ts"],"sourcesContent":["import {type PluginOptions as ReactCompilerConfig} from 'babel-plugin-react-compiler'\n\nimport {type UserViteConfig} from './userViteConfig'\n\nexport interface TypeGenConfig {\n formatGeneratedCode: boolean\n generates: string\n overloadClientMethods: boolean\n path: string | string[]\n schema: string\n}\n\n/**\n * @public\n */\nexport interface CliConfig {\n /** The project ID and dataset the Sanity CLI should use to run its commands */\n api?: {\n dataset?: string\n projectId?: string\n }\n\n /** Configuration for custom Sanity apps built with the App SDK */\n app?: {\n /** The entrypoint for your custom app. By default, `src/App.tsx` */\n entry?: string\n /**\n * Path to an icon file relative to project root.\n * The file must be an SVG.\n */\n icon?: string\n /** @deprecated Use deployment.appId */\n id?: string\n /** The ID for the Sanity organization that manages this application */\n organizationId?: string\n /** The title of the custom app, as it is seen in Dashboard UI */\n title?: string\n }\n\n /** @deprecated Use deployment.autoUpdates */\n autoUpdates?: boolean\n\n /** Options for custom app and Studio deployments */\n deployment?: {\n /**\n * The ID for your custom app or Studio. Generated when deploying your app or Studio for the first time.\n * Get your app ID by either:\n * 1. Checking the output of `sanity deploy`, or\n * 2. Checking your project’s Studio tab at https://sanity.io/manage\n *\n * @remarks This is required for all custom app deployments, and for Studios opting in to fine grained version control.\n * {@link https://www.sanity.io/docs/studio/latest-version-of-sanity#k0896ed4574b7}\n */\n appId?: string\n /**\n * Enable automatic updates for your Studio or custom app’s Sanity dependencies.\n * {@link https://www.sanity.io/docs/studio/latest-version-of-sanity}\n */\n autoUpdates?: boolean\n }\n\n /** Define the GraphQL APIs that the CLI can deploy and interact with */\n graphql?: Array<{\n filterSuffix?: string\n generation?: 'gen1' | 'gen2' | 'gen3'\n id?: string\n nonNullDocumentFields?: boolean\n playground?: boolean\n source?: string\n tag?: string\n workspace?: string\n }>\n\n /** Configuration for the Media Library */\n mediaLibrary?: {\n /** The path to the Media Library aspects directory. When using the CLI to manage aspects, this is the directory they will be read from and written to. */\n aspectsPath?: string\n }\n\n /** Contains the property `basePath` which lets you change the top-level slug for the Studio. You typically need to set this if you embed the Studio in another application where it is one of many routes. Defaults to an empty string. */\n project?: {\n basePath?: string\n }\n\n /** Configuration options for React Compiler */\n reactCompiler?: ReactCompilerConfig\n\n /** Wraps the Studio in \\<React.StrictMode\\> root to aid in flagging potential problems related to concurrent features (startTransition, useTransition, useDeferredValue, Suspense). Can also be enabled by setting SANITY_STUDIO_REACT_STRICT_MODE=\"true\"|\"false\". It only applies to sanity dev in development mode and is ignored in sanity build and in production. Defaults to false. */\n reactStrictMode?: boolean\n\n /**\n * Configuration for schema extraction (`sanity schema extract`)\n */\n schemaExtraction?: {\n /**\n * Enable schema extraction as part of sanity dev and sanity build\n */\n enabled?: boolean\n\n /**\n * When true, schema fields marked as required will be non-optional in the output.\n * Defaults to `false`\n */\n enforceRequiredFields?: boolean\n\n /**\n * Output path for the extracted schema file.\n * Defaults to `schema.json` in the working directory.\n */\n path?: string\n\n /**\n * Additional glob patterns to watch for schema changes in watch mode.\n * These extend the default patterns:\n * - `sanity.config.{js,jsx,ts,tsx,mjs}`\n * - `schema*\\/**\\/*.{js,jsx,ts,tsx,mjs}`\n */\n watchPatterns?: string[]\n\n /**\n * The name of the workspace to generate a schema for. Required if your Sanity project has more than one\n * workspace.\n */\n workspace?: string\n }\n\n /** Defines the hostname and port that the development server should run on. hostname defaults to localhost, and port to 3333. */\n server?: {\n hostname?: string\n port?: number\n }\n\n /** @deprecated Use deployment.appId */\n studioHost?: string\n\n /**\n * Configuration for Sanity typegen\n */\n typegen?: Partial<TypeGenConfig> & {\n /**\n * Enable typegen as part of sanity dev and sanity build.\n * When enabled, types are generated on startup and when files change.\n * Defaults to `false`\n */\n enabled?: boolean\n }\n\n /** Exposes the default Vite configuration for custom apps and the Studio so it can be changed and extended. */\n vite?: UserViteConfig\n}\n"],"names":[],"mappings":"AAYA;;CAEC,GACD,WAsIC"}
|