const { read } = require('fs')
const readJsonFile = file => {
if (file.split('.')[file.split('.').length - 1] !== 'json') return {}
const fileContent = read(file)
if (!fileContent) return {}
return JSON.parse(fileContent)
}
readJsonFile('package.json')