@sanity/cli 8.33.0 → 8.34.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/README.md +12 -6
  2. package/codemods/dashboardViewsV1.ts +226 -0
  3. package/dist/actions/codemods/dashboard.js +8 -117
  4. package/dist/actions/codemods/dashboard.js.map +1 -1
  5. package/dist/actions/codemods/dashboardViewsV1.js +82 -0
  6. package/dist/actions/codemods/dashboardViewsV1.js.map +1 -0
  7. package/dist/actions/codemods/index.js +2 -0
  8. package/dist/actions/codemods/index.js.map +1 -1
  9. package/dist/actions/codemods/upgradeRequiredPackages.js +121 -0
  10. package/dist/actions/codemods/upgradeRequiredPackages.js.map +1 -0
  11. package/dist/actions/mcp/detectAvailableEditors.js +2 -2
  12. package/dist/actions/mcp/detectAvailableEditors.js.map +1 -1
  13. package/dist/actions/mcp/editorConfigs.js +25 -2
  14. package/dist/actions/mcp/editorConfigs.js.map +1 -1
  15. package/dist/commands/dev.js +1 -1
  16. package/dist/commands/dev.js.map +1 -1
  17. package/dist/commands/mcp/configure.js +1 -1
  18. package/dist/commands/mcp/configure.js.map +1 -1
  19. package/dist/commands/projects/create.js +54 -5
  20. package/dist/commands/projects/create.js.map +1 -1
  21. package/dist/commands/skills/install.js +1 -1
  22. package/dist/commands/skills/install.js.map +1 -1
  23. package/dist/exports/invokeSanityCli/commandPolicies/mcpPolicy.js +2 -1
  24. package/dist/exports/invokeSanityCli/commandPolicies/mcpPolicy.js.map +1 -1
  25. package/dist/services/projects.js +18 -0
  26. package/dist/services/projects.js.map +1 -1
  27. package/dist/util/telemetry/sanitizeTelemetryEvent.js +2 -2
  28. package/dist/util/telemetry/sanitizeTelemetryEvent.js.map +1 -1
  29. package/oclif.manifest.json +3180 -3158
  30. package/package.json +5 -3
package/README.md CHANGED
@@ -4509,7 +4509,7 @@ EXAMPLES
4509
4509
 
4510
4510
  ## `sanity mcp configure`
4511
4511
 
4512
- Configure Sanity MCP server for AI editors (Antigravity, Claude Code, Cline, Codex CLI, Cursor, Gemini CLI, GitHub Copilot CLI, MCPorter, OpenCode, VS Code, VS Code Insiders, Zed)
4512
+ Configure Sanity MCP server for AI editors (Antigravity, Claude Code, Cline, Codex CLI, Cursor, Gemini CLI, GitHub Copilot CLI, MCPorter, OpenCode, Pi, VS Code, VS Code Insiders, Zed)
4513
4513
 
4514
4514
  ```
4515
4515
  USAGE
@@ -4517,7 +4517,7 @@ USAGE
4517
4517
 
4518
4518
  DESCRIPTION
4519
4519
  Configure Sanity MCP server for AI editors (Antigravity, Claude Code, Cline, Codex CLI, Cursor, Gemini CLI, GitHub
4520
- Copilot CLI, MCPorter, OpenCode, VS Code, VS Code Insiders, Zed)
4520
+ Copilot CLI, MCPorter, OpenCode, Pi, VS Code, VS Code Insiders, Zed)
4521
4521
 
4522
4522
  EXAMPLES
4523
4523
  Configure Sanity MCP server for detected AI editors
@@ -5084,8 +5084,8 @@ Create a new Sanity project
5084
5084
 
5085
5085
  ```
5086
5086
  USAGE
5087
- $ sanity projects create [PROJECTNAME] [--json] [--dataset <value>] [--dataset-visibility private|public]
5088
- [--organization <slug|id>] [-y]
5087
+ $ sanity projects create [PROJECTNAME] [--json] [--dataset <value>] [--dataset-visibility private|public] [--logo
5088
+ <path>] [--organization <slug|id>] [-y]
5089
5089
 
5090
5090
  ARGUMENTS
5091
5091
  [PROJECTNAME] Name of the project to create
@@ -5096,6 +5096,8 @@ FLAGS
5096
5096
  --dataset=<value> Create a dataset. Prompts for visibility unless specified or --yes used
5097
5097
  --dataset-visibility=<option> Dataset visibility: public or private
5098
5098
  <options: private|public>
5099
+ --logo=<path> Image file to use as the logo: PNG, JPEG, GIF, WebP, SVG, BMP, TIFF, HEIF or AVIF,
5100
+ at most 5 MB
5099
5101
  --organization=<slug|id> Organization to create the project in
5100
5102
 
5101
5103
  GLOBAL FLAGS
@@ -5121,6 +5123,10 @@ EXAMPLES
5121
5123
 
5122
5124
  $ sanity projects create "My Project" --dataset=staging --dataset-visibility=private
5123
5125
 
5126
+ Create a project with a logo
5127
+
5128
+ $ sanity projects create "My Project" --logo ./logo.png
5129
+
5124
5130
  Create a project non-interactively with JSON output
5125
5131
 
5126
5132
  $ sanity projects create "CI Project" --yes --json
@@ -5361,7 +5367,7 @@ EXAMPLES
5361
5367
 
5362
5368
  ## `sanity skills install`
5363
5369
 
5364
- Install Sanity agent skills for detected AI editors (Antigravity, Claude Code, Cline, Codex CLI, Cursor, Gemini CLI, GitHub Copilot CLI, OpenCode, VS Code, VS Code Insiders)
5370
+ Install Sanity agent skills for detected AI editors (Antigravity, Claude Code, Cline, Codex CLI, Cursor, Gemini CLI, GitHub Copilot CLI, OpenCode, Pi, VS Code, VS Code Insiders)
5365
5371
 
