const prompt = require('../../../lib/prompt') const DEFAULT_SETTINGS = { auto_deploy: true, wait_for_ci: true, pull_requests: { enabled: true, auto_deploy: true, auto_destroy: true } } function * getSettings (yes, branch) { if (yes) { return DEFAULT_SETTINGS } return yield prompt([{ type: 'confirm', name: 'auto_deploy', message: `Automatically deploy the ${branch} branch to staging?` }, { type: 'confirm', name: 'wait_for_ci', message: `Wait for CI to pass before deploying the ${branch} branch to staging?`, when (answers) { return answers.auto_deploy } }, { type: 'confirm', name: 'pull_requests.enabled', message: 'Enable review apps?' }, { type: 'confirm', name: 'pull_requests.auto_deploy', message: 'Automatically create review apps for every PR?', when (answers) { return answers.pull_requests.enabled } }, { type: 'confirm', name: 'pull_requests.auto_destroy', message: 'Automatically destroy idle review apps after 5 days?', when (answers) { return answers.pull_requests.enabled } }]) } module.exports = getSettings