Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(cli): respect unattended mode #5659

Merged
merged 2 commits into from
Feb 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 20 additions & 10 deletions packages/@sanity/cli/src/actions/init-project/initProject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,11 +167,16 @@ export default async function initSanity(
print(`Coupon "${intendedCoupon}" validated!\n`)
} catch (err) {
if (err.statusCode == '404') {
const useDefaultPlan = await prompt.single({
type: 'confirm',
message: `Coupon "${intendedCoupon}" is not available, use default plan instead?`,
default: true,
})
const useDefaultPlan =
unattended ??
(await prompt.single({
type: 'confirm',
message: `Coupon "${intendedCoupon}" is not available, use default plan instead?`,
default: true,
}))
juice49 marked this conversation as resolved.
Show resolved Hide resolved
if (unattended) {
output.warn(`Coupon "${intendedCoupon}" is not available - using default plan`)
}
trace.log({
step: 'useDefaultPlanCoupon',
selectedOption: useDefaultPlan ? 'yes' : 'no',
Expand All @@ -191,11 +196,16 @@ export default async function initSanity(
selectedPlan = await getPlanFromId(apiClient, intendedPlan)
} catch (err) {
if (err.statusCode == '404') {
const useDefaultPlan = await prompt.single({
type: 'confirm',
message: `Project plan "${intendedPlan}" does not exist, use default plan instead?`,
default: true,
})
const useDefaultPlan =
unattended ??
(await prompt.single({
type: 'confirm',
message: `Project plan "${intendedPlan}" does not exist, use default plan instead?`,
default: true,
}))
juice49 marked this conversation as resolved.
Show resolved Hide resolved
if (unattended) {
output.warn(`Project plan "${intendedPlan}" does not exist - using default plan`)
}
trace.log({
step: 'useDefaultPlanId',
selectedOption: useDefaultPlan ? 'yes' : 'no',
Expand Down
Loading