5366
5372
  ```
5367
5373
  USAGE
@@ -5369,7 +5375,7 @@ USAGE
5369
5375
 
5370
5376
  DESCRIPTION
5371
5377
  Install Sanity agent skills for detected AI editors (Antigravity, Claude Code, Cline, Codex CLI, Cursor, Gemini CLI,
5372
- GitHub Copilot CLI, OpenCode, VS Code, VS Code Insiders)
5378
+ GitHub Copilot CLI, OpenCode, Pi, VS Code, VS Code Insiders)
5373
5379
 
5374
5380
  EXAMPLES
5375
5381
  Install Sanity agent skills for detected AI editors
@@ -0,0 +1,226 @@
1
+ // jscodeshift runs transforms from its own install; `Collection#find(j.X)` reads as an array call
2
+ /* oxlint-disable n-js/no-unpublished-import, unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument */
3
+ import {
4
+ type API,
5
+ type ASTPath,
6
+ type CallExpression,
7
+ type Collection,
8
+ type ExportDefaultDeclaration,
9
+ type FileInfo,
10
+ type ImportDeclaration,
11
+ type ImportSpecifier,
12
+ type JSCodeshift,
13
+ type Options,
14
+ } from 'jscodeshift'
15
+
16
+ interface Import {
17
+ kind: 'type' | 'value'
18
+ name: string
19
+ source: string
20
+ }
21
+
22
+ const VIEWS: Partial<Record<string, {hook: string; name: string}>> = {
23
+ asset_source: {hook: 'useAssetSource', name: 'AssetSource'},
24
+ tile: {hook: 'useTile', name: 'Tile'},
25
+ }
26
+
27
+ function uniqueName(j: JSCodeshift, root: Collection, base: string): string {
28
+ const used = new Set(
29
+ [...root.find(j.Identifier).nodes(), ...root.find(j.JSXIdentifier).nodes()].map(
30
+ (node) => node.name,
31
+ ),
32
+ )
33
+ let name = base
34
+ for (let index = 2; used.has(name); index++) name = `${base}${index}`
35
+
36
+ return name
37
+ }
38
+
39
+ function migrateView(
40
+ j: JSCodeshift,
41
+ root: Collection,
42
+ api: API,
43
+ exportDefault: ExportDefaultDeclaration,
44
+ call: CallExpression,
45
+ ): boolean {
46
+ const [surface, components] = call.arguments
47
+ const surfaceName = j.StringLiteral.check(surface) ? surface.value : ''
48
+ const view = VIEWS[surfaceName]
49
+ const slot =
50
+ view && j.ObjectExpression.check(components)
51
+ ? components.properties.find(
52
+ (property) =>
53
+ j.ObjectProperty.check(property) &&
54
+ ((j.Identifier.check(property.key) && property.key.name === surfaceName) ||
55
+ (j.StringLiteral.check(property.key) && property.key.value === surfaceName)),
56
+ )
57
+ : undefined
58
+ const fn = j.ObjectProperty.check(slot) ? slot.value : undefined
59
+ const isFunction = j.ArrowFunctionExpression.check(fn) || j.FunctionExpression.check(fn)
60
+ const [props, ...rest] = isFunction ? fn.params : []
61
+
62
+ if (
63
+ !view ||
64
+ !isFunction ||
65
+ rest.length > 0 ||
66
+ (props && !j.Identifier.check(props) && !j.ObjectPattern.check(props))
67
+ ) {
68
+ api.report(
69
+ 'Left `unstable_defineView` unchanged: only tile and asset_source views with an inline component are migrated.',
70
+ )
71
+ return false
72
+ }
73
+
74
+ const name = j.FunctionExpression.check(fn) && j.Identifier.check(fn.id) ? fn.id.name : ''
75
+ const isNameFree = name && !root.find(j.Program).paths()[0]?.scope?.declares(name)
76
+ const id = j.identifier(isNameFree ? name : uniqueName(j, root, view.name))
77
+ const body = j.BlockStatement.check(fn.body)
78
+ ? fn.body
79
+ : j.blockStatement([j.returnStatement(fn.body)])
80
+ if (props) {
81
+ body.body.unshift(
82
+ j.variableDeclaration('const', [
83
+ j.variableDeclarator(props, j.callExpression(j.identifier(view.hook), [])),
84
+ ]),
85
+ )
86
+ addImport(j, root, {kind: 'value', name: view.hook, source: '@sanity/sdk-react/dashboard'})
87
+ }
88
+
89
+ exportDefault.declaration = j.functionDeclaration(id, [], body)
90
+
91
+ return true
92
+ }
93
+
94
+ function migrateWebWorker(
95
+ j: JSCodeshift,
96
+ root: Collection,
97
+ api: API,
98
+ exportDefault: ExportDefaultDeclaration,
99
+ call: CallExpression,
100
+ isTypeScript: boolean,
101
+ sdkPackage: string,
102
+ ): boolean {
103
+ const [, fn] = call.arguments
104
+ if (!j.ArrowFunctionExpression.check(fn) && !j.FunctionExpression.check(fn)) {
105
+ api.report('Left `unstable_defineService` unchanged: only an inline function is migrated.')
106
+ return false
107
+ }
108
+
109
+ const [param] = fn.params
110
+ const props = j.AssignmentPattern.check(param) ? param.left : param
111
+ if (j.ObjectPattern.check(props)) {
112
+ for (const property of props.properties) {
113
+ if (j.ObjectProperty.check(property) && j.Identifier.check(property.key)) {
114
+ if (property.key.name !== 'service') continue
115
+
116
+ property.key = j.identifier('worker')
117
+ property.shorthand = false
118
+ }
119
+ }
120
+ } else if (j.Identifier.check(props)) {
121
+ const members = j(fn.body)
122
+ .find(j.MemberExpression, {
123
+ computed: false,
124
+ object: {name: props.name},
125
+ property: {name: 'service'},
126
+ })
127
+ .nodes()
128
+ for (const member of members) member.property = j.identifier('worker')
129
+ }
130
+
131
+ exportDefault.declaration = fn
132
+
133
+ if (isTypeScript && (j.ObjectPattern.check(props) || j.Identifier.check(props))) {
134
+ props.typeAnnotation = j.tsTypeAnnotation(j.tsTypeReference(j.identifier('WebWorkerProps')))
135
+ addImport(j, root, {kind: 'type', name: 'WebWorkerProps', source: `${sdkPackage}/dashboard`})
136
+ }
137
+
138
+ return true
139
+ }
140
+
141
+ function addImport(j: JSCodeshift, root: Collection, {kind, name, source}: Import): void {
142
+ const declarations = root
143
+ .find(j.ImportDeclaration, {source: {value: source}})
144
+ .filter((path) => (path.node.importKind ?? 'value') === kind)
145
+ if (declarations.find(j.ImportSpecifier, {imported: {name}}).size() > 0) return
146
+
147
+ const specifier = j.importSpecifier(j.identifier(name))
148
+ const existing = declarations.nodes()[0]
149
+ if (existing?.specifiers) {
150
+ existing.specifiers.push(specifier)
151
+ return
152
+ }
153
+
154
+ const declaration = j.importDeclaration([specifier], j.stringLiteral(source), kind)
155
+ root.find(j.ImportDeclaration).paths().at(-1)?.insertAfter(declaration)
156
+ }
157
+
158
+ function removeUnusedImport(j: JSCodeshift, root: Collection, path: ASTPath<ImportSpecifier>) {
159
+ const {local} = path.node
160
+ const isUsed =
161
+ j.Identifier.check(local) &&
162
+ root
163
+ .find(j.Identifier, {name: local.name})
164
+ .filter((identifier) => identifier.parent.node !== path.node)
165
+ .size() > 0
166
+ if (isUsed) return
167
+
168
+ const declaration: ASTPath<ImportDeclaration> = path.parent
169
+ path.prune()
170
+ if (declaration.node.specifiers?.length) return
171
+
172
+ // The parser attaches a file header comment to the first import
173
+ const body = root.find(j.Program).nodes()[0]?.body ?? []
174
+ const next = body[body.indexOf(declaration.node) + 1]
175
+ if (next && declaration.node.comments) {
176
+ next.comments = [...declaration.node.comments, ...(next.comments ?? [])]
177
+ }
178
+
179
+ declaration.prune()
180
+ }
181
+
182
+ export default function dashboardViewsV1(
183
+ file: FileInfo,
184
+ api: API,
185
+ {sdkPackage = '@sanity/sdk-react'}: Options,
186
+ ): string | undefined {
187
+ const j = api.jscodeshift
188
+ const root = j(file.source)
189
+ const isTypeScript = /\.tsx?$/.test(file.path)
190
+
191
+ const defines = ['unstable_defineService', 'unstable_defineView'].flatMap((defineName) =>
192
+ root
193
+ .find(j.ImportSpecifier, {imported: {name: defineName}})
194
+ .paths()
195
+ .map((specifier) => ({defineName, specifier})),
196
+ )
197
+
198
+ const migrated = defines.flatMap(({defineName, specifier}) => {
199
+ const {local} = specifier.node
200
+ if (!j.Identifier.check(local)) return []
201
+
202
+ return root
203
+ .find(j.CallExpression, {callee: {name: local.name}})
204
+ .paths()
205
+ .map((path) => {
206
+ const exportDefault = path.parent.node
207
+ if (!j.ExportDefaultDeclaration.check(exportDefault)) {
208
+ api.report(
209
+ `Left \`${defineName}\` unchanged: only \`export default ${defineName}(...)\` is migrated.`,
210
+ )
211
+ return false
212
+ }
213
+
214
+ return defineName === 'unstable_defineView'
215
+ ? migrateView(j, root, api, exportDefault, path.node)
216
+ : migrateWebWorker(j, root, api, exportDefault, path.node, isTypeScript, sdkPackage)
217
+ })
218
+ })
219
+ if (!migrated.includes(true)) return undefined
220
+
221
+ for (const {specifier} of defines) removeUnusedImport(j, root, specifier)
222
+
223
+ return root.toSource()
224
+ }
225
+
226
+ export const parser = 'tsx'
@@ -1,41 +1,14 @@
1
- import { readFile } from 'node:fs/promises';
2
- import path from 'node:path';
3
- import { findPathForFiles, getCliConfig, getLocalPackageVersion, getStudioConfig, isWorkbenchApp, tryFindStudioConfigPath } from '@sanity/cli-core';
4
- import { getYarnMajorVersion, readPackageJson } from '@sanity/cli-core/package-manager';
5
- import { confirm, input, select } from '@sanity/cli-core/ux';
1
+ import { findPathForFiles, getCliConfig, getStudioConfig, isWorkbenchApp, tryFindStudioConfigPath } from '@sanity/cli-core';
2
+ import { input, select } from '@sanity/cli-core/ux';
6
3
  import { toAppSlug } from '@sanity/workbench-cli/init';
