Commit e7f15903 authored by Philipp Nowinski's avatar Philipp Nowinski
Browse files

[FEATURE] add hooks for custom log messages + parse additional config

file in sgc-scripts
parent 7d5a2c64
......@@ -79,12 +79,19 @@ class Settings {
* Returns the sgc-config object
*/
static parseConfig() {
try {
fs.statSync('./sgc-core/gulp/config.json');
return require('./config.json');
} catch (exception) {
return require('../../.sgc-config.json');
let scriptsConfig;
let projectConfig;
let mergedConfig;
if (fs.existsSync('../sgc-scripts/.sgc-config.json')) {
scriptsConfig = require('../../sgc-scripts/.sgc-config.json');
}
projectConfig = require('../../.sgc-config.json');
if (scriptsConfig) {
mergedConfig = Object.assign(projectConfig, scriptsConfig);
} else {
mergedConfig = projectConfig;
}
return mergedConfig;
}
/**
......
......@@ -56,6 +56,13 @@ module.exports = class Images extends Task {
} catch (error) {
this._handleError(error);
}
if (
this._config.hasOwnProperty('logMessages')
&& this._config.logMessages.hasOwnProperty('images:uploadedSuccess')
) {
let messageConfig = this._config.logMessages['images:uploadedSuccess'];
this._logger[messageConfig.level](messageConfig.message);
}
this._logger.info(`Task ${chalk.bold('images')} finished after ${this.getElapsed(hirestime.S)}s`);
resolve();
});
......@@ -73,6 +80,13 @@ module.exports = class Images extends Task {
} catch (error) {
this._handleError(error);
}
if (
this._config.hasOwnProperty('logMessages')
&& this._config.logMessages.hasOwnProperty('imagesSuccess')
) {
let messageConfig = this._config.logMessages['imagesSuccess'];
this._logger[messageConfig.level](messageConfig.message);
}
this._logger.info(`Task ${chalk.bold('images')} finished after ${this.getElapsed(hirestime.S)}s`);
resolve();
});
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment