Package 

Class NodeExtension

    • Constructor Detail

      • NodeExtension

        NodeExtension(Project project)
    • Method Detail

      • getWorkDir

         final DirectoryProperty getWorkDir()

        The directory where Node.js is unpacked (when download is true)

      • getNpmWorkDir

         final DirectoryProperty getNpmWorkDir()

        The directory where npm is installed (when a specific version is defined)

      • getPnpmWorkDir

         final DirectoryProperty getPnpmWorkDir()

        The directory where pnpm is installed (when a pnpm task is used)

      • getYarnWorkDir

         final DirectoryProperty getYarnWorkDir()

        The directory where yarn is installed (when a Yarn task is used)

      • getBunWorkDir

         final DirectoryProperty getBunWorkDir()

        The directory where Bun is installed (when a Bun task is used)

      • getNodeProjectDir

         final DirectoryProperty getNodeProjectDir()

        The Node.js project directory location This is where the package.json file and node_modules directory are located By default it is at the root of the current project

      • getVersion

         final Property<String> getVersion()

        Version of node to download and install (only used if download is true) It will be unpacked in the workDir

      • getNpmVersion

         final Property<String> getNpmVersion()

        Version of npm to use If specified, installs it in the npmWorkDir If empty, the plugin will use the npm command bundled with Node.js

      • getPnpmVersion

         final Property<String> getPnpmVersion()

        Version of pnpm to use Any pnpm task first installs pnpm in the pnpmWorkDir It uses the specified version if defined and the latest version otherwise (by default)

      • getYarnVersion

         final Property<String> getYarnVersion()

        Version of Yarn to use Any Yarn task first installs Yarn in the yarnWorkDir It uses the specified version if defined and the latest version otherwise (by default)

      • getBunVersion

         final Property<String> getBunVersion()

        Version of Bun to use Any Bun task first installs Bun in the bunWorkDir It uses the specified version if defined and the latest version otherwise (by default)

      • getDistBaseUrl

         final Property<String> getDistBaseUrl()

        Base URL for fetching node distributions Only used if download is true Change it if you want to use a mirror Or set to null if you want to add the repository on your own.

      • getAllowInsecureProtocol

         final Property<Boolean> getAllowInsecureProtocol()

        Specifies whether it is acceptable to communicate with the Node.js repository over an insecure HTTP connection. Only used if download is true Change it to true if you use a mirror that uses HTTP rather than HTTPS Or set to null if you want to use Gradle's default behaviour.

      • getNpmInstallCommand

         final Property<String> getNpmInstallCommand()

        The npm command executed by the npmInstall task By default it is install but it can be changed to ci

      • getDownload

         final Property<Boolean> getDownload()

        Whether to download and install a specific Node.js version or not If false, it will use the globally installed Node.js If true, it will download node using above parameters Note that npm is bundled with Node.js

      • getNodeProxySettings

         final Property<ProxySettings> getNodeProxySettings()

        Whether the plugin automatically should add the proxy configuration to npm and yarn commands according the proxy configuration defined for Gradle

        Disable this option if you want to configure the proxy for npm or yarn on your own (in the .npmrc file for instance)

      • getFastNpmInstall

         final Property<Boolean> getFastNpmInstall()

        Use fast NpmInstall logic, excluding node_modules for output tracking resulting in a significantly faster npm install/ci configuration at the cost of slightly decreased correctness in certain circumstances.

        In practice this means that if you change node_modules through other means than npm install/ci NpmInstall tasks will continue being up-to-date, but if you're modifying node_modules through other tools you may have other correctness problems and surfacing them here may be preferred.

        https://docs.npmjs.com/cli/v8/configuring-npm/package-lock-json#hidden-lockfiles

        Requires npm 7 or later This will become the default in 4.x

      • getOldNpm

         final Property<Boolean> getOldNpm()

        Disable functionality that requires newer versions of npm

        If you're not downloading Node.js and using old version of Node or npm set this to true to disable functionality that makes use of newer functionality.

        This will be removed in 4.x

      • getEnableTaskRules

         final Property<Boolean> getEnableTaskRules()

        Create rules for automatic task creation

        Disabling this will prevent the npm_ npx_ yarn_ pnpm_ tasks from being automatically created. It's recommended to turn this off after you've gotten comfortable with the plugin and register your own tasks instead of relying on the rule.

      • getComputedNodeDir

         final DirectoryProperty getComputedNodeDir()

        Computed path to nodejs directory

      • getResolvedNodeDir

         final DirectoryProperty getResolvedNodeDir()

        Computed path to nodejs directory