@sanity/cli 8.2.0 → 8.3.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/actions/debug/gatherDebugInfo.js +4 -2
- package/dist/actions/debug/gatherDebugInfo.js.map +1 -1
- package/dist/actions/debug/types.js.map +1 -1
- package/dist/actions/deploy/createUserApplication.js +6 -4
- package/dist/actions/deploy/createUserApplication.js.map +1 -1
- package/dist/commands/debug.js +4 -1
- package/dist/commands/debug.js.map +1 -1
- package/oclif.manifest.json +1 -1
- package/package.json +7 -9
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { access } from 'node:fs/promises';
|
|
2
2
|
import path from 'node:path';
|
|
3
|
-
import { getCliToken, getStudioConfig, getUserConfig, tryFindStudioConfigPath } from '@sanity/cli-core';
|
|
3
|
+
import { getCliToken, getCliTokenInfo, getStudioConfig, getUserConfig, tryFindStudioConfigPath } from '@sanity/cli-core';
|
|
4
4
|
import { getProjectById } from '../../services/projects.js';
|
|
5
5
|
import { getCliUser, getProjectUser } from '../../services/user.js';
|
|
6
6
|
import { getCliVersion } from '../../util/getCliVersion.js';
|
|
@@ -23,12 +23,14 @@ export async function gatherUserInfo(projectId) {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
export async function gatherAuthInfo(includeSecrets) {
|
|
26
|
-
const
|
|
26
|
+
const tokenInfo = await getCliTokenInfo();
|
|
27
|
+
const token = tokenInfo?.token;
|
|
27
28
|
const hasToken = Boolean(token);
|
|
28
29
|
const config = getUserConfig();
|
|
29
30
|
const authType = config.get('authType');
|
|
30
31
|
return {
|
|
31
32
|
authToken: token ? includeSecrets ? token : '<redacted>' : undefined,
|
|
33
|
+
authTokenSource: token ? tokenInfo.source : undefined,
|
|
32
34
|
hasToken,
|
|
33
35
|
userType: typeof authType === 'string' ? authType : 'normal'
|
|
34
36
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/debug/gatherDebugInfo.ts"],"sourcesContent":["import {access} from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {\n getCliToken,\n getStudioConfig,\n getUserConfig,\n tryFindStudioConfigPath,\n} from '@sanity/cli-core'\n\nimport {getProjectById} from '../../services/projects.js'\nimport {getCliUser, getProjectUser} from '../../services/user.js'\nimport {getCliVersion} from '../../util/getCliVersion.js'\nimport {detectCliInstallation} from '../../util/packageManager/installationInfo/index.js'\nimport {\n type AuthInfo,\n type CliInfo,\n type ProjectInfo,\n type ResolvedWorkspace,\n type StudioWorkspace,\n type UserInfo,\n} from './types.js'\n\nexport async function gatherUserInfo(projectId: string | undefined): Promise<Error | UserInfo> {\n const token = await getCliToken()\n if (!token) {\n return new Error('Not logged in')\n }\n\n try {\n const userInfo = projectId ? await getProjectUser(projectId) : await getCliUser()\n\n return {\n email: userInfo.email,\n id: userInfo.id,\n name: userInfo.name,\n provider: userInfo.provider,\n }\n } catch (error) {\n return error instanceof Error ? error : new Error('Failed to fetch user info')\n }\n}\n\nexport async function gatherAuthInfo(includeSecrets: boolean): Promise<AuthInfo> {\n const
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/debug/gatherDebugInfo.ts"],"sourcesContent":["import {access} from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {\n getCliToken,\n getCliTokenInfo,\n getStudioConfig,\n getUserConfig,\n tryFindStudioConfigPath,\n} from '@sanity/cli-core'\n\nimport {getProjectById} from '../../services/projects.js'\nimport {getCliUser, getProjectUser} from '../../services/user.js'\nimport {getCliVersion} from '../../util/getCliVersion.js'\nimport {detectCliInstallation} from '../../util/packageManager/installationInfo/index.js'\nimport {\n type AuthInfo,\n type CliInfo,\n type ProjectInfo,\n type ResolvedWorkspace,\n type StudioWorkspace,\n type UserInfo,\n} from './types.js'\n\nexport async function gatherUserInfo(projectId: string | undefined): Promise<Error | UserInfo> {\n const token = await getCliToken()\n if (!token) {\n return new Error('Not logged in')\n }\n\n try {\n const userInfo = projectId ? await getProjectUser(projectId) : await getCliUser()\n\n return {\n email: userInfo.email,\n id: userInfo.id,\n name: userInfo.name,\n provider: userInfo.provider,\n }\n } catch (error) {\n return error instanceof Error ? error : new Error('Failed to fetch user info')\n }\n}\n\nexport async function gatherAuthInfo(includeSecrets: boolean): Promise<AuthInfo> {\n const tokenInfo = await getCliTokenInfo()\n const token = tokenInfo?.token\n const hasToken = Boolean(token)\n const config = getUserConfig()\n const authType = config.get('authType')\n\n return {\n authToken: token ? (includeSecrets ? token : '<redacted>') : undefined,\n authTokenSource: token ? tokenInfo.source : undefined,\n hasToken,\n userType: typeof authType === 'string' ? authType : 'normal',\n }\n}\n\nexport async function gatherCliInfo(): Promise<CliInfo> {\n const [version, installation] = await Promise.all([getCliVersion(), detectCliInstallation()])\n\n const {packageManager, resolvedFrom} = installation.currentExecution\n\n let installContext: string\n switch (resolvedFrom) {\n case 'global': {\n installContext = packageManager ? `globally (${packageManager})` : 'globally'\n break\n }\n case 'local': {\n installContext = 'locally'\n break\n }\n case 'npx': {\n installContext = 'via npx'\n break\n }\n default: {\n installContext = 'unknown'\n }\n }\n\n return {installContext, version}\n}\n\nexport async function gatherProjectInfo(\n projectDirectory: string | undefined,\n): Promise<ProjectInfo | undefined> {\n if (!projectDirectory) {\n return undefined\n }\n\n const [cliConfigName, studioConfigFullPath] = await Promise.all([\n findCliConfigFile(projectDirectory),\n tryFindStudioConfigPath(projectDirectory),\n ])\n\n return {\n cliConfigPath: cliConfigName,\n rootPath: projectDirectory,\n studioConfigPath: studioConfigFullPath ? path.basename(studioConfigFullPath) : undefined,\n }\n}\n\nexport async function gatherStudioWorkspaces(projectDirectory: string): Promise<StudioWorkspace[]> {\n const rawConfig = await getStudioConfig(projectDirectory, {resolvePlugins: false})\n\n if (Array.isArray(rawConfig)) {\n return rawConfig.map((ws) => ({\n dataset: ws.dataset,\n name: ws.name,\n projectId: ws.projectId,\n }))\n }\n\n return [\n {\n dataset: rawConfig.dataset,\n name: rawConfig.name,\n projectId: rawConfig.projectId,\n },\n ]\n}\n\nexport async function gatherResolvedWorkspaces(\n projectDirectory: string,\n userId: string | undefined,\n): Promise<ResolvedWorkspace[]> {\n // resolvePlugins: true goes through getStudioWorkspaces() which calls resolveConfig()\n // from the sanity package. resolveConfig() always returns an array of workspaces,\n // so resolvedConfigSchema (z.array(...)) is guaranteed to match.\n const resolvedConfig = await getStudioConfig(projectDirectory, {resolvePlugins: true})\n\n const projectMap = await fetchRolesByProject(resolvedConfig, userId)\n\n return resolvedConfig.map((ws) => ({\n name: ws.name,\n roles: projectMap.get(ws.projectId) ?? [],\n title: ws.title,\n }))\n}\n\nasync function findCliConfigFile(directory: string): Promise<string | undefined> {\n for (const name of ['sanity.cli.ts', 'sanity.cli.js']) {\n try {\n await access(path.join(directory, name))\n return name\n } catch {\n // File doesn't exist, try next\n }\n }\n return undefined\n}\n\nasync function fetchRolesByProject(\n workspaces: {projectId: string}[],\n userId: string | undefined,\n): Promise<Map<string, string[]>> {\n const projectMap = new Map<string, string[]>()\n if (!userId) return projectMap\n\n const projectIds = [...new Set(workspaces.map((ws) => ws.projectId))]\n await Promise.all(\n projectIds.map(async (projectId) => {\n try {\n const project = await getProjectById(projectId)\n if (!project) return\n const member = (project.members || []).find((m) => m.id === userId)\n // @ts-expect-error - Incorrect type definition in @sanity/client\n const roles: string[] = member?.roles?.map((r) => r.name) ?? []\n projectMap.set(projectId, roles)\n } catch {\n // Project not accessible, skip roles\n }\n }),\n )\n return projectMap\n}\n"],"names":["access","path","getCliToken","getCliTokenInfo","getStudioConfig","getUserConfig","tryFindStudioConfigPath","getProjectById","getCliUser","getProjectUser","getCliVersion","detectCliInstallation","gatherUserInfo","projectId","token","Error","userInfo","email","id","name","provider","error","gatherAuthInfo","includeSecrets","tokenInfo","hasToken","Boolean","config","authType","get","authToken","undefined","authTokenSource","source","userType","gatherCliInfo","version","installation","Promise","all","packageManager","resolvedFrom","currentExecution","installContext","gatherProjectInfo","projectDirectory","cliConfigName","studioConfigFullPath","findCliConfigFile","cliConfigPath","rootPath","studioConfigPath","basename","gatherStudioWorkspaces","rawConfig","resolvePlugins","Array","isArray","map","ws","dataset","gatherResolvedWorkspaces","userId","resolvedConfig","projectMap","fetchRolesByProject","roles","title","directory","join","workspaces","Map","projectIds","Set","project","member","members","find","m","r","set"],"mappings":"AAAA,SAAQA,MAAM,QAAO,mBAAkB;AACvC,OAAOC,UAAU,YAAW;AAE5B,SACEC,WAAW,EACXC,eAAe,EACfC,eAAe,EACfC,aAAa,EACbC,uBAAuB,QAClB,mBAAkB;AAEzB,SAAQC,cAAc,QAAO,6BAA4B;AACzD,SAAQC,UAAU,EAAEC,cAAc,QAAO,yBAAwB;AACjE,SAAQC,aAAa,QAAO,8BAA6B;AACzD,SAAQC,qBAAqB,QAAO,sDAAqD;AAUzF,OAAO,eAAeC,eAAeC,SAA6B;IAChE,MAAMC,QAAQ,MAAMZ;IACpB,IAAI,CAACY,OAAO;QACV,OAAO,IAAIC,MAAM;IACnB;IAEA,IAAI;QACF,MAAMC,WAAWH,YAAY,MAAMJ,eAAeI,aAAa,MAAML;QAErE,OAAO;YACLS,OAAOD,SAASC,KAAK;YACrBC,IAAIF,SAASE,EAAE;YACfC,MAAMH,SAASG,IAAI;YACnBC,UAAUJ,SAASI,QAAQ;QAC7B;IACF,EAAE,OAAOC,OAAO;QACd,OAAOA,iBAAiBN,QAAQM,QAAQ,IAAIN,MAAM;IACpD;AACF;AAEA,OAAO,eAAeO,eAAeC,cAAuB;IAC1D,MAAMC,YAAY,MAAMrB;IACxB,MAAMW,QAAQU,WAAWV;IACzB,MAAMW,WAAWC,QAAQZ;IACzB,MAAMa,SAAStB;IACf,MAAMuB,WAAWD,OAAOE,GAAG,CAAC;IAE5B,OAAO;QACLC,WAAWhB,QAASS,iBAAiBT,QAAQ,eAAgBiB;QAC7DC,iBAAiBlB,QAAQU,UAAUS,MAAM,GAAGF;QAC5CN;QACAS,UAAU,OAAON,aAAa,WAAWA,WAAW;IACtD;AACF;AAEA,OAAO,eAAeO;IACp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 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/debug/types.ts"],"sourcesContent":["export interface UserInfo {\n /** Null when authenticating with an API token rather than a user account. */\n email: string | null\n id: string\n name: string\n provider: string\n}\n\nexport interface AuthInfo {\n authToken: string | undefined\n hasToken: boolean\n userType: string\n}\n\nexport interface CliInfo {\n installContext: string\n version: string\n}\n\nexport interface ProjectInfo {\n cliConfigPath: string | undefined\n rootPath: string\n studioConfigPath: string | undefined\n}\n\nexport interface StudioWorkspace {\n dataset: string\n name: string | undefined\n projectId: string\n}\n\nexport interface ResolvedWorkspace {\n name: string\n roles: string[]\n title: string\n}\n"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/debug/types.ts"],"sourcesContent":["export interface UserInfo {\n /** Null when authenticating with an API token rather than a user account. */\n email: string | null\n id: string\n name: string\n provider: string\n}\n\nexport interface AuthInfo {\n authToken: string | undefined\n authTokenSource: string | undefined\n hasToken: boolean\n userType: string\n}\n\nexport interface CliInfo {\n installContext: string\n version: string\n}\n\nexport interface ProjectInfo {\n cliConfigPath: string | undefined\n rootPath: string\n studioConfigPath: string | undefined\n}\n\nexport interface StudioWorkspace {\n dataset: string\n name: string | undefined\n projectId: string\n}\n\nexport interface ResolvedWorkspace {\n name: string\n roles: string[]\n title: string\n}\n"],"names":[],"mappings":"AAgCA,WAIC"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
+
import { randomInt } from 'node:crypto';
|
|
1
2
|
import { CLIError } from '@oclif/core/errors';
|
|
2
3
|
import { exitCodes } from '@sanity/cli-core';
|
|
3
4
|
import { input, spinner } from '@sanity/cli-core/ux';
|
|
4
|
-
import { customAlphabet } from 'nanoid';
|
|
5
5
|
import { createUserApplication as createUserApplicationRequest } from '../../services/userApplications.js';
|
|
6
6
|
import { NO_ORGANIZATION_ID } from '../../util/errorMessages.js';
|
|
7
7
|
import { deployDebug } from './deployDebug.js';
|
|
8
8
|
import { normalizeUrl, validateUrl } from './urlUtils.js';
|
|
9
9
|
const LETTERS = 'abcdefghijklmnopqrstuvwxyz';
|
|
10
|
+
const ALPHANUMERIC = `${LETTERS}0123456789`;
|
|
11
|
+
const randomString = (alphabet, length)=>Array.from({
|
|
12
|
+
length
|
|
13
|
+
}, ()=>alphabet[randomInt(alphabet.length)]).join('');
|
|
10
14
|
// appHosts have some restrictions (no uppercase, must start with a letter)
|
|
11
15
|
export function generateAppSlug() {
|
|
12
|
-
|
|
13
|
-
const rest = customAlphabet(`${LETTERS}0123456789`, 11)();
|
|
14
|
-
return `${firstChar}${rest}`;
|
|
16
|
+
return randomString(LETTERS, 1) + randomString(ALPHANUMERIC, 11);
|
|
15
17
|
}
|
|
16
18
|
// TODO: replace with `Promise.withResolvers()` once it lands in node 22
|
|
17
19
|
function promiseWithResolvers() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/actions/deploy/createUserApplication.ts"],"sourcesContent":["import {CLIError} from '@oclif/core/errors'\nimport {type AppVisibility, exitCodes} from '@sanity/cli-core'\nimport {input, spinner} from '@sanity/cli-core/ux'\
|
|
1
|
+
{"version":3,"sources":["../../../src/actions/deploy/createUserApplication.ts"],"sourcesContent":["import {randomInt} from 'node:crypto'\n\nimport {CLIError} from '@oclif/core/errors'\nimport {type AppVisibility, exitCodes} from '@sanity/cli-core'\nimport {input, spinner} from '@sanity/cli-core/ux'\n\nimport {\n createUserApplication as createUserApplicationRequest,\n type UserApplication,\n type UserApplicationResolved,\n} from '../../services/userApplications.js'\nimport {NO_ORGANIZATION_ID} from '../../util/errorMessages.js'\nimport {deployDebug} from './deployDebug.js'\nimport {normalizeUrl, validateUrl} from './urlUtils.js'\n\nconst LETTERS = 'abcdefghijklmnopqrstuvwxyz'\nconst ALPHANUMERIC = `${LETTERS}0123456789`\n\nconst randomString = (alphabet: string, length: number) =>\n Array.from({length}, () => alphabet[randomInt(alphabet.length)]).join('')\n\n// appHosts have some restrictions (no uppercase, must start with a letter)\nexport function generateAppSlug() {\n return randomString(LETTERS, 1) + randomString(ALPHANUMERIC, 11)\n}\n\n// TODO: replace with `Promise.withResolvers()` once it lands in node 22\nfunction promiseWithResolvers<T>() {\n let resolve!: (t: T) => void\n let reject!: (err: unknown) => void\n const promise = new Promise<T>((res, rej) => {\n resolve = res\n reject = rej\n })\n return {promise, reject, resolve}\n}\n\ninterface CreateStudioUserApplicationOptions {\n projectId: string\n\n title?: string\n urlType?: 'external' | 'internal'\n}\n\nexport async function createStudioUserApplication(options: CreateStudioUserApplicationOptions) {\n const {projectId, title, urlType = 'internal'} = options\n const {promise, resolve} = promiseWithResolvers<UserApplication>()\n\n const isExternal = urlType === 'external'\n\n await input({\n message: isExternal ? 'Studio URL (https://...):' : 'Studio hostname (<value>.sanity.studio):',\n // if a string is returned here, it is relayed to the user and prompt allows\n // the user to try again until this function returns true\n validate: async (inp: string) => {\n let appHost: string\n\n if (isExternal) {\n const normalized = normalizeUrl(inp)\n const validation = validateUrl(normalized)\n if (validation !== true) {\n return validation\n }\n appHost = normalized\n } else {\n appHost = inp.replace(/\\.sanity\\.studio$/i, '')\n }\n\n try {\n const response = await createUserApplicationRequest({\n appType: 'studio',\n body: {appHost, title, type: 'studio', urlType},\n projectId,\n })\n resolve(response)\n return true\n } catch (e) {\n // if the name is taken, it should return a 409 so we relay to the user\n if ([402, 409].includes(e?.statusCode)) {\n return e?.response?.body?.message || 'Bad request' // just in case\n }\n\n deployDebug('Error creating user application', e)\n // otherwise, it's a fatal error\n throw new CLIError('Error creating user application', {exit: exitCodes.RUNTIME_ERROR})\n }\n },\n })\n\n return await promise\n}\n\nexport async function createUserApplication(\n organizationId?: string,\n title?: string,\n visibility?: AppVisibility,\n): Promise<UserApplicationResolved> {\n if (!organizationId) {\n throw new Error(NO_ORGANIZATION_ID)\n }\n\n const resolvedTitle =\n title ??\n (await input({\n message: 'Enter a title for your application:',\n validate: (value: string) => value.length > 0 || 'Title is required',\n }))\n\n return tryCreateApp(resolvedTitle, organizationId, visibility)\n}\n\nconst tryCreateApp = async (title: string, organizationId: string, visibility?: AppVisibility) => {\n // we will likely prepend this with an org ID or other parameter in the future\n const appHost = generateAppSlug()\n\n const spin = spinner('Creating application').start()\n\n try {\n const response = await createUserApplicationRequest({\n appType: 'coreApp',\n body: {\n appHost,\n title,\n type: 'coreApp',\n urlType: 'internal',\n ...(visibility ? {dashboardStatus: visibility} : {}),\n },\n organizationId,\n })\n\n spin.succeed()\n return response\n } catch (e) {\n // if the name is taken, generate a new one and try again\n if ([402, 409].includes(e?.statusCode)) {\n deployDebug('App host taken, retrying with new host')\n return tryCreateApp(title, organizationId, visibility)\n }\n\n spin.fail()\n\n deployDebug('Error creating core application', e)\n throw e\n }\n}\n"],"names":["randomInt","CLIError","exitCodes","input","spinner","createUserApplication","createUserApplicationRequest","NO_ORGANIZATION_ID","deployDebug","normalizeUrl","validateUrl","LETTERS","ALPHANUMERIC","randomString","alphabet","length","Array","from","join","generateAppSlug","promiseWithResolvers","resolve","reject","promise","Promise","res","rej","createStudioUserApplication","options","projectId","title","urlType","isExternal","message","validate","inp","appHost","normalized","validation","replace","response","appType","body","type","e","includes","statusCode","exit","RUNTIME_ERROR","organizationId","visibility","Error","resolvedTitle","value","tryCreateApp","spin","start","dashboardStatus","succeed","fail"],"mappings":"AAAA,SAAQA,SAAS,QAAO,cAAa;AAErC,SAAQC,QAAQ,QAAO,qBAAoB;AAC3C,SAA4BC,SAAS,QAAO,mBAAkB;AAC9D,SAAQC,KAAK,EAAEC,OAAO,QAAO,sBAAqB;AAElD,SACEC,yBAAyBC,4BAA4B,QAGhD,qCAAoC;AAC3C,SAAQC,kBAAkB,QAAO,8BAA6B;AAC9D,SAAQC,WAAW,QAAO,mBAAkB;AAC5C,SAAQC,YAAY,EAAEC,WAAW,QAAO,gBAAe;AAEvD,MAAMC,UAAU;AAChB,MAAMC,eAAe,GAAGD,QAAQ,UAAU,CAAC;AAE3C,MAAME,eAAe,CAACC,UAAkBC,SACtCC,MAAMC,IAAI,CAAC;QAACF;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I3C,SAAS,mCAAmC;oBAAC8C,MAAM7C,UAAU8C,aAAa;gBAAA;YACtF;QACF;IACF;IAEA,OAAO,MAAMzB;AACf;AAEA,OAAO,eAAelB,sBACpB4C,cAAuB,EACvBnB,KAAc,EACdoB,UAA0B;IAE1B,IAAI,CAACD,gBAAgB;QACnB,MAAM,IAAIE,MAAM5C;IAClB;IAEA,MAAM6C,gBACJtB,SACC,MAAM3B,MAAM;QACX8B,SAAS;QACTC,UAAU,CAACmB,QAAkBA,MAAMtC,MAAM,GAAG,KAAK;IACnD;IAEF,OAAOuC,aAAaF,eAAeH,gBAAgBC;AACrD;AAEA,MAAMI,eAAe,OAAOxB,OAAemB,gBAAwBC;IACjE,8EAA8E;IAC9E,MAAMd,UAAUjB;IAEhB,MAAMoC,OAAOnD,QAAQ,wBAAwBoD,KAAK;IAElD,IAAI;QACF,MAAMhB,WAAW,MAAMlC,6BAA6B;YAClDmC,SAAS;YACTC,MAAM;gBACJN;gBACAN;gBACAa,MAAM;gBACNZ,SAAS;gBACT,GAAImB,aAAa;oBAACO,iBAAiBP;gBAAU,IAAI,CAAC,CAAC;YACrD;YACAD;QACF;QAEAM,KAAKG,OAAO;QACZ,OAAOlB;IACT,EAAE,OAAOI,GAAG;QACV,yDAAyD;QACzD,IAAI;YAAC;YAAK;SAAI,CAACC,QAAQ,CAACD,GAAGE,aAAa;YACtCtC,YAAY;YACZ,OAAO8C,aAAaxB,OAAOmB,gBAAgBC;QAC7C;QAEAK,KAAKI,IAAI;QAETnD,YAAY,mCAAmCoC;QAC/C,MAAMA;IACR;AACF"}
|
package/dist/commands/debug.js
CHANGED
|
@@ -75,11 +75,14 @@ export class Debug extends SanityCommand {
|
|
|
75
75
|
const auth = await gatherAuthInfo(includeSecrets);
|
|
76
76
|
if (!auth.hasToken) return;
|
|
77
77
|
this.log(sectionHeader('Authentication'));
|
|
78
|
-
const padTo =
|
|
78
|
+
const padTo = 12 // "Token source" is the longest key
|
|
79
79
|
;
|
|
80
80
|
this.log(formatKeyValue('Auth token', auth.authToken, {
|
|
81
81
|
padTo
|
|
82
82
|
}));
|
|
83
|
+
this.log(formatKeyValue('Token source', auth.authTokenSource, {
|
|
84
|
+
padTo
|
|
85
|
+
}));
|
|
83
86
|
this.log(formatKeyValue('User type', auth.userType, {
|
|
84
87
|
padTo
|
|
85
88
|
}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/commands/debug.ts"],"sourcesContent":["import {styleText} from 'node:util'\n\nimport {Flags} from '@oclif/core'\nimport {ProjectRootNotFoundError, SanityCommand} from '@sanity/cli-core'\n\nimport {\n gatherAuthInfo,\n gatherCliInfo,\n gatherProjectInfo,\n gatherResolvedWorkspaces,\n gatherStudioWorkspaces,\n gatherUserInfo,\n} from '../actions/debug/gatherDebugInfo.js'\nimport {formatKeyValue, sectionHeader} from '../actions/debug/output.js'\nimport {type StudioWorkspace, type UserInfo} from '../actions/debug/types.js'\n\ntype ConfigLoadResult<T> = {error: Error; value?: never} | {error?: never; value: T}\n\nexport class Debug extends SanityCommand<typeof Debug> {\n static override description = 'Print diagnostic info for troubleshooting'\n\n static override examples = [\n '<%= config.bin %> <%= command.id %>',\n '<%= config.bin %> <%= command.id %> --secrets',\n ]\n\n static override flags = {\n secrets: Flags.boolean({\n default: false,\n description: 'Include API keys in output',\n }),\n verbose: Flags.boolean({\n default: false,\n description: 'Show full error details including stack traces',\n }),\n }\n\n public async run(): Promise<void> {\n const {flags} = this\n\n let projectDirectory: string | undefined\n try {\n const projectRoot = await this.getProjectRoot()\n projectDirectory = projectRoot.directory\n } catch (err) {\n if (!(err instanceof ProjectRootNotFoundError)) throw err\n }\n\n // Try loading CLI config, capturing errors\n let cliConfigLoad: ConfigLoadResult<Awaited<ReturnType<typeof this.getCliConfig>>> | undefined\n if (projectDirectory) {\n try {\n cliConfigLoad = {value: await this.getCliConfig()}\n } catch (err) {\n cliConfigLoad = {error: err instanceof Error ? err : new Error(String(err))}\n }\n }\n\n const projectId = cliConfigLoad?.value?.api?.projectId\n\n // Gather project info once, shared between Project and Studio sections\n const project = projectDirectory ? await gatherProjectInfo(projectDirectory) : undefined\n\n // Pre-load studio workspaces so we know if the config is valid\n let studioLoad: ConfigLoadResult<StudioWorkspace[]> | undefined\n if (project?.studioConfigPath && projectDirectory) {\n try {\n studioLoad = {value: await gatherStudioWorkspaces(projectDirectory)}\n } catch (err) {\n studioLoad = {error: err instanceof Error ? err : new Error(String(err))}\n }\n }\n\n // Section 1: User\n const user = await this.printUserSection(projectId)\n const userId = user instanceof Error ? undefined : user.id\n\n // Section 2: Authentication (only when logged in)\n await this.printAuthSection(flags.secrets)\n\n // Section 3: CLI\n await this.printCliSection()\n\n // Section 4: Project\n this.printProjectSection(project, cliConfigLoad, studioLoad)\n\n // Section 5: Studio (when studio config file exists)\n if (projectDirectory && project?.studioConfigPath && studioLoad) {\n await this.printStudioSection(projectDirectory, studioLoad, flags.verbose, projectId, userId)\n }\n }\n\n private async printAuthSection(includeSecrets: boolean): Promise<void> {\n const auth = await gatherAuthInfo(includeSecrets)\n if (!auth.hasToken) return\n\n this.log(sectionHeader('Authentication'))\n const padTo = 10 // \"Auth token\" is the longest key\n this.log(formatKeyValue('Auth token', auth.authToken, {padTo}))\n this.log(formatKeyValue('User type', auth.userType, {padTo}))\n\n if (!includeSecrets) {\n this.log(' (run with --secrets to reveal token)')\n }\n this.log('')\n }\n\n private async printCliSection(): Promise<void> {\n this.log(sectionHeader('CLI'))\n\n try {\n const cliInfo = await gatherCliInfo()\n const padTo = 9 // \"Installed\" is the longest key\n this.log(formatKeyValue('Version', cliInfo.version, {padTo}))\n this.log(formatKeyValue('Installed', cliInfo.installContext, {padTo}))\n } catch {\n this.log(` ${styleText('red', 'Unable to determine CLI version')}`)\n }\n this.log('')\n }\n\n private printConfigStatus(\n label: string,\n fileName: string | undefined,\n loadResult: ConfigLoadResult<unknown> | undefined,\n padTo: number,\n ): void {\n if (!fileName) {\n this.log(formatKeyValue(label, `${styleText('red', '\\u274C')} not found`, {padTo}))\n return\n }\n\n if (loadResult?.error) {\n this.log(\n formatKeyValue(\n label,\n `${styleText('yellow', '\\u26A0\\uFE0F')} ${styleText('yellow', fileName)} (has errors)`,\n {padTo},\n ),\n )\n } else {\n this.log(\n formatKeyValue(label, `${styleText('green', '\\u2705')} ${styleText('yellow', fileName)}`, {\n padTo,\n }),\n )\n }\n }\n\n private printProjectSection(\n project: Awaited<ReturnType<typeof gatherProjectInfo>>,\n cliConfigLoad: ConfigLoadResult<unknown> | undefined,\n studioLoad: ConfigLoadResult<unknown> | undefined,\n ): void {\n this.log(sectionHeader('Project'))\n\n if (!project) {\n this.log(' No project found\\n')\n return\n }\n\n const padTo = 14\n this.log(formatKeyValue('Root path', project.rootPath, {padTo}))\n this.printConfigStatus('CLI config', project.cliConfigPath, cliConfigLoad, padTo)\n this.printConfigStatus('Studio config', project.studioConfigPath, studioLoad, padTo)\n this.log('')\n }\n\n private async printStudioSection(\n projectDirectory: string,\n studioLoad: ConfigLoadResult<StudioWorkspace[]>,\n verbose: boolean,\n projectId: string | undefined,\n userId: string | undefined,\n ): Promise<void> {\n this.log(sectionHeader('Studio'))\n\n if (studioLoad.error) {\n this.log(` ${styleText('red', 'Failed to load studio configuration:')}`)\n if (verbose) {\n this.log(` ${studioLoad.error.stack ?? studioLoad.error.message}\\n`)\n } else {\n this.log(` ${truncate(studioLoad.error.message)}\\n`)\n }\n return\n }\n\n this.log(' Workspaces:')\n for (const ws of studioLoad.value) {\n const label = ws.name ?? 'default'\n this.log(` ${label}`)\n this.log(formatKeyValue('Project ID', ws.projectId, {indent: 6, padTo: 10}))\n this.log(formatKeyValue('Dataset', ws.dataset, {indent: 6, padTo: 10}))\n }\n\n // Full resolution: try to resolve plugins and get roles\n try {\n const resolved = await gatherResolvedWorkspaces(projectDirectory, userId)\n\n this.log('')\n this.log(' Resolved configuration:')\n for (const ws of resolved) {\n this.log(` ${ws.name} (${ws.title})`)\n if (ws.roles.length > 0) {\n this.log(formatKeyValue('Roles', ws.roles, {indent: 6, padTo: 5}))\n }\n }\n } catch (err) {\n this.log('')\n if (verbose && err instanceof Error && err.stack) {\n this.log(` ${styleText('dim', 'Unable to resolve full studio configuration:')}`)\n this.log(` ${styleText('dim', err.stack)}`)\n } else {\n const reason = truncate(err instanceof Error ? err.message : String(err))\n this.log(\n ` ${styleText('dim', `(unable to resolve full studio configuration: ${reason})`)}`,\n )\n }\n }\n this.log('')\n }\n\n private async printUserSection(projectId: string | undefined): Promise<Error | UserInfo> {\n this.log(`\\n${sectionHeader('User')}`)\n\n const user = await gatherUserInfo(projectId)\n if (user instanceof Error) {\n this.log(` ${user.message}\\n`)\n return user\n }\n\n const padTo = 8 // \"Provider\" is the longest key\n this.log(formatKeyValue('Name', user.name, {padTo}))\n this.log(formatKeyValue('Email', user.email ?? '(none)', {padTo}))\n this.log(formatKeyValue('ID', user.id, {padTo}))\n this.log(formatKeyValue('Provider', user.provider, {padTo}))\n this.log('')\n return user\n }\n}\n\nconst MAX_ERROR_LENGTH = 200\n\nfunction truncate(str: string): string {\n const collapsed = str.replaceAll(/\\s*\\n\\s*/g, ' ').trim()\n if (collapsed.length <= MAX_ERROR_LENGTH) return collapsed\n return `${collapsed.slice(0, MAX_ERROR_LENGTH)}...`\n}\n"],"names":["styleText","Flags","ProjectRootNotFoundError","SanityCommand","gatherAuthInfo","gatherCliInfo","gatherProjectInfo","gatherResolvedWorkspaces","gatherStudioWorkspaces","gatherUserInfo","formatKeyValue","sectionHeader","Debug","description","examples","flags","secrets","boolean","default","verbose","run","projectDirectory","projectRoot","getProjectRoot","directory","err","cliConfigLoad","value","getCliConfig","error","Error","String","projectId","api","project","undefined","studioLoad","studioConfigPath","user","printUserSection","userId","id","printAuthSection","printCliSection","printProjectSection","printStudioSection","includeSecrets","auth","hasToken","log","padTo","authToken","userType","cliInfo","version","installContext","printConfigStatus","label","fileName","loadResult","rootPath","cliConfigPath","stack","message","truncate","ws","name","indent","dataset","resolved","title","roles","length","reason","email","provider","MAX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,eAAe,YAAY4B,KAAKqC,QAAQ,EAAE;YAACzB;QAAK;QACzD,IAAI,CAACD,GAAG,CAAC;QACT,OAAOX;IACT;AACF;AAEA,MAAMsC,mBAAmB;AAEzB,SAASZ,SAASa,GAAW;IAC3B,MAAMC,YAAYD,IAAIE,UAAU,CAAC,aAAa,KAAKC,IAAI;IACvD,IAAIF,UAAUN,MAAM,IAAII,kBAAkB,OAAOE;IACjD,OAAO,GAAGA,UAAUG,KAAK,CAAC,GAAGL,kBAAkB,GAAG,CAAC;AACrD"}
|
|
1
|
+
{"version":3,"sources":["../../src/commands/debug.ts"],"sourcesContent":["import {styleText} from 'node:util'\n\nimport {Flags} from '@oclif/core'\nimport {ProjectRootNotFoundError, SanityCommand} from '@sanity/cli-core'\n\nimport {\n gatherAuthInfo,\n gatherCliInfo,\n gatherProjectInfo,\n gatherResolvedWorkspaces,\n gatherStudioWorkspaces,\n gatherUserInfo,\n} from '../actions/debug/gatherDebugInfo.js'\nimport {formatKeyValue, sectionHeader} from '../actions/debug/output.js'\nimport {type StudioWorkspace, type UserInfo} from '../actions/debug/types.js'\n\ntype ConfigLoadResult<T> = {error: Error; value?: never} | {error?: never; value: T}\n\nexport class Debug extends SanityCommand<typeof Debug> {\n static override description = 'Print diagnostic info for troubleshooting'\n\n static override examples = [\n '<%= config.bin %> <%= command.id %>',\n '<%= config.bin %> <%= command.id %> --secrets',\n ]\n\n static override flags = {\n secrets: Flags.boolean({\n default: false,\n description: 'Include API keys in output',\n }),\n verbose: Flags.boolean({\n default: false,\n description: 'Show full error details including stack traces',\n }),\n }\n\n public async run(): Promise<void> {\n const {flags} = this\n\n let projectDirectory: string | undefined\n try {\n const projectRoot = await this.getProjectRoot()\n projectDirectory = projectRoot.directory\n } catch (err) {\n if (!(err instanceof ProjectRootNotFoundError)) throw err\n }\n\n // Try loading CLI config, capturing errors\n let cliConfigLoad: ConfigLoadResult<Awaited<ReturnType<typeof this.getCliConfig>>> | undefined\n if (projectDirectory) {\n try {\n cliConfigLoad = {value: await this.getCliConfig()}\n } catch (err) {\n cliConfigLoad = {error: err instanceof Error ? err : new Error(String(err))}\n }\n }\n\n const projectId = cliConfigLoad?.value?.api?.projectId\n\n // Gather project info once, shared between Project and Studio sections\n const project = projectDirectory ? await gatherProjectInfo(projectDirectory) : undefined\n\n // Pre-load studio workspaces so we know if the config is valid\n let studioLoad: ConfigLoadResult<StudioWorkspace[]> | undefined\n if (project?.studioConfigPath && projectDirectory) {\n try {\n studioLoad = {value: await gatherStudioWorkspaces(projectDirectory)}\n } catch (err) {\n studioLoad = {error: err instanceof Error ? err : new Error(String(err))}\n }\n }\n\n // Section 1: User\n const user = await this.printUserSection(projectId)\n const userId = user instanceof Error ? undefined : user.id\n\n // Section 2: Authentication (only when logged in)\n await this.printAuthSection(flags.secrets)\n\n // Section 3: CLI\n await this.printCliSection()\n\n // Section 4: Project\n this.printProjectSection(project, cliConfigLoad, studioLoad)\n\n // Section 5: Studio (when studio config file exists)\n if (projectDirectory && project?.studioConfigPath && studioLoad) {\n await this.printStudioSection(projectDirectory, studioLoad, flags.verbose, projectId, userId)\n }\n }\n\n private async printAuthSection(includeSecrets: boolean): Promise<void> {\n const auth = await gatherAuthInfo(includeSecrets)\n if (!auth.hasToken) return\n\n this.log(sectionHeader('Authentication'))\n const padTo = 12 // \"Token source\" is the longest key\n this.log(formatKeyValue('Auth token', auth.authToken, {padTo}))\n this.log(formatKeyValue('Token source', auth.authTokenSource, {padTo}))\n this.log(formatKeyValue('User type', auth.userType, {padTo}))\n\n if (!includeSecrets) {\n this.log(' (run with --secrets to reveal token)')\n }\n this.log('')\n }\n\n private async printCliSection(): Promise<void> {\n this.log(sectionHeader('CLI'))\n\n try {\n const cliInfo = await gatherCliInfo()\n const padTo = 9 // \"Installed\" is the longest key\n this.log(formatKeyValue('Version', cliInfo.version, {padTo}))\n this.log(formatKeyValue('Installed', cliInfo.installContext, {padTo}))\n } catch {\n this.log(` ${styleText('red', 'Unable to determine CLI version')}`)\n }\n this.log('')\n }\n\n private printConfigStatus(\n label: string,\n fileName: string | undefined,\n loadResult: ConfigLoadResult<unknown> | undefined,\n padTo: number,\n ): void {\n if (!fileName) {\n this.log(formatKeyValue(label, `${styleText('red', '\\u274C')} not found`, {padTo}))\n return\n }\n\n if (loadResult?.error) {\n this.log(\n formatKeyValue(\n label,\n `${styleText('yellow', '\\u26A0\\uFE0F')} ${styleText('yellow', fileName)} (has errors)`,\n {padTo},\n ),\n )\n } else {\n this.log(\n formatKeyValue(label, `${styleText('green', '\\u2705')} ${styleText('yellow', fileName)}`, {\n padTo,\n }),\n )\n }\n }\n\n private printProjectSection(\n project: Awaited<ReturnType<typeof gatherProjectInfo>>,\n cliConfigLoad: ConfigLoadResult<unknown> | undefined,\n studioLoad: ConfigLoadResult<unknown> | undefined,\n ): void {\n this.log(sectionHeader('Project'))\n\n if (!project) {\n this.log(' No project found\\n')\n return\n }\n\n const padTo = 14\n this.log(formatKeyValue('Root path', project.rootPath, {padTo}))\n this.printConfigStatus('CLI config', project.cliConfigPath, cliConfigLoad, padTo)\n this.printConfigStatus('Studio config', project.studioConfigPath, studioLoad, padTo)\n this.log('')\n }\n\n private async printStudioSection(\n projectDirectory: string,\n studioLoad: ConfigLoadResult<StudioWorkspace[]>,\n verbose: boolean,\n projectId: string | undefined,\n userId: string | undefined,\n ): Promise<void> {\n this.log(sectionHeader('Studio'))\n\n if (studioLoad.error) {\n this.log(` ${styleText('red', 'Failed to load studio configuration:')}`)\n if (verbose) {\n this.log(` ${studioLoad.error.stack ?? studioLoad.error.message}\\n`)\n } else {\n this.log(` ${truncate(studioLoad.error.message)}\\n`)\n }\n return\n }\n\n this.log(' Workspaces:')\n for (const ws of studioLoad.value) {\n const label = ws.name ?? 'default'\n this.log(` ${label}`)\n this.log(formatKeyValue('Project ID', ws.projectId, {indent: 6, padTo: 10}))\n this.log(formatKeyValue('Dataset', ws.dataset, {indent: 6, padTo: 10}))\n }\n\n // Full resolution: try to resolve plugins and get roles\n try {\n const resolved = await gatherResolvedWorkspaces(projectDirectory, userId)\n\n this.log('')\n this.log(' Resolved configuration:')\n for (const ws of resolved) {\n this.log(` ${ws.name} (${ws.title})`)\n if (ws.roles.length > 0) {\n this.log(formatKeyValue('Roles', ws.roles, {indent: 6, padTo: 5}))\n }\n }\n } catch (err) {\n this.log('')\n if (verbose && err instanceof Error && err.stack) {\n this.log(` ${styleText('dim', 'Unable to resolve full studio configuration:')}`)\n this.log(` ${styleText('dim', err.stack)}`)\n } else {\n const reason = truncate(err instanceof Error ? err.message : String(err))\n this.log(\n ` ${styleText('dim', `(unable to resolve full studio configuration: ${reason})`)}`,\n )\n }\n }\n this.log('')\n }\n\n private async printUserSection(projectId: string | undefined): Promise<Error | UserInfo> {\n this.log(`\\n${sectionHeader('User')}`)\n\n const user = await gatherUserInfo(projectId)\n if (user instanceof Error) {\n this.log(` ${user.message}\\n`)\n return user\n }\n\n const padTo = 8 // \"Provider\" is the longest key\n this.log(formatKeyValue('Name', user.name, {padTo}))\n this.log(formatKeyValue('Email', user.email ?? '(none)', {padTo}))\n this.log(formatKeyValue('ID', user.id, {padTo}))\n this.log(formatKeyValue('Provider', user.provider, {padTo}))\n this.log('')\n return user\n }\n}\n\nconst MAX_ERROR_LENGTH = 200\n\nfunction truncate(str: string): string {\n const collapsed = str.replaceAll(/\\s*\\n\\s*/g, ' ').trim()\n if (collapsed.length <= MAX_ERROR_LENGTH) return collapsed\n return `${collapsed.slice(0, MAX_ERROR_LENGTH)}...`\n}\n"],"names":["styleText","Flags","ProjectRootNotFoundError","SanityCommand","gatherAuthInfo","gatherCliInfo","gatherProjectInfo","gatherResolvedWorkspaces","gatherStudioWorkspaces","gatherUserInfo","formatKeyValue","sectionHeader","Debug","description","examples","flags","secrets","boolean","default","verbose","run","projectDirectory","projectRoot","getProjectRoot","directory","err","cliConfigLoad","value","getCliConfig","error","Error","String","projectId","api","project","undefined","studioLoad","studioConfigPath","user","printUserSection","userId","id","printAuthSection","printCliSection","printProjectSection","printStudioSection","includeSecrets","auth","hasToken","log","padTo","authToken","authTokenSource","userType","cliInfo","version","installContext","printConfigStatus","label","fileName","loadResult","rootPath","cliConfigPath","stack","message","truncate","ws","name","indent","dataset","resolved","title","roles","length","reason","email","provider","MAX_ERROR_LENGTH","str","collapsed","replaceAll","trim","slice"],"mappings":"AAAA,SAAQA,SAAS,QAAO,YAAW;AAEnC,SAAQC,KAAK,QAAO,cAAa;AACjC,SAAQC,wBAAwB,EAAEC,aAAa,QAAO,mBAAkB;AAExE,SACEC,cAAc,EACdC,aAAa,EACbC,iBAAiB,EACjBC,wBAAwB,EACxBC,sBAAsB,EACtBC,cAAc,QACT,sCAAqC;AAC5C,SAAQC,cAAc,EAAEC,aAAa,QAAO,6BAA4B;AAKxE,OAAO,MAAMC,cAAcT;IACzB,OAAgBU,cAAc,4CAA2C;IAEzE,OAAgBC,WAAW;QACzB;QACA;KACD,CAAA;IAED,OAAgBC,QAAQ;QACtBC,SAASf,MAAMgB,OAAO,CAAC;YACrBC,SAAS;YACTL,aAAa;QACf;QACAM,SAASlB,MAAMgB,OAAO,CAAC;YACrBC,SAAS;YACTL,aAAa;QACf;IACF,EAAC;IAED,MAAaO,MAAqB;QAChC,MAAM,EAACL,KAAK,EAAC,GAAG,IAAI;QAEpB,IAAIM;QACJ,IAAI;YACF,MAAMC,cAAc,MAAM,IAAI,CAACC,cAAc;YAC7CF,mBAAmBC,YAAYE,SAAS;QAC1C,EAAE,OAAOC,KAAK;YACZ,IAAI,CAAEA,CAAAA,eAAevB,wBAAuB,GAAI,MAAMuB;QACxD;QAEA,2CAA2C;QAC3C,IAAIC;QACJ,IAAIL,kBAAkB;YACpB,IAAI;gBACFK,gBAAgB;oBAACC,OAAO,MAAM,IAAI,CAACC,YAAY;gBAAE;YACnD,EAAE,OAAOH,KAAK;gBACZC,gBAAgB;oBAACG,OAAOJ,eAAeK,QAAQL,MAAM,IAAIK,MAAMC,OAAON;gBAAK;YAC7E;QACF;QAEA,MAAMO,YAAYN,eAAeC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K6B,IAAI,EAAE;YAACjB;QAAK;QACjD,IAAI,CAACD,GAAG,CAACvC,eAAe,SAAS4B,KAAKqC,KAAK,IAAI,UAAU;YAACzB;QAAK;QAC/D,IAAI,CAACD,GAAG,CAACvC,eAAe,MAAM4B,KAAKG,EAAE,EAAE;YAACS;QAAK;QAC7C,IAAI,CAACD,GAAG,CAACvC,eAAe,YAAY4B,KAAKsC,QAAQ,EAAE;YAAC1B;QAAK;QACzD,IAAI,CAACD,GAAG,CAAC;QACT,OAAOX;IACT;AACF;AAEA,MAAMuC,mBAAmB;AAEzB,SAASZ,SAASa,GAAW;IAC3B,MAAMC,YAAYD,IAAIE,UAAU,CAAC,aAAa,KAAKC,IAAI;IACvD,IAAIF,UAAUN,MAAM,IAAII,kBAAkB,OAAOE;IACjD,OAAO,GAAGA,UAAUG,KAAK,CAAC,GAAGL,kBAAkB,GAAG,CAAC;AACrD"}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sanity/cli",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.3.0",
|
|
4
4
|
"description": "Sanity CLI tool for managing Sanity projects and organizations",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@sanity/export": "^6.2.0",
|
|
69
69
|
"@sanity/generate-help-url": "^4.0.0",
|
|
70
70
|
"@sanity/id-utils": "^1.0.0",
|
|
71
|
-
"@sanity/import": "^6.0.
|
|
71
|
+
"@sanity/import": "^6.0.4",
|
|
72
72
|
"@sanity/migrate": "^8.0.2",
|
|
73
73
|
"@sanity/runtime-cli": "^17.4.0",
|
|
74
74
|
"@sanity/schema": "^6.7.0",
|
|
@@ -92,7 +92,6 @@
|
|
|
92
92
|
"jsonc-parser": "^3.3.1",
|
|
93
93
|
"lodash-es": "^4.18.1",
|
|
94
94
|
"minimist": "^1.2.8",
|
|
95
|
-
"nanoid": "^5.1.11",
|
|
96
95
|
"obug": "^2.1.4",
|
|
97
96
|
"oneline": "^2.0.0",
|
|
98
97
|
"open": "^11.0.0",
|
|
@@ -103,7 +102,6 @@
|
|
|
103
102
|
"pretty-ms": "^9.3.0",
|
|
104
103
|
"promise-props-recursive": "^2.0.2",
|
|
105
104
|
"react": "^19.2.7",
|
|
106
|
-
"react-dom": "^19.2.7",
|
|
107
105
|
"react-is": "^19.2.7",
|
|
108
106
|
"rxjs": "^7.8.2",
|
|
109
107
|
"semver": "^7.8.1",
|
|
@@ -122,9 +120,9 @@
|
|
|
122
120
|
"wrap-ansi": "^9.0.2",
|
|
123
121
|
"yaml": "^2.9.0",
|
|
124
122
|
"zod": "^4.4.3",
|
|
125
|
-
"@sanity/cli-build": "^5.3.
|
|
126
|
-
"@sanity/cli-core": "^3.
|
|
127
|
-
"@sanity/workbench-cli": "^2.0
|
|
123
|
+
"@sanity/cli-build": "^5.3.1",
|
|
124
|
+
"@sanity/cli-core": "^3.3.0",
|
|
125
|
+
"@sanity/workbench-cli": "^2.1.0"
|
|
128
126
|
},
|
|
129
127
|
"devDependencies": {
|
|
130
128
|
"@eslint/compat": "^2.1.0",
|
|
@@ -158,9 +156,9 @@
|
|
|
158
156
|
"sanity": "^6.7.0",
|
|
159
157
|
"typescript": "^6.0.3",
|
|
160
158
|
"vitest": "^4.1.11",
|
|
161
|
-
"@repo/tsconfig": "3.70.0",
|
|
162
159
|
"@repo/package.config": "0.0.1",
|
|
163
|
-
"@
|
|
160
|
+
"@repo/tsconfig": "3.70.0",
|
|
161
|
+
"@sanity/cli-test": "13.0.0",
|
|
164
162
|
"@sanity/eslint-config-cli": "1.1.3"
|
|
165
163
|
},
|
|
166
164
|
"peerDependencies": {
|