import path from 'path' ; import logger from '../logger' ; import resolveNodeModuleDir from '../resolveNodeModuleDir' ; import getLatestRelease from './getLatestRelease' ; import printNewRelease from './printNewRelease' ; export default async function releaseChecker ( root ) { try { const { version : currentVersion } = require ( path . join ( resolveNodeModuleDir ( root , 'react-native' ) , 'package.json' ) ) ; const { name } = require ( path . join ( root , 'package.json' ) ) ; const latestRelease = await getLatestRelease ( name , currentVersion ) ; if ( latestRelease ) { printNewRelease ( name , latestRelease , currentVersion ) ; } } catch ( e ) { logger . debug ( 'Cannot detect current version of React Native, ' + 'skipping check for a newer release' ) ; logger . debug ( e ) ; } }