import prompts from 'prompts' import { getLatestVersion } from '../Version/getLatestVersion' import { isVersionLatest } from '../Version/isVersionLatest' import updateAllPackages from './updateAllPackages' export const Update = async () => { const versionIsLatest = await isVersionLatest() if (versionIsLatest === false) { const deploymentOptions: prompts.Choice[] = [ { title: 'wappi -> to the latest version', value: 'wappi' }, { title: 'All npm packages', value: 'all' }, ] const updateWhat = await prompts( { type: 'select', name: 'q', message: 'What would you like to update?', choices: deploymentOptions, }, ) if (updateWhat.q === 'all') { updateAllPackages() } else { await getLatestVersion() } } else { updateAllPackages() } } export default Update