Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
25 changes: 16 additions & 9 deletions npm-publish-docs/src/pages/user-guide/tasks/NpmPublishTask.md
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
...
}
}
```

Expand All @@ -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"

Expand All @@ -43,6 +45,7 @@ tasks {
packageDir.set(layout.projectDirectory.dir("src/main/js"))
dry.set(true)
tag.set("latest")
strictSsl.set(false)
}
}
```
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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<String>

/**
* 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<Boolean>

/**
* Configuration DSL allowing to modify a registry config
* @param action to apply
Expand Down Expand Up @@ -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" }
Expand Down