[Gradle, JS] Fix upper case names in js files, decamelize instead

^KT-43237 fixed
This commit is contained in:
Ilya Goncharov
2020-12-24 13:01:55 +03:00
parent 9c67d8f89e
commit 0bd4de65e1
@@ -127,6 +127,12 @@ open class NpmProject(@Transient val compilation: KotlinJsCompilation) {
val targetName = if (target.name.isNotEmpty() && target.name.toLowerCase() != "js") {
target.name
.replace(DECAMELIZE_REGEX) {
it.groupValues
.drop(1)
.joinToString(prefix = "-", separator = "-")
}
.toLowerCase()
} else null
return sequenceOf(
@@ -146,5 +152,7 @@ open class NpmProject(@Transient val compilation: KotlinJsCompilation) {
const val PRE_PACKAGE_JSON = "pre-package.json"
const val NODE_MODULES = "node_modules"
const val DIST_FOLDER = "kotlin"
private val DECAMELIZE_REGEX = "([A-Z])".toRegex()
}
}