@oroinc/oro-webpack-config-builder 6.1.0-lts07 → 6.1.0-lts08
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -2,25 +2,7 @@ const path = require('path');
|
|
|
2
2
|
const merge = require('deepmerge');
|
|
3
3
|
const ModulesConfigLoader = require('./modules-config-loader');
|
|
4
4
|
|
|
5
|
-
const arrayMerge = (target, source) => target.concat(source.filter(item => !target.includes(item)));
|
|
6
|
-
|
|
7
5
|
class LayoutModulesConfigLoader extends ModulesConfigLoader {
|
|
8
|
-
/**
|
|
9
|
-
* @inheritdoc
|
|
10
|
-
*/
|
|
11
|
-
_collectThemes(themesLocation, themeInfoFileName) {
|
|
12
|
-
const themes = super._collectThemes(themesLocation, themeInfoFileName);
|
|
13
|
-
|
|
14
|
-
for (const [name] of Object.entries(themes)) {
|
|
15
|
-
const {parent: parentTheme} = themes[name];
|
|
16
|
-
if (typeof parentTheme === 'string') {
|
|
17
|
-
themes[name] = merge(themes[parentTheme], themes[name], {arrayMerge});
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
return themes;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
6
|
/**
|
|
25
7
|
* @inheritdoc
|
|
26
8
|
*/
|
|
@@ -3,6 +3,7 @@ const fs = require('fs');
|
|
|
3
3
|
const merge = require('deepmerge');
|
|
4
4
|
const yaml = require('js-yaml');
|
|
5
5
|
const validation = require('../validation');
|
|
6
|
+
|
|
6
7
|
// merge only unique items
|
|
7
8
|
const arrayMerge = (target, source) => target.concat(source.filter(item => !target.includes(item)));
|
|
8
9
|
|
|
@@ -51,25 +52,25 @@ class ModulesConfigLoader {
|
|
|
51
52
|
themesLocation = [themesLocation];
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
|
|
55
|
+
const themes = {};
|
|
56
|
+
const self = this;
|
|
55
57
|
themesLocation.forEach(themesLocation => {
|
|
56
|
-
|
|
58
|
+
self._collectThemes(themes, themesLocation, themeInfoFileName);
|
|
57
59
|
});
|
|
58
60
|
|
|
59
|
-
this._themes =
|
|
61
|
+
this._themes = themes;
|
|
60
62
|
this._processedFiles = [];
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
/**
|
|
64
66
|
* Collects list of themes with their parents into given storage(themes param)
|
|
65
67
|
*
|
|
68
|
+
* @param {Object} themes
|
|
66
69
|
* @param {string} themesLocation
|
|
67
70
|
* @param {string} themeInfoFileName
|
|
68
71
|
* @private
|
|
69
|
-
* @returns {Object.<string|null>}
|
|
70
72
|
*/
|
|
71
|
-
_collectThemes(themesLocation, themeInfoFileName) {
|
|
72
|
-
const themes = {};
|
|
73
|
+
_collectThemes(themes, themesLocation, themeInfoFileName) {
|
|
73
74
|
this._processedFiles = [];
|
|
74
75
|
|
|
75
76
|
this._bundles.forEach(bundle => {
|
|
@@ -82,7 +83,9 @@ class ModulesConfigLoader {
|
|
|
82
83
|
if (!fs.lstatSync(themePath).isDirectory()) {
|
|
83
84
|
return;
|
|
84
85
|
}
|
|
86
|
+
|
|
85
87
|
const themeFile = path.resolve(themePath, themeInfoFileName);
|
|
88
|
+
|
|
86
89
|
if (!fs.existsSync(themeFile)) {
|
|
87
90
|
return;
|
|
88
91
|
}
|
|
@@ -96,8 +99,6 @@ class ModulesConfigLoader {
|
|
|
96
99
|
themes[name] = merge(themes[name] || {}, doc, {arrayMerge});
|
|
97
100
|
});
|
|
98
101
|
});
|
|
99
|
-
|
|
100
|
-
return themes;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
/**
|
package/package.json
CHANGED