-
- All Implemented Interfaces:
public class NodeExtension
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public class
NodeExtension.Companion
-
Field Summary
Fields Modifier and Type Field Description private final DirectoryProperty
workDir
private final DirectoryProperty
npmWorkDir
private final DirectoryProperty
pnpmWorkDir
private final DirectoryProperty
yarnWorkDir
private final DirectoryProperty
bunWorkDir
private final DirectoryProperty
nodeProjectDir
private final Property<String>
version
private final Property<String>
npmVersion
private final Property<String>
pnpmVersion
private final Property<String>
yarnVersion
private final Property<String>
bunVersion
private final Property<String>
distBaseUrl
private final Property<Boolean>
allowInsecureProtocol
private final Property<String>
npmCommand
private final Property<String>
npxCommand
private final Property<String>
pnpmCommand
private final Property<String>
yarnCommand
private final Property<String>
bunCommand
private final Property<String>
bunxCommand
private final Property<String>
npmInstallCommand
private final Property<Boolean>
download
private final Property<ProxySettings>
nodeProxySettings
private final Property<Boolean>
fastNpmInstall
private final Property<Boolean>
oldNpm
private final Property<Boolean>
enableTaskRules
private final DirectoryProperty
computedNodeDir
private final DirectoryProperty
resolvedNodeDir
private final Property<Platform>
computedPlatform
private final Property<Platform>
resolvedPlatform
-
Constructor Summary
Constructors Constructor Description NodeExtension(Project project)
-
Method Summary
Modifier and Type Method Description final DirectoryProperty
getWorkDir()
The directory where Node. final DirectoryProperty
getNpmWorkDir()
The directory where npm is installed (when a specific version is defined) final DirectoryProperty
getPnpmWorkDir()
The directory where pnpm is installed (when a pnpm task is used) final DirectoryProperty
getYarnWorkDir()
The directory where yarn is installed (when a Yarn task is used) final DirectoryProperty
getBunWorkDir()
The directory where Bun is installed (when a Bun task is used) final DirectoryProperty
getNodeProjectDir()
The Node.js project directory location This is where the package. final Property<String>
getVersion()
Version of node to download and install (only used if download is true) It will be unpacked in the workDir 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. 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) 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) 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) 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. final Property<Boolean>
getAllowInsecureProtocol()
Specifies whether it is acceptable to communicate with the Node.js repository over an insecure HTTP connection. final Property<String>
getNpmCommand()
final Property<String>
getNpxCommand()
final Property<String>
getPnpmCommand()
final Property<String>
getYarnCommand()
final Property<String>
getBunCommand()
final Property<String>
getBunxCommand()
final Property<String>
getNpmInstallCommand()
The npm command executed by the npmInstall task By default it is install but it can be changed to ci 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. final Property<ProxySettings>
getNodeProxySettings()
Whether the plugin automatically should add the proxy configuration to npm and yarn commands according the proxy configuration defined for GradleDisable this option if you want to configure the proxy for npm or yarn on your own (in the . 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. final Property<Boolean>
getOldNpm()
Disable functionality that requires newer versions of npmIf 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. final Property<Boolean>
getEnableTaskRules()
Create rules for automatic task creationDisabling this will prevent the npm_ npx_ yarn_ pnpm_ tasks from being automatically created. final DirectoryProperty
getComputedNodeDir()
Computed path to nodejs directory final DirectoryProperty
getResolvedNodeDir()
Computed path to nodejs directory final Property<Platform>
getComputedPlatform()
Operating system and architecture final Property<Platform>
getResolvedPlatform()
Operating system and architecture final Unit
setUseGradleProxySettings(Boolean value)
-
-
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.
-
getNpmCommand
final Property<String> getNpmCommand()
-
getNpxCommand
final Property<String> getNpxCommand()
-
getPnpmCommand
final Property<String> getPnpmCommand()
-
getYarnCommand
final Property<String> getYarnCommand()
-
getBunCommand
final Property<String> getBunCommand()
-
getBunxCommand
final Property<String> getBunxCommand()
-
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
-
getComputedPlatform
final Property<Platform> getComputedPlatform()
Operating system and architecture
-
getResolvedPlatform
final Property<Platform> getResolvedPlatform()
Operating system and architecture
-
setUseGradleProxySettings
@Deprecated(message = "useGradleProxySettings has been replaced with nodeProxySettings", replaceWith = @ReplaceWith(imports = {}, expression = "nodeProxySettings.set(i)")) final Unit setUseGradleProxySettings(Boolean value)
-
-
-
-