diff --git a/CHANGELOG.md b/CHANGELOG.md index 8060ca31..e9bc055c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ This is a maintenance release with a few minor bugfixes. - [Gradle configuration cache](https://docs.gradle.org/current/userguide/configuration_cache.html) support - New [Local TS consumer setup](./samples/local-ts-consumer/README.md) sample +- New `strictSsl` option for `NpmPublishTask` ### Changed diff --git a/npm-publish-docs/src/pages/user-guide/tasks/NpmPublishTask.md b/npm-publish-docs/src/pages/user-guide/tasks/NpmPublishTask.md index 71581bea..7383e47f 100644 --- a/npm-publish-docs/src/pages/user-guide/tasks/NpmPublishTask.md +++ b/npm-publish-docs/src/pages/user-guide/tasks/NpmPublishTask.md @@ -6,9 +6,9 @@ The task can be created and configured in a `build.gradle.kts` file by registeri ```kotlin title="build.gradle.kts" tasks { - register("name", dev.petuska.npm.publish.task.NpmPublishTask::class) { - ... - } + register("name", dev.petuska.npm.publish.task.NpmPublishTask::class) { + ... + } } ``` @@ -22,15 +22,17 @@ tasks { | [`packageDir`](#packagedir) | Directory | | | | [`dry`](#dry) | Boolean | false | | | [`tag`](#tag) | String | | | + | [`strictSsl`](#strictSsl) | Boolean | | | === "Keys" - | Property | CLI | System/Gradle | Environment | - |:--------------------------------|---------|:--------------|-------------| - | [`registry`](#registry) | | | | - | [`packageDir`](#destinationdir) | | | | - | [`dry`](#dry) | `--dry` | | | - | [`tag`](#tag) | `--tag` | | | + | Property | CLI | System/Gradle | Environment | + |:--------------------------------|----------------|:--------------|-------------| + | [`registry`](#registry) | | | | + | [`packageDir`](#destinationdir) | | | | + | [`dry`](#dry) | `--dry` | | | + | [`tag`](#tag) | `--tag` | | | + | [`strictSsl`](#strictSsl) | `--strict-ssl` | | | === "Usage" @@ -43,6 +45,7 @@ tasks { packageDir.set(layout.projectDirectory.dir("src/main/js")) dry.set(true) tag.set("latest") + strictSsl.set(false) } } ``` @@ -63,3 +66,7 @@ Controls dry-tun mode for the execution. Sets a tag to label published package version [More info](https://docs.npmjs.com/adding-dist-tags-to-packages) + +### `strictSsl` + +Controls strict SSL validation for network requests diff --git a/npm-publish-gradle-plugin/src/main/kotlin/task/NpmPublishTask.kt b/npm-publish-gradle-plugin/src/main/kotlin/task/NpmPublishTask.kt index d91cd662..2298930c 100644 --- a/npm-publish-gradle-plugin/src/main/kotlin/task/NpmPublishTask.kt +++ b/npm-publish-gradle-plugin/src/main/kotlin/task/NpmPublishTask.kt @@ -40,13 +40,22 @@ public abstract class NpmPublishTask : NpmExecTask() { /** * Optional tag to label the published package version - * @see [NpmPublishExtension.dry] + * [npm](https://docs.npmjs.com/adding-dist-tags-to-packages) */ @get:Input @get:Optional @get:Option(option = "tag", description = "Optional tag to label the published package version") public abstract val tag: Property + /** + * Optional tag to label the published package version + * [npm](https://docs.npmjs.com/adding-dist-tags-to-packages) + */ + @get:Input + @get:Optional + @get:Option(option = "strict-ssl", description = "Optional flag to enable or disable strict SSL") + public abstract val strictSsl: Property + /** * Configuration DSL allowing to modify a registry config * @param action to apply @@ -87,7 +96,7 @@ public abstract class NpmPublishTask : NpmExecTask() { if (reg.authToken.isPresent) add("--//$repo:_authToken=${reg.authToken.get()}") if (d) add("--dry-run") if (tag.isPresent) add("--tag=${tag.get()}") -// add("${uri.scheme.trim()}://$repo") + if (strictSsl.isPresent) add("--strict-ssl=${strictSsl.get()}") } npmExec(args) { it.workingDir(packageDir.get()) }.rethrowFailure() if (!d) info { "Published package at $pDir to ${reg.name} registry" }