[build] extended deployment to load addons

This commit is contained in:
Maxim Kadushkin 2020-02-11 13:00:21 +03:00
parent e6d871f060
commit 5303f4958b

View file

@ -60,6 +60,14 @@ module.exports = function(grunt) {
to: process.env['PLUGIN_LINK_MACROS'] || 'https://api.onlyoffice.com/plugin/macros'
}];
let path = require('path');
let addons = grunt.option('addon') || [];
if (!Array.isArray(addons))
addons = [addons];
addons.forEach((element,index,self) => self[index] = '../../web-apps-' + element + '/build');
addons = addons.filter(element => grunt.file.isDir(element));
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-uglify');
@ -134,6 +142,14 @@ module.exports = function(grunt) {
if (packageFile) {
grunt.log.ok(appName + ' config loaded successfully'.green);
addons.forEach(element => {
let _path = path.join(element,configFile);
if (grunt.file.exists(_path)) {
_merge(packageFile, require(_path));
grunt.log.ok('addon '.green + element + ' is merged successfully'.green);
}
});
if ( !!_extConfig && _extConfig.name == packageFile.name ) {
_merge(packageFile, _extConfig);
}