Skip to content

Commit

Permalink
Added basic config file merging and intergrated user defined outDir
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchPierias committed May 5, 2019
1 parent f627d1d commit f22b5b2
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions src/configManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const CONFIG_FILE_PATH = path.join(CONFIG_DIRECTORY, 'config.json');
/** Default encoding */
const ENCODING = 'utf8';
/** Default build output directory */
const DEFAULT_OUTPUT_DIR = '.lamington/compiled_contracts';
const DEFAULT_OUTPUT_DIR = '.lamington';
/** Configuration file name */
const CONFIGURATION_FILE_NAME = '.lamingtonrc';

Expand Down Expand Up @@ -79,9 +79,14 @@ export class ConfigManager {
*/
public static async initWithDefaults() {
// Load existing configuration
const userConfig = await ConfigManager.readConfigFromProject();
const userConfig = {
outDir:DEFAULT_OUTPUT_DIR,
keepAlive:false,
exclude:[],
...await ConfigManager.readConfigFromProject()
}
// Check if configuration exists
if (!(await exists(CONFIG_FILE_PATH))) {
if (!(await ConfigManager.configExists())) {
// Create the config directory
await mkdirp(CONFIG_DIRECTORY);
// Fetch the latest repository configuration
Expand All @@ -103,6 +108,16 @@ export class ConfigManager {
await ConfigManager.loadConfigFromDisk();
}

/**
* Checks the existence of the configuration
* file at the default [[CONFIG_FILE_PATH]]
* @author Mitch Pierias <github.com/MitchPierias>
* @returns Config exists determiner
*/
public static async configExists() {
return await exists(CONFIG_FILE_PATH);
}

/**
* Loads the existing configuration file into [[ConfigManager.config]]
* @author Kevin Brown <github.com/thekevinbrown>
Expand Down

0 comments on commit f22b5b2

Please sign in to comment.