Skip to content

NpmPackTask

Summary

A task to pack a .tgz archive for the given package. Extends NpmExecTask.

The task can be created and configured in a build.gradle.kts file by registering it with correct type.

build.gradle.kts
1
2
3
4
5
tasks {
  register("name", dev.petuska.npm.publish.task.NpmPackTask::class) {
    ...
  }
}

Properties

Property Type Default When Kotlin plugin is present
packageDir DirectoryProperty
dry Boolean false
outputFile RegularFile $buildDir/packages/<scope>-<name>-<version>.tgz
Property CLI System/Gradle Environment
packageDir
dry --dry
outputFile --outputFile
build.gradle.kts
1
2
3
4
5
6
7
tasks {
  register("name", dev.petuska.npm.publish.task.NpmPackTask::class) {
    packageDir.set(layout.projectDirectory.dir("src/main/js"))
    dry.set(true)
    outputFile.set(layout.buildDirectory.dir("js/main"))
  }
}

packageDir

The directory where the assembled and ready-to-pack package is.

dry

Controls dry-tun mode for the execution. When enabled, npm pack command will be run with a switch that does everything it normally would except creating the tarball.

outputFile

Output file to pack the publication to.