[Gradle, JS] Hack for GSON to get non-null values
This commit is contained in:
+15
@@ -29,11 +29,26 @@ class PackageJson(
|
|||||||
|
|
||||||
var workspaces: Collection<String>? = null
|
var workspaces: Collection<String>? = null
|
||||||
|
|
||||||
|
// Gson set nulls reflective no matter on default values and non-null types
|
||||||
|
@Suppress("USELESS_ELVIS")
|
||||||
val devDependencies = mutableMapOf<String, String>()
|
val devDependencies = mutableMapOf<String, String>()
|
||||||
|
get() = field ?: mutableMapOf()
|
||||||
|
|
||||||
|
@Suppress("USELESS_ELVIS")
|
||||||
val dependencies = mutableMapOf<String, String>()
|
val dependencies = mutableMapOf<String, String>()
|
||||||
|
get() = field ?: mutableMapOf()
|
||||||
|
|
||||||
|
@Suppress("USELESS_ELVIS")
|
||||||
val peerDependencies = mutableMapOf<String, String>()
|
val peerDependencies = mutableMapOf<String, String>()
|
||||||
|
get() = field ?: mutableMapOf()
|
||||||
|
|
||||||
|
@Suppress("USELESS_ELVIS")
|
||||||
val optionalDependencies = mutableMapOf<String, String>()
|
val optionalDependencies = mutableMapOf<String, String>()
|
||||||
|
get() = field ?: mutableMapOf()
|
||||||
|
|
||||||
|
@Suppress("USELESS_ELVIS")
|
||||||
val bundledDependencies = mutableListOf<String>()
|
val bundledDependencies = mutableListOf<String>()
|
||||||
|
get() = field ?: mutableListOf()
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
fun scopedName(name: String): ScopedName = if (name.contains("/")) ScopedName(
|
fun scopedName(name: String): ScopedName = if (name.contains("/")) ScopedName(
|
||||||
|
|||||||
Reference in New Issue
Block a user