7
- import { execa } from 'execa';
8
- import { lt } from 'semver';
9
- import yaml from 'yaml';
10
4
  import { getOrganizationGrants, listOrganizations } from '../../services/organizations.js';
11
5
  import { getProjectById } from '../../services/projects.js';
12
6
  import { determineIsApp } from '../../util/determineIsApp.js';
13
- import { detectWorkspace } from '../../util/packageManager/installationInfo/detectWorkspace.js';
14
- import { getPackageManagerChoice, getPartialEnvWithNpmPath } from '../../util/packageManager/packageManagerChoice.js';
15
7
  import { getManageUrl } from '../projects/getManageUrl.js';
8
+ import { upgradeRequiredPackages } from './upgradeRequiredPackages.js';
16
9
  // `defineApplication` landed in 6.12.0; the Dashboard also needs the CLI fixes released since
17
10
  const MIN_SANITY_VERSION = '6.20.0';
18
11
  const MIN_SDK_VERSION = '3.9.1';
19
- async function findOutdated(packages, workDir) {
20
- const installed = await Promise.all(packages.map(({ name })=>getLocalPackageVersion(name, workDir)));
21
- return packages.flatMap((pkg, index)=>{
22
- const version = installed[index];
23
- return version && lt(version, pkg.min) ? [
24
- {
25
- ...pkg,
26
- version
27
- }
28
- ] : [];
29
- });
30
- }
31
- // corepack's `packageManager: "yarn@4.9.1"` names the major even without a .yarnrc.yml
32
- function declaredYarnMajor(field) {
33
- const match = typeof field === 'string' ? /^yarn@(\d+)/.exec(field) : null;
34
- return match ? Number.parseInt(match[1], 10) : undefined;
35
- }
36
- function listOutdated(packages) {
37
- return packages.map(({ min, name, neededBy, version })=>` - ${name} ${version} (${neededBy} ${min} or later)`).join('\n');
38
- }
39
12
  const purpose = 'Move an existing Studio or SDK app onto the Dashboard';
40
13
  const description = `
41
14
  Rewrites sanity.cli.ts (or .js) so the next \`sanity dev\` and \`sanity deploy\` run the project
@@ -133,93 +106,11 @@ export const dashboard = {
133
106
  neededBy: 'SDK apps need'
134
107
  })) : []
135
108
  ];
136
- const outdated = await findOutdated(required, workDir);
137
- if (outdated.length > 0) {
138
- output.warn(`\`sanity dev\` and \`sanity deploy\` will fail until you upgrade:\n${listOutdated(outdated)}`);
139
- const { chosen: packageManager } = await getPackageManagerChoice(workDir, {
140
- interactive: false
141
- });
142
- const { root, yarnBerry } = await detectWorkspace(workDir);
143
- const [{ dependencies, devDependencies }, rootManifest] = await Promise.all([
144
- readPackageJson(path.join(workDir, 'package.json'), {
145
- skipSchemaValidation: true
146
- }),
147
- readFile(path.join(root, 'package.json'), 'utf8').then(JSON.parse, ()=>null)
148
- ]);
149
- let pnpmOverrides = [];
150
- if (packageManager === 'pnpm') {
151
- const workspacePath = path.join(root, 'pnpm-workspace.yaml');
152
- const workspaceConfig = await readFile(workspacePath, 'utf8').then(yaml.parse, ()=>null);
153
- pnpmOverrides = Object.keys({
154
- ...rootManifest?.pnpm?.overrides,
155
- ...workspaceConfig?.overrides
156
- });
157
- }
158
- // bun's upgrade leaves a catalog untouched, yarn's swaps `catalog:` for a plain range, and
159
- // pnpm's does the same when `overrides` pins the package
160
- const isUnupgradableCatalog = (name)=>(dependencies?.[name] ?? devDependencies?.[name] ?? '').startsWith('catalog:') && (packageManager === 'bun' || packageManager === 'yarn' || pnpmOverrides.some((key)=>key === name || key.startsWith(`${name}@`)));
161
- const catalogued = outdated.filter(({ name })=>isUnupgradableCatalog(name));
162
- const upgradable = outdated.filter(({ name })=>!isUnupgradableCatalog(name));
163
- if (catalogued.length > 0) {
164
- const targets = catalogued.map(({ min, name })=>`${name} to ^${min} or later`).join(', ');
165
- const install = `then run \`${packageManager} install\``;
166
- output.log(packageManager === 'pnpm' ? `pnpm can't upgrade catalog packages that \`overrides\` pin, so update them yourself: set ${targets} in the catalog and in \`overrides\`, ${install}.` : `${packageManager} can't upgrade catalog packages, so update them yourself: set ${targets} in the catalog in ${packageManager === 'bun' ? 'the root package.json' : '.yarnrc.yml'}, ${install}.`);
167
- }
168
- if (upgradable.length > 0) {
169
- const names = upgradable.map(({ name })=>name);
170
- const latest = names.map((name)=>`${name}@latest`);
171
- // Berry dropped `yarn upgrade`, and the user agent only names yarn when the CLI itself was
172
- // run through yarn, so take the project's own signals first
173
- const isYarnBerry = yarnBerry || (declaredYarnMajor(rootManifest?.packageManager) ?? getYarnMajorVersion() ?? 1) >= 2;
174
- // pnpm keeps `catalog:` and bumps the catalog entry only with `update --latest`
175
- const command = {
176
- bun: [
177
- 'bun',
178
- 'update',
179
- ...latest
180
- ],
181
- manual: undefined,
182
- npm: [
183
- 'npm',
184
- 'install',
185
- '--legacy-peer-deps',
186
- ...latest
187
- ],
188
- pnpm: [
189
- 'pnpm',
190
- 'update',
191
- ...names,
192
- '--latest'
193
- ],
194
- yarn: [
195
- 'yarn',
196
- isYarnBerry ? 'up' : 'upgrade',
197
- ...latest
198
- ]
199
- }[packageManager];
200
- if (!command) {
201
- output.log(`Upgrade ${names.join(', ')} to the latest version with your package manager.`);
202
- } else if (dry || !await confirm({
203
- default: true,
204
- message: `Upgrade ${names.join(', ')} to the latest version now?`
205
- })) {
206
- output.log(`Run \`${command.join(' ')}\` to upgrade.`);
207
- } else {
208
- output.log(`Running \`${command.join(' ')}\``);
209
- // The version check below reports a failed upgrade, so the exit code isn't needed
210
- await execa(command[0], command.slice(1), {
211
- cwd: workDir,
212
- env: getPartialEnvWithNpmPath(workDir),
213
- reject: false,
214
- stdio: 'inherit'
215
- });
216
- const stillOutdated = await findOutdated(upgradable, workDir);
217
- if (stillOutdated.length > 0) {
218
- output.warn(`These are still too old after the upgrade. Upgrade them before you run \`sanity dev\` or \`sanity deploy\`:\n${listOutdated(stillOutdated)}`);
219
- }
220
- }
221
- }
222
- }
109
+ await upgradeRequiredPackages(required, {
110
+ dry,
111
+ output,
112
+ workDir
113
+ });
223
114
  // getCliConfig has already checked there is exactly one
