<commit_before>'use strict';
const app = require('electron').app;
const fs = require('fs');
const path = require('path');
const configFile = path.join(app.getPath('userData'), 'config.json');

function readConfigFile() {
  try {
    return JSON.parse(fs.readFileSync(configFile));
  } catch (err) {
    return {};
  }
}

module.exports = {
  set: (key, value) => {
    const config = readConfigFile();
    config[key] = value;
    fs.writeFileSync(configFile, JSON.stringify(config));
  },
  get: key => readConfigFile()[key]
};
<commit_msg>use electron-config<commit_after>'use strict';

const Config = require('electron-config');

module.exports = new Config({
  defaults: {
    darkMode: false,
    closeToTray: false,
    minimizeToTray: false
  }
});

{'fraction_non_alphanumeric': 0.16534391534391535, 'fraction_numerical': 0.0, 'mean_word_length': 4.293706293706293, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6141659', 'n_tokens_mistral': 247, 'n_tokens_neox': 245, 'n_words': 53}