backend-manager 5.0.115 → 5.0.116
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.
package/package.json
CHANGED
|
@@ -20,6 +20,11 @@ class BemConfigTest extends BaseTest {
|
|
|
20
20
|
|
|
21
21
|
// Loop through all the keys in the template
|
|
22
22
|
powertools.getKeys(bemConfigTemplate).forEach((key) => {
|
|
23
|
+
// Skip if an ancestor is explicitly set to a non-object value (e.g. stripe: false)
|
|
24
|
+
if (this._isAncestorDisabled(key)) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
|
|
23
28
|
const userValue = _.get(this.self.bemConfigJSON, key, undefined);
|
|
24
29
|
|
|
25
30
|
// If the user value is undefined, then we need to set pass to false
|
|
@@ -43,6 +48,11 @@ class BemConfigTest extends BaseTest {
|
|
|
43
48
|
|
|
44
49
|
// Log what keys are missing
|
|
45
50
|
powertools.getKeys(bemConfigTemplate).forEach((key) => {
|
|
51
|
+
// Skip if an ancestor is explicitly set to a non-object value (e.g. stripe: false)
|
|
52
|
+
if (this._isAncestorDisabled(key)) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
46
56
|
const userValue = _.get(this.self.bemConfigJSON, key, undefined);
|
|
47
57
|
|
|
48
58
|
if (typeof userValue === 'undefined') {
|
|
@@ -54,6 +64,24 @@ class BemConfigTest extends BaseTest {
|
|
|
54
64
|
|
|
55
65
|
throw new Error('Missing required backend-manager-config.json keys');
|
|
56
66
|
}
|
|
67
|
+
/**
|
|
68
|
+
* Check if any ancestor of a dot-notation key is a non-object value (e.g. false)
|
|
69
|
+
* This means the key is intentionally disabled, not missing
|
|
70
|
+
*/
|
|
71
|
+
_isAncestorDisabled(key) {
|
|
72
|
+
const parts = key.split('.');
|
|
73
|
+
let current = this.self.bemConfigJSON;
|
|
74
|
+
|
|
75
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
76
|
+
current = current?.[parts[i]];
|
|
77
|
+
|
|
78
|
+
if (current !== undefined && current !== null && typeof current !== 'object') {
|
|
79
|
+
return true;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return false;
|
|
84
|
+
}
|
|
57
85
|
}
|
|
58
86
|
|
|
59
87
|
module.exports = BemConfigTest;
|