@expo/config-plugins
Advanced tools
Comparing version 8.0.7 to 8.0.8
@@ -61,2 +61,3 @@ "use strict"; | ||
const oldPropIndex = gradleProperties.findIndex(prop => prop.type === 'property' && prop.key === name); | ||
const oldProp = oldPropIndex >= 0 ? gradleProperties[oldPropIndex] : null; | ||
if (value) { | ||
@@ -69,9 +70,23 @@ // found the matched value, add or merge new property | ||
}; | ||
if (oldPropIndex >= 0) { | ||
gradleProperties[oldPropIndex] = newProp; | ||
} else { | ||
gradleProperties.push(newProp); | ||
if (oldProp && oldProp.type === 'property') { | ||
try { | ||
const prevValue = JSON.parse(oldProp.value); | ||
const newValue = JSON.parse(value); | ||
if (Array.isArray(prevValue) && Array.isArray(newValue)) { | ||
const prevArrayWithStringifiedValues = prevValue.map(v => JSON.stringify(v)); | ||
const newArrayWithStringifiedValues = newValue.map(v => JSON.stringify(v)); | ||
const mergedValues = [...new Set([...prevArrayWithStringifiedValues, ...newArrayWithStringifiedValues])].map(v => JSON.parse(v)); | ||
oldProp.value = JSON.stringify(mergedValues); | ||
return gradleProperties; | ||
} | ||
} catch {} | ||
oldProp.value = value; | ||
return gradleProperties; | ||
} | ||
} else if (options?.removePropWhenValueIsNull && oldPropIndex >= 0) { | ||
gradleProperties.push(newProp); | ||
return gradleProperties; | ||
} | ||
if (options?.removePropWhenValueIsNull && oldPropIndex >= 0) { | ||
gradleProperties.splice(oldPropIndex, 1); | ||
return gradleProperties; | ||
} | ||
@@ -78,0 +93,0 @@ return gradleProperties; |
{ | ||
"name": "@expo/config-plugins", | ||
"version": "8.0.7", | ||
"version": "8.0.8", | ||
"description": "A library for Expo config plugins", | ||
@@ -61,3 +61,3 @@ "main": "build/index.js", | ||
}, | ||
"gitHead": "c37efa4f4ebe6137c34eb5813843df7015f3c22f" | ||
"gitHead": "48f1ec9d91c5c38c7684cb98a314e443cbeb2185" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1100283
12870