From 2a3ea1d1c49ca32a017b0822b00e4a707b8eabfe Mon Sep 17 00:00:00 2001 From: sanderPostma Date: Mon, 28 Oct 2024 22:27:15 +0100 Subject: [PATCH] chore: also publish openid-federation-client --- .../openid-federation-client/build.gradle.kts | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/modules/openid-federation-client/build.gradle.kts b/modules/openid-federation-client/build.gradle.kts index f3ed7224..0e8da287 100644 --- a/modules/openid-federation-client/build.gradle.kts +++ b/modules/openid-federation-client/build.gradle.kts @@ -3,6 +3,8 @@ import org.jetbrains.kotlin.gradle.targets.js.webpack.KotlinWebpackConfig plugins { alias(libs.plugins.kotlinMultiplatform) kotlin("plugin.serialization") version "2.0.0" + id("maven-publish") + id("dev.petuska.npm.publish") version "3.4.3" } val ktorVersion = "3.0.0-beta-2" @@ -31,6 +33,29 @@ kotlin { } } } + binaries.library() + compilations["main"].packageJson { + name = "@sphereon/openid-federation-client" + version = rootProject.extra["npmVersion"] as String + description = "OpenID Federation Client Library" + customField("description", "OpenID Federation Client Library") + customField("license", "Apache-2.0") + customField("author", "Sphereon International") + customField( + "repository", mapOf( + "type" to "git", + "url" to "https://github.com/Sphereon-Opensource/openid-federation" + ) + ) + + customField( + "publishConfig", mapOf( + "access" to "public" + ) + ) + + types = "./index.d.ts" + } } sourceSets { @@ -81,3 +106,22 @@ kotlin { } } } + +npmPublish { + registries { + register("npmjs") { + uri.set("https://registry.npmjs.org") + authToken.set(System.getenv("NPM_TOKEN") ?: "") + } + } + packages{ + named("js") { + packageJson { + "name" by "@sphereon/openid-federation-client" + "version" by rootProject.extra["npmVersion"] as String + } + scope.set("@sphereon") + packageName.set("openid-federation-client") + } + } +}