Skip to content

Commit bf39e53

Browse files
committed
feat(deploy): add solutions to the studio and app deploy-target checks
Populates `solution` for the remaining blockers: missing organization/project id, external-host misuse, an unresolved studio/app target, and a non-deployable federated app. The dry-run report lists each under its problem.
1 parent 9b334de commit bf39e53

3 files changed

Lines changed: 28 additions & 8 deletions

File tree

packages/@sanity/cli/src/actions/deploy/deployApp.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ async function runAppDeployment(options: DeployAppOptions, reporter: CheckReport
5555
reporter.report({
5656
exitCode: exitCodes.USAGE_ERROR,
5757
message: getErrorMessage(err),
58+
solution: 'Declare at least one entry, view, or service in the app',
5859
status: 'fail',
5960
})
6061
}
@@ -70,12 +71,20 @@ async function runAppDeployment(options: DeployAppOptions, reporter: CheckReport
7071
reporter.report(
7172
organizationId
7273
? {message: `Organization: ${organizationId}`, status: 'pass'}
73-
: {message: NO_ORGANIZATION_ID, status: 'fail'},
74+
: {
75+
message: NO_ORGANIZATION_ID,
76+
solution: 'Add `app.organizationId` to sanity.cli.ts',
77+
status: 'fail',
78+
},
7479
)
7580

7681
let application: UserApplication | null = null
7782
if (flags.external) {
78-
reporter.report({message: EXTERNAL_APP_NOT_SUPPORTED, status: 'fail'})
83+
reporter.report({
84+
message: EXTERNAL_APP_NOT_SUPPORTED,
85+
solution: 'Remove the --external flag — apps deploy to Sanity hosting',
86+
status: 'fail',
87+
})
7988
} else {
8089
application = await resolveAppApplication(options)
8190
}

packages/@sanity/cli/src/actions/deploy/deployChecks.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -291,12 +291,20 @@ export async function checkStudioTarget(
291291
return
292292
}
293293
case 'invalid': {
294-
reporter.report({message: resolution.message, status: 'fail'})
294+
reporter.report({
295+
message: resolution.message,
296+
solution: 'Check `studioHost` and `deployment.appId` in sanity.cli.ts',
297+
status: 'fail',
298+
})
295299
return
296300
}
297301
case 'needs-input': {
298302
// The same constraint an unattended deploy enforces, with the same message
299-
reporter.report({message: cannotPromptForStudioHost(isExternal), status: 'fail'})
303+
reporter.report({
304+
message: cannotPromptForStudioHost(isExternal),
305+
solution: 'Set `studioHost` in sanity.cli.ts, or pass a hostname with --url',
306+
status: 'fail',
307+
})
300308
return
301309
}
302310
case 'would-create': {

packages/@sanity/cli/src/actions/deploy/deployStudio.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ async function runStudioDeployment(
5353
// --external skips.
5454
reporter.report({
5555
exitCode: exitCodes.USAGE_ERROR,
56-
message:
57-
'Deploying a federated application to an external host is not yet supported. ' +
58-
'Remove the `--external` flag to deploy to Sanity hosting.',
56+
message: 'Deploying a federated application to an external host is not yet supported',
57+
solution: 'Remove the --external flag to deploy to Sanity hosting',
5958
status: 'fail',
6059
})
6160
}
@@ -68,7 +67,11 @@ async function runStudioDeployment(
6867
reporter.report(
6968
projectId
7069
? {message: `Project: ${projectId}`, status: 'pass'}
71-
: {message: NO_PROJECT_ID, status: 'fail'},
70+
: {
71+
message: NO_PROJECT_ID,
72+
solution: 'Add `api.projectId` to sanity.cli.ts',
73+
status: 'fail',
74+
},
7275
)
7376

7477
const application = await resolveStudioApplication(options)

0 commit comments

Comments
 (0)