1
+ import dev.petuska.npm.publish.extension.domain.NpmAccess
1
2
import org.gradle.internal.os.OperatingSystem
2
3
import org.jetbrains.dokka.gradle.DokkaTask
3
4
import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackOutput.Target
@@ -10,6 +11,7 @@ plugins {
10
11
id(" io.github.luca992.multiplatform-swiftpackage" ) version " 2.0.5-arm64"
11
12
id(" com.android.library" )
12
13
id(" org.jetbrains.dokka" )
14
+ id(" dev.petuska.npm.publish" ) version " 3.4.1"
13
15
}
14
16
15
17
kotlin {
@@ -87,6 +89,7 @@ kotlin {
87
89
this .moduleName = currentModuleName
88
90
this .binaries.library()
89
91
this .useCommonJs()
92
+ generateTypeScriptDefinitions()
90
93
this .compilations[" main" ].packageJson {
91
94
this .version = rootProject.version.toString()
92
95
}
@@ -149,12 +152,13 @@ kotlin {
149
152
dependencies {
150
153
api(" fr.acinq.secp256k1:secp256k1-kmp:0.9.0" )
151
154
}
152
- val target = when {
153
- os.isLinux -> " linux"
154
- os.isMacOsX -> " darwin"
155
- os.isWindows -> " mingw"
156
- else -> error(" Unsupported OS $os " )
157
- }
155
+ val target =
156
+ when {
157
+ os.isLinux -> " linux"
158
+ os.isMacOsX -> " darwin"
159
+ os.isWindows -> " mingw"
160
+ else -> error(" Unsupported OS $os " )
161
+ }
158
162
implementation(" fr.acinq.secp256k1:secp256k1-kmp-jni-jvm-$target :0.9.0" )
159
163
implementation(" com.google.guava:guava:30.1-jre" )
160
164
implementation(" org.bouncycastle:bcprov-jdk15on:1.68" )
@@ -214,20 +218,18 @@ kotlin {
214
218
val macosArm64Test by getting { this .dependsOn(iosTest) }
215
219
}
216
220
// if (os.isWindows) {
217
- // // val mingwX86Main by getting // it depend on kotlinx-datetime lib to support this platform before we can support it as well
218
- // // val mingwX86Test by getting // it depend on kotlinx-datetime lib to support this platform before we can support it as well
219
221
// val mingwX64Main by getting
220
222
// val mingwX64Test by getting
221
223
// }
222
224
}
223
225
224
226
if (os.isMacOsX) {
225
227
tasks.getByName< org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest > (" iosX64Test" ) {
226
- deviceId = " iPhone 14 Plus"
228
+ device.set( " iPhone 14 Plus" )
227
229
}
228
230
if (System .getProperty(" os.arch" ) != " x86_64" ) { // M1Chip
229
231
tasks.getByName< org.jetbrains.kotlin.gradle.targets.native.tasks.KotlinNativeSimulatorTest > (" iosSimulatorArm64Test" ) {
230
- deviceId = " iPhone 14 Plus"
232
+ device.set( " iPhone 14 Plus" )
231
233
}
232
234
}
233
235
}
@@ -263,9 +265,7 @@ android {
263
265
tasks.withType<DokkaTask > {
264
266
moduleName.set(project.name)
265
267
moduleVersion.set(rootProject.version.toString())
266
- description = """
267
- This is a Kotlin Multiplatform Library for Base Asymmetric Encryption
268
- """ .trimIndent()
268
+ description = " This is a Kotlin Multiplatform Library for Base Asymmetric Encryption"
269
269
dokkaSourceSets {
270
270
// TODO: Figure out how to include files to the documentations
271
271
named(" commonMain" ) {
@@ -293,3 +293,33 @@ ktlint {
293
293
exclude { projectDir.toURI().relativize(it.file.toURI()).path.contains(" /external/" ) }
294
294
}
295
295
}
296
+
297
+ npmPublish {
298
+ organization.set(" input-output-hk" )
299
+ version.set(project.version.toString())
300
+ access.set(NpmAccess .PUBLIC )
301
+ packages {
302
+ access.set(NpmAccess .PUBLIC )
303
+ named(" js" ) {
304
+ scope.set(" input-output-hk" )
305
+ packageName.set(" apollo" )
306
+ packageJson {
307
+ author {
308
+ name.set(" IOG" )
309
+ }
310
+ repository {
311
+ type.set(" git" )
312
+ url.set(" https://github.com/input-output-hk/atala-prism-apollo.git" )
313
+ }
314
+ }
315
+ }
316
+ }
317
+ registries {
318
+ access.set(NpmAccess .PUBLIC )
319
+ github {
320
+ uri.set(" https://npm.pkg.github.com/" )
321
+ access.set(NpmAccess .PUBLIC )
322
+ this .authToken.set(System .getenv(" ATALA_GITHUB_TOKEN" ))
323
+ }
324
+ }
325
+ }
0 commit comments