[Gradle, JS] Hack for GSON to get non-null values

This commit is contained in:
Ilya Goncharov
2019-12-11 19:36:12 +03:00
parent 53480c2266
commit 7d98d33e3d
@@ -29,11 +29,26 @@ class PackageJson(
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>()
get() = field ?: mutableMapOf()
@Suppress("USELESS_ELVIS")
val dependencies = mutableMapOf<String, String>()
get() = field ?: mutableMapOf()
@Suppress("USELESS_ELVIS")
val peerDependencies = mutableMapOf<String, String>()
get() = field ?: mutableMapOf()
@Suppress("USELESS_ELVIS")
val optionalDependencies = mutableMapOf<String, String>()
get() = field ?: mutableMapOf()
@Suppress("USELESS_ELVIS")
val bundledDependencies = mutableListOf<String>()
get() = field ?: mutableListOf()
companion object {
fun scopedName(name: String): ScopedName = if (name.contains("/")) ScopedName(