I am making some kotlin JS wrappers for Firebase Javascript SDK. So I created the project with the external keyword and @file:JsModule annotation, something like that:
@file:JsModule("@firebase/messaging-types")
package my.package.firebase.messaging
import kotlin.js.Promise
external class FirebaseMessaging {
fun getToken(): Promise<String?>
...
}
I can publish it to my local maven repository with this in my gradle:
task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
artifacts {
archives sourcesJar
}
publishing {
publications {
mavenJava(MavenPublication) {
groupId = project.group
artifactId = 'firebase-wrappers'
version = project.version
from components.java
artifact sourcesJar
}
}
}
How can I add NPM dependencies and make sure it will be available on the generated JAR file?