Skip to content
This repository has been archived by the owner on Aug 5, 2018. It is now read-only.

Commit

Permalink
Cleaned up Config service
Browse files Browse the repository at this point in the history
  • Loading branch information
Johann Behr committed Apr 28, 2018
1 parent 9f2c134 commit 349a46b
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/services/Config/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@ import path from 'path'
// import Notification from '../Notification'
import Essential from '../Essential'

var packageInfo = require('../../../package.json')

var notProduction = process.env.NODE_ENV !== 'production'
var createDir = (path) => {
if (!fs.existsSync(path)) {
fs.mkdirSync(path)
}
}

// Paths

var packageInfo = require('../../../package.json')
var dir = path.join(os.homedir(), '.' + packageInfo.name)
if (notProduction) {

// Deciding if dev enviroment
if (process.env.NODE_ENV !== 'production') {
dir = path.join(os.homedir(), '.' + packageInfo.name + '_dev')
}
createDir(dir)
Expand Down Expand Up @@ -93,6 +94,12 @@ export default {
}
},

/**
* Check if dir exists, if not create it.
*
* @param {String} path
* @return {Bool}
*/
_exist (path) {
if (fs.existsSync(path)) {
return true
Expand Down

0 comments on commit 349a46b

Please sign in to comment.