224
115
  const cliConfigPaths = await findPathForFiles(workDir, [
225
116
  'sanity.cli.ts',
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/codemods/dashboard.ts"],"sourcesContent":["import {readFile} from 'node:fs/promises'\nimport path from 'node:path'\n\nimport {\n findPathForFiles,\n getCliConfig,\n getLocalPackageVersion,\n getStudioConfig,\n isWorkbenchApp,\n tryFindStudioConfigPath,\n} from '@sanity/cli-core'\nimport {getYarnMajorVersion, readPackageJson} from '@sanity/cli-core/package-manager'\nimport {confirm, input, select} from '@sanity/cli-core/ux'\nimport {toAppSlug} from '@sanity/workbench-cli/init'\nimport {execa} from 'execa'\nimport {lt} from 'semver'\nimport yaml from 'yaml'\n\nimport {getOrganizationGrants, listOrganizations} from '../../services/organizations.js'\nimport {getProjectById} from '../../services/projects.js'\nimport {determineIsApp} from '../../util/determineIsApp.js'\nimport {detectWorkspace} from '../../util/packageManager/installationInfo/detectWorkspace.js'\nimport {\n getPackageManagerChoice,\n getPartialEnvWithNpmPath,\n} from '../../util/packageManager/packageManagerChoice.js'\nimport {getManageUrl} from '../projects/getManageUrl.js'\nimport {type CodeMod} from './types.js'\n\n// `defineApplication` landed in 6.12.0; the Dashboard also needs the CLI fixes released since\nconst MIN_SANITY_VERSION = '6.20.0'\nconst MIN_SDK_VERSION = '3.9.1'\n\ninterface RequiredPackage {\n min: string\n name: string\n neededBy: string\n}\n\nasync function findOutdated(packages: RequiredPackage[], workDir: string) {\n const installed = await Promise.all(\n packages.map(({name}) => getLocalPackageVersion(name, workDir)),\n )\n return packages.flatMap((pkg, index) => {\n const version = installed[index]\n return version && lt(version, pkg.min) ? [{...pkg, version}] : []\n })\n}\n\n// corepack's `packageManager: \"yarn@4.9.1\"` names the major even without a .yarnrc.yml\nfunction declaredYarnMajor(field: unknown) {\n const match = typeof field === 'string' ? /^yarn@(\\d+)/.exec(field) : null\n return match ? Number.parseInt(match[1], 10) : undefined\n}\n\nfunction listOutdated(packages: Awaited<ReturnType<typeof findOutdated>>) {\n return packages\n .map(({min, name, neededBy, version}) => ` - ${name} ${version} (${neededBy} ${min} or later)`)\n .join('\\n')\n}\n\nconst purpose = 'Move an existing Studio or SDK app onto the Dashboard'\nconst description = `\nRewrites sanity.cli.ts (or .js) so the next \\`sanity dev\\` and \\`sanity deploy\\` run the project\nas a new Dashboard application. Asks for the application's title and slug, and looks up the\norganization from the project. Offers to upgrade sanity (older than ${MIN_SANITY_VERSION}) and, in\nSDK apps, @sanity/sdk and @sanity/sdk-react (older than ${MIN_SDK_VERSION}) to their latest versions.\n\nfrom: app: {organizationId: 'oAbc', entry: './src/App.tsx'}\n to: app: defineApplication({title: 'Acme', slug: 'acme', organizationId: 'oAbc', entry: './src/App.tsx'})\n\nThe existing deployment is left alone. Remove \\`deployment.appId\\` before deploying, or the\nDashboard build replaces the existing application.\n`.trim()\n\nexport const dashboard: CodeMod = {\n description,\n filename: 'dashboard.js',\n prepare: async ({dry, output, workDir}) => {\n const config = await getCliConfig(workDir)\n if (isWorkbenchApp(config.app)) {\n throw new Error('This project is already a Dashboard application.')\n }\n\n const projectId = config.api?.projectId\n let organizationId = config.app?.organizationId\n // Deploy creates the application with both IDs, and the API rejects a project outside the\n // organization, so a project's organization is the only valid choice\n if (!organizationId && projectId) {\n organizationId = (await getProjectById(projectId)).organizationId ?? undefined\n if (!organizationId) {\n throw new Error(\n `Project ${projectId} isn't in an organization, and a Dashboard application needs one. Move the project into an organization at ${getManageUrl(projectId)}, then run this again.`,\n )\n }\n }\n if (!organizationId) {\n const choices = await Promise.all(\n (await listOrganizations()).map(async ({id, name}) => {\n // Grants can 401 for implicit memberships; treat any failure as no access\n const grants = await getOrganizationGrants(id).catch(() => null)\n const canDeploy = (grants?.['sanity.sdk.applications'] ?? []).some((resource) =>\n resource.grants.some((grant) => grant.name === 'deploy'),\n )\n return {\n disabled: canDeploy ? false : 'Insufficient permissions',\n name: `${name} [${id}]`,\n value: id,\n }\n }),\n )\n if (!choices.some((choice) => choice.disabled === false)) {\n throw new Error(\n \"You can't deploy applications in any of your organizations. Ask an organization administrator for access, then run this again.\",\n )\n }\n organizationId = await select({choices, message: 'Organization that owns the application:'})\n }\n\n let suggestedTitle = config.app?.title\n if (!suggestedTitle && (await tryFindStudioConfigPath(workDir))) {\n const studioConfig = await getStudioConfig(workDir, {resolvePlugins: false})\n suggestedTitle = Array.isArray(studioConfig) ? undefined : studioConfig.title\n }\n\n const title = await input({\n default: suggestedTitle,\n message: 'Application title:',\n validate: (value) => (value.trim() ? true : 'Enter a title for the application.'),\n })\n\n // A studio titled after its host would otherwise suggest the one slug that's rejected\n const suggestedSlug = toAppSlug(title) ?? undefined\n const slug = await input({\n default: suggestedSlug === config.studioHost ? undefined : suggestedSlug,\n message: 'Application slug (the hostname it deploys to):',\n validate: (value) => {\n if (toAppSlug(value) !== value) {\n return 'Use lowercase letters, numbers and hyphens, starting with a letter.'\n }\n if (value === config.studioHost) {\n return `\"${value}\" is your Studio's hostname (studioHost), so the deploy would fail. Choose a different slug.`\n }\n return true\n },\n })\n\n // `app.id` is the deprecated spelling and deploy still honours it\n const appIdKey = config.deployment?.appId ? 'deployment.appId' : config.app?.id && 'app.id'\n if (appIdKey) {\n output.warn(\n `Remove \\`${appIdKey}\\` from your CLI config before you deploy. It points at your existing application, and deploying with it in place replaces that application with the Dashboard build.`,\n )\n }\n\n const required: RequiredPackage[] = [\n {min: MIN_SANITY_VERSION, name: 'sanity', neededBy: 'the Dashboard needs'},\n ...(determineIsApp(config)\n ? ['@sanity/sdk', '@sanity/sdk-react'].map((name) => ({\n min: MIN_SDK_VERSION,\n name,\n neededBy: 'SDK apps need',\n }))\n : []),\n ]\n const outdated = await findOutdated(required, workDir)\n if (outdated.length > 0) {\n output.warn(\n `\\`sanity dev\\` and \\`sanity deploy\\` will fail until you upgrade:\\n${listOutdated(outdated)}`,\n )\n\n const {chosen: packageManager} = await getPackageManagerChoice(workDir, {interactive: false})\n const {root, yarnBerry} = await detectWorkspace(workDir)\n const [{dependencies, devDependencies}, rootManifest] = await Promise.all([\n readPackageJson(path.join(workDir, 'package.json'), {skipSchemaValidation: true}),\n readFile(path.join(root, 'package.json'), 'utf8').then(JSON.parse, () => null),\n ])\n let pnpmOverrides: string[] = []\n if (packageManager === 'pnpm') {\n const workspacePath = path.join(root, 'pnpm-workspace.yaml')\n const workspaceConfig = await readFile(workspacePath, 'utf8').then(yaml.parse, () => null)\n pnpmOverrides = Object.keys({\n ...rootManifest?.pnpm?.overrides,\n ...workspaceConfig?.overrides,\n })\n }\n\n // bun's upgrade leaves a catalog untouched, yarn's swaps `catalog:` for a plain range, and\n // pnpm's does the same when `overrides` pins the package\n const isUnupgradableCatalog = (name: string) =>\n (dependencies?.[name] ?? devDependencies?.[name] ?? '').startsWith('catalog:') &&\n (packageManager === 'bun' ||\n packageManager === 'yarn' ||\n pnpmOverrides.some((key) => key === name || key.startsWith(`${name}@`)))\n const catalogued = outdated.filter(({name}) => isUnupgradableCatalog(name))\n const upgradable = outdated.filter(({name}) => !isUnupgradableCatalog(name))\n\n if (catalogued.length > 0) {\n const targets = catalogued.map(({min, name}) => `${name} to ^${min} or later`).join(', ')\n const install = `then run \\`${packageManager} install\\``\n output.log(\n packageManager === 'pnpm'\n ? `pnpm can't upgrade catalog packages that \\`overrides\\` pin, so update them yourself: set ${targets} in the catalog and in \\`overrides\\`, ${install}.`\n : `${packageManager} can't upgrade catalog packages, so update them yourself: set ${targets} in the catalog in ${packageManager === 'bun' ? 'the root package.json' : '.yarnrc.yml'}, ${install}.`,\n )\n }\n\n if (upgradable.length > 0) {\n const names = upgradable.map(({name}) => name)\n const latest = names.map((name) => `${name}@latest`)\n // Berry dropped `yarn upgrade`, and the user agent only names yarn when the CLI itself was\n // run through yarn, so take the project's own signals first\n const isYarnBerry =\n yarnBerry ||\n (declaredYarnMajor(rootManifest?.packageManager) ?? getYarnMajorVersion() ?? 1) >= 2\n // pnpm keeps `catalog:` and bumps the catalog entry only with `update --latest`\n const command = {\n bun: ['bun', 'update', ...latest],\n manual: undefined,\n npm: ['npm', 'install', '--legacy-peer-deps', ...latest],\n pnpm: ['pnpm', 'update', ...names, '--latest'],\n yarn: ['yarn', isYarnBerry ? 'up' : 'upgrade', ...latest],\n }[packageManager]\n\n if (!command) {\n output.log(`Upgrade ${names.join(', ')} to the latest version with your package manager.`)\n } else if (\n dry ||\n !(await confirm({\n default: true,\n message: `Upgrade ${names.join(', ')} to the latest version now?`,\n }))\n ) {\n output.log(`Run \\`${command.join(' ')}\\` to upgrade.`)\n } else {\n output.log(`Running \\`${command.join(' ')}\\``)\n // The version check below reports a failed upgrade, so the exit code isn't needed\n await execa(command[0], command.slice(1), {\n cwd: workDir,\n env: getPartialEnvWithNpmPath(workDir),\n reject: false,\n stdio: 'inherit',\n })\n const stillOutdated = await findOutdated(upgradable, workDir)\n if (stillOutdated.length > 0) {\n output.warn(\n `These are still too old after the upgrade. Upgrade them before you run \\`sanity dev\\` or \\`sanity deploy\\`:\\n${listOutdated(stillOutdated)}`,\n )\n }\n }\n }\n }\n\n // getCliConfig has already checked there is exactly one\n const cliConfigPaths = await findPathForFiles(workDir, ['sanity.cli.ts', 'sanity.cli.js'])\n const paths = cliConfigPaths.filter((path) => path.exists).map((path) => path.path)\n\n return {options: {organizationId, slug, title: title.trim()}, paths}\n },\n purpose,\n}\n"],"names":["readFile","path","findPathForFiles","getCliConfig","getLocalPackageVersion","getStudioConfig","isWorkbenchApp","tryFindStudioConfigPath","getYarnMajorVersion","readPackageJson","confirm","input","select","toAppSlug","execa","lt","yaml","getOrganizationGrants","listOrganizations","getProjectById","determineIsApp","detectWorkspace","getPackageManagerChoice","getPartialEnvWithNpmPath","getManageUrl","MIN_SANITY_VERSION","MIN_SDK_VERSION","findOutdated","packages","workDir","installed","Promise","all","map","name","flatMap","pkg","index","version","min","declaredYarnMajor","field","match","exec","Number","parseInt","undefined","listOutdated","neededBy","join","purpose","description","trim","dashboard","filename","prepare","dry","output","config","app","Error","projectId","api","organizationId","choices","id","grants","catch","canDeploy","some","resource","grant","disabled","value","choice","message","suggestedTitle","title","studioConfig","resolvePlugins","Array","isArray","default","validate","suggestedSlug","slug","studioHost","appIdKey","deployment","appId","warn","required","outdated","length","chosen","packageManager","interactive","root","yarnBerry","dependencies","devDependencies","rootManifest","skipSchemaValidation","then","JSON","parse","pnpmOverrides","workspacePath","workspaceConfig","Object","keys","pnpm","overrides","isUnupgradableCatalog","startsWith","key","catalogued","filter","upgradable","targets","install","log","names","latest","isYarnBerry","command","bun","manual","npm","yarn","slice","cwd","env","reject","stdio","stillOutdated","cliConfigPaths","paths","exists","options"],"mappings":"AAAA,SAAQA,QAAQ,QAAO,mBAAkB;AACzC,OAAOC,UAAU,YAAW;AAE5B,SACEC,gBAAgB,EAChBC,YAAY,EACZC,sBAAsB,EACtBC,eAAe,EACfC,cAAc,EACdC,uBAAuB,QAClB,mBAAkB;AACzB,SAAQC,mBAAmB,EAAEC,eAAe,QAAO,mCAAkC;AACrF,SAAQC,OAAO,EAAEC,K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AAS;gBAAC5E;gBAAgBsB;gBAAMR,OAAOA,MAAMzB,IAAI;YAAE;YAAGqF;QAAK;IACrE;IACAvF;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/actions/codemods/dashboard.ts"],"sourcesContent":["import {\n findPathForFiles,\n getCliConfig,\n getStudioConfig,\n isWorkbenchApp,\n tryFindStudioConfigPath,\n} from '@sanity/cli-core'\nimport {input, select} from '@sanity/cli-core/ux'\nimport {toAppSlug} from '@sanity/workbench-cli/init'\n\nimport {getOrganizationGrants, listOrganizations} from '../../services/organizations.js'\nimport {getProjectById} from '../../services/projects.js'\nimport {determineIsApp} from '../../util/determineIsApp.js'\nimport {getManageUrl} from '../projects/getManageUrl.js'\nimport {type CodeMod} from './types.js'\nimport {upgradeRequiredPackages} from './upgradeRequiredPackages.js'\n\n// `defineApplication` landed in 6.12.0; the Dashboard also needs the CLI fixes released since\nconst MIN_SANITY_VERSION = '6.20.0'\nconst MIN_SDK_VERSION = '3.9.1'\n\nconst purpose = 'Move an existing Studio or SDK app onto the Dashboard'\nconst description = `\nRewrites sanity.cli.ts (or .js) so the next \\`sanity dev\\` and \\`sanity deploy\\` run the project\nas a new Dashboard application. Asks for the application's title and slug, and looks up the\norganization from the project. Offers to upgrade sanity (older than ${MIN_SANITY_VERSION}) and, in\nSDK apps, @sanity/sdk and @sanity/sdk-react (older than ${MIN_SDK_VERSION}) to their latest versions.\n\nfrom: app: {organizationId: 'oAbc', entry: './src/App.tsx'}\n to: app: defineApplication({title: 'Acme', slug: 'acme', organizationId: 'oAbc', entry: './src/App.tsx'})\n\nThe existing deployment is left alone. Remove \\`deployment.appId\\` before deploying, or the\nDashboard build replaces the existing application.\n`.trim()\n\nexport const dashboard: CodeMod = {\n description,\n filename: 'dashboard.js',\n prepare: async ({dry, output, workDir}) => {\n const config = await getCliConfig(workDir)\n if (isWorkbenchApp(config.app)) {\n throw new Error('This project is already a Dashboard application.')\n }\n\n const projectId = config.api?.projectId\n let organizationId = config.app?.organizationId\n // Deploy creates the application with both IDs, and the API rejects a project outside the\n // organization, so a project's organization is the only valid choice\n if (!organizationId && projectId) {\n organizationId = (await getProjectById(projectId)).organizationId ?? undefined\n if (!organizationId) {\n throw new Error(\n `Project ${projectId} isn't in an organization, and a Dashboard application needs one. Move the project into an organization at ${getManageUrl(projectId)}, then run this again.`,\n )\n }\n }\n if (!organizationId) {\n const choices = await Promise.all(\n (await listOrganizations()).map(async ({id, name}) => {\n // Grants can 401 for implicit memberships; treat any failure as no access\n const grants = await getOrganizationGrants(id).catch(() => null)\n const canDeploy = (grants?.['sanity.sdk.applications'] ?? []).some((resource) =>\n resource.grants.some((grant) => grant.name === 'deploy'),\n )\n return {\n disabled: canDeploy ? false : 'Insufficient permissions',\n name: `${name} [${id}]`,\n value: id,\n }\n }),\n )\n if (!choices.some((choice) => choice.disabled === false)) {\n throw new Error(\n \"You can't deploy applications in any of your organizations. Ask an organization administrator for access, then run this again.\",\n )\n }\n organizationId = await select({choices, message: 'Organization that owns the application:'})\n }\n\n let suggestedTitle = config.app?.title\n if (!suggestedTitle && (await tryFindStudioConfigPath(workDir))) {\n const studioConfig = await getStudioConfig(workDir, {resolvePlugins: false})\n suggestedTitle = Array.isArray(studioConfig) ? undefined : studioConfig.title\n }\n\n const title = await input({\n default: suggestedTitle,\n message: 'Application title:',\n validate: (value) => (value.trim() ? true : 'Enter a title for the application.'),\n })\n\n // A studio titled after its host would otherwise suggest the one slug that's rejected\n const suggestedSlug = toAppSlug(title) ?? undefined\n const slug = await input({\n default: suggestedSlug === config.studioHost ? undefined : suggestedSlug,\n message: 'Application slug (the hostname it deploys to):',\n validate: (value) => {\n if (toAppSlug(value) !== value) {\n return 'Use lowercase letters, numbers and hyphens, starting with a letter.'\n }\n if (value === config.studioHost) {\n return `\"${value}\" is your Studio's hostname (studioHost), so the deploy would fail. Choose a different slug.`\n }\n return true\n },\n })\n\n // `app.id` is the deprecated spelling and deploy still honours it\n const appIdKey = config.deployment?.appId ? 'deployment.appId' : config.app?.id && 'app.id'\n if (appIdKey) {\n output.warn(\n `Remove \\`${appIdKey}\\` from your CLI config before you deploy. It points at your existing application, and deploying with it in place replaces that application with the Dashboard build.`,\n )\n }\n\n const required = [\n {min: MIN_SANITY_VERSION, name: 'sanity', neededBy: 'the Dashboard needs'},\n ...(determineIsApp(config)\n ? ['@sanity/sdk', '@sanity/sdk-react'].map((name) => ({\n min: MIN_SDK_VERSION,\n name,\n neededBy: 'SDK apps need',\n }))\n : []),\n ]\n await upgradeRequiredPackages(required, {dry, output, workDir})\n\n // getCliConfig has already checked there is exactly one\n const cliConfigPaths = await findPathForFiles(workDir, ['sanity.cli.ts', 'sanity.cli.js'])\n const paths = cliConfigPaths.filter((path) => path.exists).map((path) => path.path)\n\n return {options: {organizationId, slug, title: title.trim()}, paths}\n },\n purpose,\n}\n"],"names":["findPathForFiles","getCliConfig","getStudioConfig","isWorkbenchApp","tryFindStudioConfigPath","input","select","toAppSlug","getOrganizationGrants","listOrganizations","getProjectById","determineIsApp","getManageUrl","upgradeRequiredPackages","MIN_SANITY_VERSION","MIN_SDK_VERSION","purpose","description","trim","dashboard","filename","prepare","dry","output","workDir","config","app","Error","projectId","api","organizationId","undefined","choices","Promise","all","map","id","name","grants","catch","canDeploy","some","resource","grant","disabled","value","choice","message","suggestedTitle","title","studioConfig","resolvePlugins","Array","isArray","default","validate","suggestedSlug","slug","studioHost","appIdKey","deployment","appId","warn","required","min","neededBy","cliConfigPaths","paths","filter","path","exists","options"],"mappings":"AAAA,SACEA,gBAAgB,EAChBC,YAAY,EACZC,eAAe,EACfC,cAAc,EACdC,uBAAuB,QAClB,mBAAkB;AACzB,SAAQC,KAAK,EAAEC,MAAM,QAAO,sBAAqB;AACjD,SAAQC,SAAS,QAAO,6BAA4B;AAEpD,SAAQC,qBAAqB,EAAEC,iBAAiB,QAAO,kCAAiC;AACxF,SAAQC,cAAc,QAAO,6BAA4B;AACzD,SAAQC,cAAc,QAAO,+BAA8B;AAC3D,SAAQC,YAAY,Q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WAAW;YACf;gBAACC,KAAKlD;gBAAoBuB,MAAM;gBAAU4B,UAAU;YAAqB;eACrEtD,eAAec,UACf;gBAAC;gBAAe;aAAoB,CAACU,GAAG,CAAC,CAACE,OAAU,CAAA;oBAClD2B,KAAKjD;oBACLsB;oBACA4B,UAAU;gBACZ,CAAA,KACA,EAAE;SACP;QACD,MAAMpD,wBAAwBkD,UAAU;YAACzC;YAAKC;YAAQC;QAAO;QAE7D,wDAAwD;QACxD,MAAM0C,iBAAiB,MAAMlE,iBAAiBwB,SAAS;YAAC;YAAiB;SAAgB;QACzF,MAAM2C,QAAQD,eAAeE,MAAM,CAAC,CAACC,OAASA,KAAKC,MAAM,EAAEnC,GAAG,CAAC,CAACkC,OAASA,KAAKA,IAAI;QAElF,OAAO;YAACE,SAAS;gBAACzC;gBAAgB2B;gBAAMR,OAAOA,MAAM/B,IAAI;YAAE;YAAGiD;QAAK;IACrE;IACAnD;AACF,EAAC"}
@@ -0,0 +1,82 @@
1
+ import path from 'node:path';
2
+ import { getCliConfig, getLocalPackageVersion, isInteractive } from '@sanity/cli-core';
3
+ import { confirm } from '@sanity/cli-core/ux';
4
+ import { isWorkbenchApp } from '@sanity/workbench-cli';
5
+ import { installNewPackages } from '../../util/packageManager/installPackages.js';
6
+ import { getPackageManagerChoice } from '../../util/packageManager/packageManagerChoice.js';
7
+ import { upgradeRequiredPackages } from './upgradeRequiredPackages.js';
8
+ const MIN_SDK_VERSION = '3.15.0';
9
+ const purpose = 'Migrate Dashboard tiles, asset sources and web workers to plain default exports';
10
+ const description = `
11
+ Rewrites the tile, asset source and web worker files declared in sanity.cli.ts (or .js) from
12
+ \`unstable_defineView\` and \`unstable_defineService\` to plain default exports. Views read their
13
+ props with \`useTile\` and \`useAssetSource\` from \`@sanity/sdk-react/dashboard\`. Web workers
14
+ receive \`{bus, worker}\`, typed with \`WebWorkerProps\`. Panel views are left unchanged.
15
+
16
+ The migrated files import from @sanity/sdk-react, or from @sanity/sdk in projects that have only
17
+ web workers and no @sanity/sdk-react. Installs that package when it is missing and offers to
18
+ upgrade it when it is older than ${MIN_SDK_VERSION}.
19
+ `.trim();
20
+ export const dashboardViewsV1 = {
21
+ description,
22
+ filename: 'dashboardViewsV1.ts',
23
+ prepare: async ({ dry, output, workDir })=>{
24
+ const config = await getCliConfig(workDir);
25
+ if (!isWorkbenchApp(config.app)) {
26
+ throw new Error('This project is not a Dashboard application. Run `sanity codemod dashboard` first.');
27
+ }
28
+ const views = (config.app.views ?? []).filter((view)=>view.surface !== 'window');
29
+ const webWorkers = config.app.webWorkers ?? [];
30
+ const paths = [
31
+ ...views,
32
+ ...webWorkers
33
+ ].map(({ src })=>path.resolve(workDir, src));
34
+ if (paths.length === 0) {
35
+ throw new Error('sanity.cli.ts declares no views or web workers to migrate.');
36
+ }
37
+ const sdkPackage = views.length > 0 || await getLocalPackageVersion('@sanity/sdk-react', workDir) ? '@sanity/sdk-react' : '@sanity/sdk';
38
+ const listOnly = dry || !isInteractive();
39
+ if (!await getLocalPackageVersion(sdkPackage, workDir)) {
40
+ const install = `${sdkPackage}@^${MIN_SDK_VERSION}`;
41
+ if (listOnly || !await confirm({
42
+ default: true,
43
+ message: `Install ${install} now?`
44
+ })) {
45
+ output.log(`Install ${install} before you run \`sanity dev\`.`);
46
+ } else {
47
+ const { chosen } = await getPackageManagerChoice(workDir, {
48
+ interactive: false
49
+ });
50
+ await installNewPackages({
51
+ packageManager: chosen,
52
+ packages: [
53
+ install
54
+ ]
55
+ }, {
56
+ output,
57
+ workDir
58
+ });
59
+ }
60
+ }
61
+ await upgradeRequiredPackages([
62
+ {
63
+ min: MIN_SDK_VERSION,
64
+ name: sdkPackage,
65
+ neededBy: 'the migrated files need'
66
+ }
67
+ ], {
68
+ dry: listOnly,
69
+ output,
70
+ workDir
71
+ });
72
+ return {
73
+ options: {
74
+ sdkPackage
75
+ },
76
+ paths
77
+ };
78
+ },
79
+ purpose
80
+ };
81
+
82
+ //# sourceMappingURL=dashboardViewsV1.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/actions/codemods/dashboardViewsV1.ts"],"sourcesContent":["import path from 'node:path'\n\nimport {getCliConfig, getLocalPackageVersion, isInteractive} from '@sanity/cli-core'\nimport {confirm} from '@sanity/cli-core/ux'\nimport {isWorkbenchApp} from '@sanity/workbench-cli'\n\nimport {installNewPackages} from '../../util/packageManager/installPackages.js'\nimport {getPackageManagerChoice} from '../../util/packageManager/packageManagerChoice.js'\nimport {type CodeMod} from './types.js'\nimport {upgradeRequiredPackages} from './upgradeRequiredPackages.js'\n\nconst MIN_SDK_VERSION = '3.15.0'\n\nconst purpose = 'Migrate Dashboard tiles, asset sources and web workers to plain default exports'\nconst description = `\nRewrites the tile, asset source and web worker files declared in sanity.cli.ts (or .js) from\n\\`unstable_defineView\\` and \\`unstable_defineService\\` to plain default exports. Views read their\nprops with \\`useTile\\` and \\`useAssetSource\\` from \\`@sanity/sdk-react/dashboard\\`. Web workers\nreceive \\`{bus, worker}\\`, typed with \\`WebWorkerProps\\`. Panel views are left unchanged.\n\nThe migrated files import from @sanity/sdk-react, or from @sanity/sdk in projects that have only\nweb workers and no @sanity/sdk-react. Installs that package when it is missing and offers to\nupgrade it when it is older than ${MIN_SDK_VERSION}.\n`.trim()\n\nexport const dashboardViewsV1: CodeMod = {\n description,\n filename: 'dashboardViewsV1.ts',\n prepare: async ({dry, output, workDir}) => {\n const config = await getCliConfig(workDir)\n if (!isWorkbenchApp(config.app)) {\n throw new Error(\n 'This project is not a Dashboard application. Run `sanity codemod dashboard` first.',\n )\n }\n\n const views = (config.app.views ?? []).filter((view) => view.surface !== 'window')\n const webWorkers = config.app.webWorkers ?? []\n const paths = [...views, ...webWorkers].map(({src}) => path.resolve(workDir, src))\n if (paths.length === 0) {\n throw new Error('sanity.cli.ts declares no views or web workers to migrate.')\n }\n\n const sdkPackage =\n views.length > 0 || (await getLocalPackageVersion('@sanity/sdk-react', workDir))\n ? '@sanity/sdk-react'\n : '@sanity/sdk'\n const listOnly = dry || !isInteractive()\n\n if (!(await getLocalPackageVersion(sdkPackage, workDir))) {\n const install = `${sdkPackage}@^${MIN_SDK_VERSION}`\n\n if (listOnly || !(await confirm({default: true, message: `Install ${install} now?`}))) {\n output.log(`Install ${install} before you run \\`sanity dev\\`.`)\n } else {\n const {chosen} = await getPackageManagerChoice(workDir, {interactive: false})\n await installNewPackages({packageManager: chosen, packages: [install]}, {output, workDir})\n }\n }\n\n await upgradeRequiredPackages(\n [{min: MIN_SDK_VERSION, name: sdkPackage, neededBy: 'the migrated files need'}],\n {dry: listOnly, output, workDir},\n )\n\n return {options: {sdkPackage}, paths}\n },\n purpose,\n}\n"],"names":["path","getCliConfig","getLocalPackageVersion","isInteractive","confirm","isWorkbenchApp","installNewPackages","getPackageManagerChoice","upgradeRequiredPackages","MIN_SDK_VERSION","purpose","description","trim","dashboardViewsV1","filename","prepare","dry","output","workDir","config","app","Error","views","filter","view","surface","webWorkers","paths","map","src","resolve","length","sdkPackage","listOnly","install","default","message","log","chosen","interactive","packageManager","packages","min","name","neededBy","options"],"mappings":"AAAA,OAAOA,UAAU,YAAW;AAE5B,SAAQC,YAAY,EAAEC,sBAAsB,EAAEC,aAAa,QAAO,mBAAkB;AACpF,SAAQC,OAAO,QAAO,sBAAqB;AAC3C,SAAQC,cAAc,QAAO,wBAAuB;AAEpD,SAAQC,kBAAkB,QAAO,+CAA8C;AAC/E,SAAQC,uBAAuB,QAAO,oDAAmD;AAEzF,SAAQC,uBAAuB,QAAO,+BAA8B;AAEpE,MAAMC,kBAAkB;AAExB,MAAMC,UAAU;AAChB,MAAMC,cAAc,CAAC;;;;;;;;iCAQY,EAAEF,gBAAgB;AACnD,CAAC,CAACG,IAAI;AAEN,OAAO,MAAMC,mBAA4B;IACvCF;IACAG,UAAU;IACVC,SAAS,OAAO,EAACC,GAAG,EAAEC,MAAM,EAAEC,OAAO,EAAC;QACpC,MAAMC,SAAS,MAAMlB,aAAaiB;QAClC,IAAI,CAACb,eAAec,OAAOC,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U;YAAGL;QAAK;IACtC;IACAjB;AACF,EAAC"}
@@ -1,9 +1,11 @@
1
1
  import { dashboard } from './dashboard.js';
2
+ import { dashboardViewsV1 } from './dashboardViewsV1.js';
2
3
  import { deskRename } from './deskRename.js';
3
4
  import { partsTypeDirective } from './partsTypeDirective.js';
4
5
  import { reactIconsV3 } from './reactIconsV3.js';
5
6
  export const codemods = {
6
7
  dashboard,
8
+ 'dashboard-views-v1': dashboardViewsV1,
7
9
  deskRename,
8
10
  partsTypeDirective,
9
11
  reactIconsV3
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/actions/codemods/index.ts"],"sourcesContent":["import {dashboard} from './dashboard.js'\nimport {deskRename} from './deskRename.js'\nimport {partsTypeDirective} from './partsTypeDirective.js'\nimport {reactIconsV3} from './reactIconsV3.js'\n\nexport const codemods = {\n dashboard,\n deskRename,\n partsTypeDirective,\n reactIconsV3,\n}\n"],"names":["dashboard","deskRename","partsTypeDirective","reactIconsV3","codemods"],"mappings":"AAAA,SAAQA,SAAS,QAAO,iBAAgB;AACxC,SAAQC,UAAU,QAAO,kBAAiB;AAC1C,SAAQC,kBAAkB,QAAO,0BAAyB;AAC1D,SAAQC,YAAY,QAAO,oBAAmB;AAE9C,OAAO,MAAMC,WAAW;IACtBJ;IACAC;IACAC;IACAC;AACF,EAAC"}
1
+ {"version":3,"sources":["../../../src/actions/codemods/index.ts"],"sourcesContent":["import {dashboard} from './dashboard.js'\nimport {dashboardViewsV1} from './dashboardViewsV1.js'\nimport {deskRename} from './deskRename.js'\nimport {partsTypeDirective} from './partsTypeDirective.js'\nimport {reactIconsV3} from './reactIconsV3.js'\n\nexport const codemods = {\n dashboard,\n 'dashboard-views-v1': dashboardViewsV1,\n deskRename,\n partsTypeDirective,\n reactIconsV3,\n}\n"],"names":["dashboard","dashboardViewsV1","deskRename","partsTypeDirective","reactIconsV3","codemods"],"mappings":"AAAA,SAAQA,SAAS,QAAO,iBAAgB;AACxC,SAAQC,gBAAgB,QAAO,wBAAuB;AACtD,SAAQC,UAAU,QAAO,kBAAiB;AAC1C,SAAQC,kBAAkB,QAAO,0BAAyB;AAC1D,SAAQC,YAAY,QAAO,oBAAmB;AAE9C,OAAO,MAAMC,WAAW;IACtBL;IACA,sBAAsBC;IACtBC;IACAC;IACAC;AACF,EAAC"}