Frontend Gradle plugin - Integrated Node.js, npm, Yarn builds Latest release 5.0.0

This plugin allows to integrate into Gradle a build based on Node.js/npm/Yarn. It is inspired by the philosophy of the Frontend Maven plugin, an equivalent plugin for Maven. Follow the quick start guide, and build your frontend application. Take a look at the Release notes if you are migrating from a previous version.

Features

Distribution management

The plugin downloads and installs a Node.js distribution and/or a Yarn distribution when required. Optionally, a shared/global distribution may be used instead to avoid network overhead and duplication. The plugin may also use a HTTP proxy server for downloads, to take advantage of any caching facility, and submit to the organization's security rules. Basic authentication scheme is supported for both distribution and proxy servers.

Configurable dependencies installation

Depending on the environment, installing frontend dependencies using the package.json file may require a different command (e.g. npm ci).

Built-in tasks

No need to define tasks to build, clean, check, or publish the frontend application through Gradle lifecycle. The plugin provides ready-to-use tasks out of the box, and ensures their implementation matches Gradle's recommandations. Plug scripts from a package.json file with the DSL, and run gradlew build.

Customization

For more complex use cases, the plugin provides types to create tasks and run custom commands with Node.js, npm, npx, Yarn.

Under the hood
  • Lazy configuration: tasks configuration is delayed until necessary thanks to the use of Gradle lazy configuration API, to optimize performance of builds and ease chaining tasks I/O.
  • Self-contained domain design: the plugin design is influenced by clean coding principles. The domain layer is isolated from any framework and infrastructure. Writing cross-platform unit tests and maintaining the plugin is easier. Code coverage and predictability increase.