Skip to content

Extension

Summary

The plugin registers a top level npmPublish: NpmPublishExtension extension for the project as a main entrypoint for most of the plugin configuration options.

The extension can be accessed and configured from a build.gradle.kts file by invoking its name.

build.gradle.kts
1
2
3
npmPublish {
  ...
}

Properties

Property Type Default When Kotlin plugin is present
nodeHome Directory NODE_HOME env variable kotlinNodeJsSetup task output
readme RegularFile
npmIgnore RegularFile $projectDir/.npmignore
organization String
version String Project::version
access NpmAccess NpmAccess.PUBLIC
dry Boolean false
packages NpmPackages
registries NpmRegistries
Property CLI System/Gradle Environment
nodeHome npm.publish.nodeHome NPM_PUBLISH_NODEHOME
readme npm.publish.readme NPM_PUBLISH_README
npmIgnore npm.publish.npmIgnore NPM_PUBLISH_NPMIGNORE
organization npm.publish.organization NPM_PUBLISH_ORGANIZATION
version npm.publish.version NPM_PUBLISH_VERSION
access npm.publish.access NPM_PUBLISH_ACCESS
dry npm.publish.dry NPM_PUBLISH_DRY
packages
registries
build.gradle.kts
npmPublish {
  nodeHome.set(File("/path/to/node"))
  readme.set(rootDir.resolve("README.md"))
  npmIgnore.set(projectDir.resolve(".npmIgnore"))
  organization.set("${project.group}")
  version.set("${project.version}")
  access.set(RESTRICTED)
  dry.set(true)
  packages {
    ...
  }
  registries {
    ...
  }
}

nodeHome

Default NodeJS directory to be used when executing npm commands.

Info

This is set automatically when certain other plugins are applied - org.jetbrains.kotlin.multiplatform & org.jetbrains.kotlin.js: kotlinNodeJsSetup task output - com.netflix.nebula:nebula-node-plugin: nodeSetup task output

readme

A location of the default README.md file. If set, it will be used as a default for all packages that do not have one set explicitly. The file name is ignored and renamed to README.md when assembling.

npmIgnore

A location of the default .npmignore file. If set, it will be used as a default for all packages that do not have one set explicitly.

organization

Default package scope. If set, it will be used as a default for all packages that do not have one set explicitly.

version

Default package version. If set, it will be used as a default for all packages that do not have one set explicitly.

access

Default package access when publishing to npm registries. More info

dry

Specifies if a dry-run should be added to the npm command arguments by default. Dry run does all the normal run does, but without making any modifications to local or remote files.

packages

A container for npm package configurations. See Package for detailed description of the container entities.

registries

A container for npm registry configurations. See Registry for detailed description of the container entities.