Skip to content

Commit

Permalink
Refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
ehmicky committed Aug 25, 2019
1 parent 8df4d66 commit f64fa96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/options/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,8 @@ import findUp from 'find-up'
import { loadYamlFile } from '../utils/yaml.js'

// Retrieve options from the configuration file (if any)
export const getConfig = async function({
opts: { config, ...opts },
opts: { cwd = getCwd() },
}) {
const configPath = await getConfigPath(config, cwd)
export const getConfig = async function({ config, ...opts }) {
const configPath = await getConfigPath(config, opts)

if (configPath === undefined) {
return opts
Expand All @@ -20,7 +17,7 @@ export const getConfig = async function({
return { ...configContent, ...opts }
}

const getConfigPath = async function(config, cwd) {
const getConfigPath = async function(config, { cwd = getCwd() }) {
if (config !== undefined) {
return resolve(cwd, config)
}
Expand Down
2 changes: 1 addition & 1 deletion src/options/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const getOpts = async function(action, opts = {}) {

validateOpts(optsA)

const optsB = await getConfig({ opts: optsA })
const optsB = await getConfig(optsA)
const optsC = addEnvVars(optsB)

validateOpts(optsC)
Expand Down

0 comments on commit f64fa96

Please sign in to comment.