[deploy] refactoring
This commit is contained in:
parent
b28919275f
commit
fa5c7bbb30
|
@ -102,20 +102,12 @@ module.exports = function(grunt) {
|
|||
}
|
||||
|
||||
function doRegisterInitializeAppTask(name, appName, configFile) {
|
||||
if ( !!process.env['EXTRA_CONFIG_PATH'] &&
|
||||
grunt.file.exists(process.env['EXTRA_CONFIG_PATH'] + '/' + configFile) )
|
||||
if (!!process.env['BRANDING_PATH'] &&
|
||||
grunt.file.exists(process.env['BRANDING_PATH'] + '/' + configFile))
|
||||
{
|
||||
var _extConfig = require(process.env['EXTRA_CONFIG_PATH'] + '/' + configFile);
|
||||
var _extConfig = require(process.env['BRANDING_PATH'] + '/' + configFile);
|
||||
}
|
||||
|
||||
return grunt.registerTask('init-build-' + name, 'Initialize build ' + appName, function(){
|
||||
defaultConfig = configFile;
|
||||
packageFile = require('./' + defaultConfig);
|
||||
|
||||
if (packageFile) {
|
||||
grunt.log.ok(appName + ' config loaded successfully'.green);
|
||||
|
||||
if ( !!_extConfig && _extConfig.name == packageFile.name ) {
|
||||
function _merge(target, ...sources) {
|
||||
if (!sources.length) return target;
|
||||
const source = sources.shift();
|
||||
|
@ -135,6 +127,14 @@ module.exports = function(grunt) {
|
|||
return _merge(target, ...sources);
|
||||
}
|
||||
|
||||
return grunt.registerTask('init-build-' + name, 'Initialize build ' + appName, function(){
|
||||
defaultConfig = configFile;
|
||||
packageFile = require('./' + defaultConfig);
|
||||
|
||||
if (packageFile) {
|
||||
grunt.log.ok(appName + ' config loaded successfully'.green);
|
||||
|
||||
if ( !!_extConfig && _extConfig.name == packageFile.name ) {
|
||||
_merge(packageFile, _extConfig);
|
||||
}
|
||||
} else grunt.log.error().writeln('Could not load config file'.red);
|
||||
|
|
Loading…
Reference in a new issue