Skip to content

Commit

Permalink
fix: make sure the config-file CLI args work together with the defaul…
Browse files Browse the repository at this point in the history
…t cosmic config behavior
  • Loading branch information
sghoweri committed Jul 2, 2019
1 parent 200bb63 commit 8a303b8
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions packages/build-tools/cli.js
Expand Up @@ -12,15 +12,7 @@ const configSchema = readYamlFileSync(
);
const packageJson = require('./package.json');

const searchedFor = explorer.searchSync();
if (!searchedFor.config) {
log.errorAndExit('Could not find config in a .boltrc file');
}

let userConfig = {
...searchedFor.config,
configFileUsed: searchedFor.filepath,
};
let userConfig;

// global `bolt` cli options & meta
program
Expand Down Expand Up @@ -48,6 +40,16 @@ if (program.configFile) {
...configFile,
configFileUsed: configFilePath,
};
} else {
try {
const searchedFor = explorer.searchSync();
userConfig = {
...searchedFor.config,
configFileUsed: searchedFor.filepath,
};
} catch (error) {
log.errorAndExit('Could not find config in a .boltrc file', error);
}
}

(async () => {
Expand Down

0 comments on commit 8a303b8

Please sign in to comment.