Class SingularNodePlugin

java.lang.Object
com.brunoritz.gradle.singularnode.SingularNodePlugin
All Implemented Interfaces:
org.gradle.api.Plugin<org.gradle.api.Project>

public class SingularNodePlugin extends Object implements org.gradle.api.Plugin<org.gradle.api.Project>
The Singular Node Installation plugin provides a single NodeJS/NPM/Yarn/PNPM installation throughout the entire project. Its intention is to reduce build time and complexity by only installing the tooling once and then allow any subproject to consume it. It further reduces complexity by forcing the project to use a single version of the tooling.

This plugin provides a nodeJs extension through which the aspects of the tooling setup con be configured. The extension is only available on the root project.

In order to simplify authoring of custom NPM/Yarn/PNPM task, the NpmTask, YarnTask and PnpmTask types are made available to the project via the extra properties NpmTask, YarnTask and PnpmTask. That eliminates the need to import the task type. With these properties in place, task authors can simply create new tasks using

 task customNpmTask(type: NpmTask) {
     // ...
 }
 task customYarnTask(type: YarnTask) {
     // ...
 }
 task customPnpmTask(type: PnpmTask) {
     // ...
 }
 

NodeJS is downloaded as a Gradle dependency. By default, https://nodejs.org/dist is used as distribution base.

Further details on the behavior can be found in the documentation of the tasks and the extension.

See Also:
  • Constructor Details

    • SingularNodePlugin

      public SingularNodePlugin()
  • Method Details

    • apply

      public void apply(org.gradle.api.Project project)
      Specified by:
      apply in interface org.gradle.api.Plugin<org.gradle.api.Project>