NpmPackage

abstract class NpmPackage : WithGradleFactories, NamedInput, ExtensionAware

The main configuration for a package

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard

Package's npm dependencies.

Link copied to clipboard
@get:InputFiles
@get:PathSensitive(value = PathSensitivity.RELATIVE)
abstract val files: ConfigurableFileCollection

Files that should be assembled for this package

Link copied to clipboard
@get:Input
@get:Optional
abstract val main: Property<String>

Main js entry file. Can also be set via packageJsonFile, packageJsonTemplateFile or packageJson

Link copied to clipboard
@get:InputFile
@get:Optional
@get:PathSensitive(value = PathSensitivity.RELATIVE)
abstract val npmIgnore: RegularFileProperty

A location of the .npmignore file. Defaults to NpmPublishExtension.npmIgnore

Link copied to clipboard
@get:Optional
abstract val packageJson: Property<PackageJson>

package.json customisation container.

Link copied to clipboard
@get:InputFile
@get:Optional
@get:PathSensitive(value = PathSensitivity.RELATIVE)
abstract val packageJsonFile: RegularFileProperty

If set, fully disregards main, types&packageJson configurations. Used as-is.

Link copied to clipboard
@get:InputFile
@get:Optional
@get:PathSensitive(value = PathSensitivity.RELATIVE)
abstract val packageJsonTemplateFile: RegularFileProperty

Similar to packageJsonFile except allows the options to be overridden by the packageJson options.

Link copied to clipboard
@get:Input
abstract val packageName: Property<String>

NPM package name. Defaults to Project.getName.

Link copied to clipboard
@get:InputFile
@get:Optional
@get:PathSensitive(value = PathSensitivity.RELATIVE)
abstract val readme: RegularFileProperty

A location of the README.md file. If set, the file will be moved to package assembly root and renamed to README.md (regardless of the actual name). Defaults to NpmPublishExtension.readme

Link copied to clipboard
@get:Input
@get:Optional
abstract val scope: Property<String>

Optional npm scope. If set, the package name will be constructed as @{scope}/{packageName}. Defaults to NpmPublishExtension.organization.

Link copied to clipboard
@get:Input
@get:Optional
abstract val types: Property<String>

Main d.ts entry file. Can also be set via packageJsonFile, packageJsonTemplateFile or packageJson

Link copied to clipboard
@get:Input
abstract val version: Property<String>

NPM package version. Defaults to NpmPublishExtension.version.

Functions

Link copied to clipboard
fun dependencies(action: Action<NpmDependencies>)

Convenience DSL to configure package's dependencies

Link copied to clipboard
fun NpmDependencies.dependency(name: String, version: String, type: NpmDependency.Type, action: Action<NpmDependency> = Action { }): NamedDomainObjectProvider<NpmDependency>

Registers an arbitrary npm dependency for the package

Link copied to clipboard
fun NpmDependencies.dev(name: String, version: String, action: Action<NpmDependency> = Action { }): NamedDomainObjectProvider<NpmDependency>

Registers a dev npm dependency for the package

Link copied to clipboard
fun files(action: Action<ConfigurableFileCollection>)

Convenience DSL to configure package's files

Link copied to clipboard
@Internal
abstract fun getExtensions(): ExtensionContainer
Link copied to clipboard
@Input
abstract override fun getName(): String
Link copied to clipboard
fun NpmDependencies.normal(name: String, version: String, action: Action<NpmDependency> = Action { }): NamedDomainObjectProvider<NpmDependency>

Registers a normal npm dependency for the package

Link copied to clipboard
fun NpmDependencies.optional(name: String, version: String, action: Action<NpmDependency> = Action { }): NamedDomainObjectProvider<NpmDependency>

Registers an optional npm dependency for the package

Link copied to clipboard
fun packageJson(action: Action<PackageJson>)

Convenience DSL to customise package.json

Link copied to clipboard
fun NpmDependencies.peer(name: String, version: String, action: Action<NpmDependency> = Action { }): NamedDomainObjectProvider<NpmDependency>

Registers a peer npm dependency for the package