function outputStartupInformation(options) { const { updateInfo, version, address, networkAddress, managerTotalTime, previewTotalTime, } = options; const updateMessage = createUpdateMessage(updateInfo, version); const serveMessage = new Table({ chars: { top: '', 'top-mid': '', 'top-left': '', 'top-right': '', bottom: '', 'bottom-mid': '', 'bottom-left': '', 'bottom-right': '', left: '', 'left-mid': '', mid: '', 'mid-mid': '', right: '', 'right-mid': '', middle: '', }, paddingLeft: 0, paddingRight: 0, paddingTop: 0, paddingBottom: 0, }); serveMessage.push( ['Local:', chalk.cyan(address)], ['On your network:', chalk.cyan(networkAddress)] ); const timeStatement = previewTotalTime ? `${chalk.underline(prettyTime(managerTotalTime))} for manager and ${chalk.underline( prettyTime(previewTotalTime) )} for preview` : `${chalk.underline(prettyTime(managerTotalTime))}`; // eslint-disable-next-line no-console console.log( boxen( stripIndents` ${colors.green(`Storybook ${chalk.bold(version)} started`)} ${chalk.gray(timeStatement)} ${serveMessage.toString()}${updateMessage ? `\n\n${updateMessage}` : ''} `, { borderStyle: 'round', padding: 1, borderColor: '#F1618C' } ) ); }
function createUpdateMessage(updateInfo, version) { let updateMessage; try { updateMessage = updateInfo.success && semver.lt(version, updateInfo.data.latest.version) ? stripIndents` ${colors.orange( `A new version (${chalk.bold(updateInfo.data.latest.version)}) is available!` )} ${chalk.gray('Read full changelog here:')} ${chalk.gray.underline('https://git.io/fhFYe')} ` : ''; } catch (e) { updateMessage = ''; } return updateMessage; }