{"size": 622, "ext": "js", "max_stars_repo_path": "src/data.js", "max_stars_repo_name": "lirenhao/myinfo_server", "max_stars_repo_stars_event_min_datetime": "2018-10-10T09:20:49.000Z", "max_stars_repo_stars_event_max_datetime": "2018-10-10T09:20:49.000Z", "max_issues_repo_path": "src/data.js", "max_issues_repo_name": "lirenhao/myinfo_server", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/data.js", "max_forks_repo_name": "lirenhao/myinfo_server", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 22.2142857143, "max_line_length": 60, "alphanum_fraction": 0.6720257235}
const chokidar = require('chokidar')
const jsonfile = require('jsonfile')
const emitter = require('./emitter')

let clients = jsonfile.readFileSync('./data/clients.json')
let template = jsonfile.readFileSync('./data/template.json')

chokidar.watch('./data').on('change', (event, path) => {
  try {
    clients = jsonfile.readFileSync('./data/clients.json')
    template = jsonfile.readFileSync('./data/template.json')
  } catch (e) {
    emitter.emit('warn', e.message)
  }
})

const getClients = () => {
  return clients
}

const getTemplate = () => {
  return template
}

module.exports = {
  getClients,
  getTemplate
}