Skip to content

Commit

Permalink
✨ Update configuration fallbacks
Browse files Browse the repository at this point in the history
  • Loading branch information
carloscuesta committed Sep 26, 2022
1 parent 8d2c88c commit ae84aa6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/utils/configurationVault/getConfiguration.js
@@ -1,5 +1,5 @@
import Conf from 'conf'
import { cwd } from 'process'
import { config, cwd } from 'process'
import pathExists from 'path-exists'

import { CONFIG, EMOJI_COMMIT_FORMATS } from '@constants/configuration'
Expand Down Expand Up @@ -30,12 +30,12 @@ const getConfiguration = (): { get: Function, set: Function } => {
const packageJson = `${cwd()}/package.json`
const configurationFile = `${cwd()}/.gitmojirc.json`

if (pathExists.sync(packageJson)) {
return require(packageJson).gitmoji || LOCAL_CONFIGURATION.store
if (pathExists.sync(packageJson) && require(packageJson)?.gitmoji) {
return require(packageJson).gitmoji
}

if (pathExists.sync(configurationFile)) {
return require(configurationFile) || LOCAL_CONFIGURATION.store
if (pathExists.sync(configurationFile) && require(configurationFile)) {
return require(configurationFile)
}

return LOCAL_CONFIGURATION.store
Expand Down

0 comments on commit ae84aa6

Please sign in to comment.