Skip to content

Commit 4938f4c

Browse files
authored
Added adjustments to bring things more in-line (#48)
* Added adjustments to bring things more in-line * Removed repo dependency
1 parent d31f31b commit 4938f4c

File tree

4 files changed

+25
-10
lines changed

4 files changed

+25
-10
lines changed

build.gradle.kts

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,6 @@ subprojects {
6464
mavenCentral()
6565
google()
6666
jcenter()
67-
6867
}
6968

7069
var shouldSign = true
@@ -86,14 +85,22 @@ subprojects {
8685
into(file("$buildDir/node_module"))
8786
}
8887

88+
val unzipJar by registering(Copy::class) {
89+
val zipFile = File("$buildDir/libs", "${project.name}-js-${project.version}.jar")
90+
from(this.project.zipTree(zipFile))
91+
into("$buildDir/classes/kotlin/js/main/")
92+
}
93+
8994
val copyJS by registering {
95+
mustRunAfter("unzipJar", "copyPackageJson")
9096
doLast {
91-
val from = File("$buildDir/classes/kotlin/js/main/${project.name}.js")
97+
val from = File("$buildDir/classes/kotlin/js/main/${rootProject.name}-${project.name}.js")
9298
val into = File("$buildDir/node_module/${project.name}.js")
9399
into.createNewFile()
94-
into.writeText(from.readText()
95-
.replace("require('firebase-", "require('@gitlive/firebase-")
96-
// .replace("require('kotlinx-serialization-kotlinx-serialization-runtime')", "require('@gitlive/kotlinx-serialization-runtime')")
100+
into.writeText(
101+
from.readText()
102+
.replace("require('firebase-", "require('@gitlive/firebase-")
103+
// .replace("require('kotlinx-serialization-kotlinx-serialization-runtime')", "require('@gitlive/kotlinx-serialization-runtime')")
97104
)
98105
}
99106
}
@@ -103,17 +110,19 @@ subprojects {
103110
into(file("$buildDir/node_module"))
104111
}
105112

106-
107-
val publishToNpm by creating(Exec::class) {
108-
113+
val prepareForNpmPublish by registering {
109114
dependsOn(
115+
unzipJar,
110116
copyPackageJson,
111-
copyJS,
112117
copySourceMap,
113-
copyReadMe
118+
copyReadMe,
119+
copyJS
114120
)
121+
}
115122

123+
val publishToNpm by creating(Exec::class) {
116124
workingDir("$buildDir/node_module")
125+
isIgnoreExitValue = true
117126
if(Os.isFamily(Os.FAMILY_WINDOWS)) {
118127
commandLine("cmd", "/c", "npm publish")
119128
} else {

firebase-database/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ kotlin {
4242
moduleKind = "commonjs"
4343
}
4444
}
45+
nodejs()
46+
browser()
4547
}
4648
android {
4749
publishLibraryVariants("release", "debug")

firebase-firestore/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ kotlin {
3838
moduleKind = "commonjs"
3939
}
4040
}
41+
nodejs()
42+
browser()
4143
}
4244
android {
4345
publishLibraryVariants("release", "debug")

firebase-functions/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ kotlin {
3636
moduleKind = "commonjs"
3737
}
3838
}
39+
nodejs()
40+
browser()
3941
}
4042
android {
4143
publishLibraryVariants("release", "debug")

0 commit comments

Comments
 (0)