UNPKG

@gameroom/cli

Version:

A command line tool for Gameroom

22 lines (17 loc) 689 B
const { existsSync, readFileSync, writeFileSync } = require('fs'), { homedir } = require('os'), { join } = require('path'), { config } = require('../refs') let setup = false module.exports = (options) => { if (setup) return const path = join(homedir(), '.gameroom', `${process.env.NODE_ENV === 'development' ? 'dev_' : ''}config.json`) const data = existsSync(path) ? JSON.parse(readFileSync(path)) : {} Object.assign(config, data) // process.on('exit', () => { // config.exit_gracefully = false //always reset exit gracefully // config.should_exit = false //always reset should_ exit // writeFileSync(path, JSON.stringify(config)) // }) setup = true }