@groovy.transform.CompileStatic @groovy.util.logging.Slf4j class NodeJSExtension extends org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension
Configure project defaults or task specifics for Node.js.
| Modifiers | Name | Description |
|---|---|---|
static java.lang.String |
NAME |
|
static java.lang.String |
NODEJS_DEFAULT |
The default version of Node.js that will be used on a supported platform if nothing else is configured. |
| Fields inherited from class | Fields |
|---|---|
class org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension |
__$stMC, __$stMC |
| Type | Name and description |
|---|---|
java.util.Map<java.lang.String, ?> |
environment |
| Constructor and description |
|---|
NodeJSExtension
(org.gradle.api.Project project)Constructs a new extension which is attached to the provided project. |
NodeJSExtension
(org.gradle.api.Task task)Constructs a new extension which is attached to the provided task. |
NodeJSExtension
(org.gradle.api.Task task, NodeJSExtension alternativeProjectExt)Constructs a new extension which is attached to the provided task. |
protected NodeJSExtension
(org.gradle.api.Task task, java.lang.String projectExtName)Constructs a new extension which is attached to the provided task. |
protected NodeJSExtension
(org.gradle.api.Task task, java.lang.Class<? super NodeJSExtension> extClass)Constructs a new extension which is attached to the provided task. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
appendPath(org.gradle.api.provider.Provider<java.lang.String> postfix)Add search to system path. |
|
NodeJSExecSpec |
createExecSpec()Create execution specification. |
|
void |
environment(java.util.Map<java.lang.String, ?> args)Add environmental variables to be passed to the exe. |
|
void |
executable(java.util.Map<java.lang.String, java.lang.Object> opts) |
|
void |
executableByNvmRc(org.gradle.api.provider.Provider<java.io.File> nvmrc)Read the version from .nvmrc.
|
|
void |
executableByNvmrc()Read the version from .nvmrc.
|
|
protected org.ysb33r.grolifant.api.v4.runnable.ExecutableDownloader |
getDownloader()Gets the downloader implementation. |
|
java.util.Map<java.lang.String, java.lang.String> |
getEnvironment()Environment for running the exe |
|
org.gradle.api.provider.Provider<java.io.File> |
getNpmCliJsProvider()Resolves a path to a npm executable that is associated with the configured Node.js. |
|
org.ysb33r.grolifant.api.v4.exec.ResolvableExecutable |
getResolvableNodeExecutable()Resolves a path to a node executable. |
|
org.ysb33r.grolifant.api.v4.exec.ResolvableExecutable |
getResolvedNpmCliJs()Resolves a path to a npm executable that is associated with the configured Node.js. |
|
void |
prefixPath(org.gradle.api.provider.Provider<java.lang.String> prefix)Add search to system path |
|
protected java.lang.String |
runExecutableAndReturnVersion()Runs the executable and returns the version. |
|
static java.util.Map<java.lang.String, java.lang.Object> |
searchPath()Use this to configure a system path search for Node |
|
void |
setEnvironment(java.util.Map<java.lang.String, ?> args)Replace current environment with new one. |
|
void |
useSystemPath()Adds the system path to the execution environment. |
| Methods inherited from class | Name |
|---|---|
class org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension |
org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#pfaccess$0(org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#access$0(org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#this$dist$invoke$2(java.lang.String, java.lang.Object), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#this$dist$set$2(java.lang.String, java.lang.Object), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#this$dist$get$2(java.lang.String), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#access$1(org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#executableByVersion(java.lang.Object), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#executableBySearchPath(java.lang.Object), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#setWindowsExtensionSearchOrder([Ljava.lang.String;), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#setWindowsExtensionSearchOrder(java.lang.Iterable), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#getWindowsExtensionSearchOrder(), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#resolvedExecutableVersion(), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#executableByPath(java.lang.Object), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#getExecutable(), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#getProjectOperations(), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#invokeMethod(java.lang.String, java.lang.Object), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#getMetaClass(), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#setMetaClass(groovy.lang.MetaClass), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#setProperty(java.lang.String, java.lang.Object), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#getProperty(java.lang.String), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#wait(long, int), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#wait(long), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#wait(), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#equals(java.lang.Object), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#toString(), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#hashCode(), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#getClass(), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#notify(), org.ysb33r.grolifant.api.v4.runnable.AbstractToolExtension#notifyAll() |
The default version of Node.js that will be used on a supported platform if nothing else is configured.
Constructs a new extension which is attached to the provided project.
project - Project this extension is associated with.Constructs a new extension which is attached to the provided task.
project - Project this extension is associated with.Constructs a new extension which is attached to the provided task.
project - Project this extension is associated with.alternativeProjectExt - Alternative extension to use, rather than the default project extensionConstructs a new extension which is attached to the provided task. This is meant for other plugins that want to provide their own NodeJSExtension implementation
project - Project this extension is associated with.projectExtName - Name of the extension that is attached to the project.Constructs a new extension which is attached to the provided task. This is meant for other plugins that want to provide their own NodeJSExtension implementation
project - Project this extension is associated with.extClass - Type of the extension that is attached to the project.Add search to system path. In the case of a task this will be appended to both the task and project extension's version of the system path.
postfix - Provider of a path item that can be appended to the current system path.Create execution specification.
Add environmental variables to be passed to the exe.
args - Environmental variable key-value map. Read the version from .nvmrc.
Only supports fixed versions, not open versions like node or lts/*.
nvmrc - Provider to the location of .nvmrc Read the version from .nvmrc.
Only supports fixed versions, not open versions like node or lts/*.
Assumes .nvmrc is at the npm homedirectory
Gets the downloader implementation. Can throw an exception if downloading is not supported.
Environment for running the exe
Calling this will resolve all lazy-values in the variable map.
Resolves a path to a npm executable that is associated with the configured Node.js.
npm executable.ExecConfigurationException if executable was not configured. Resolves a path to a node executable.
node executable.ExecConfigurationException if executable was not configured. Resolves a path to a npm executable that is associated with the configured Node.js.
npm executable.ExecConfigurationException if executable was not configured.Add search to system path In the case of a task this will be prefixed to both the task and project extension's version of the system path.
prefix - Provider of a path item that can be prefixed to the current system path.Runs the executable and returns the version. See org.ysb33r.grolifant.api.v4.runnable.ExecUtils#parseVersionFromOutput as a helper to implement this method.
Use this to configure a system path search for Node
Replace current environment with new one. If this is called on the task extension, no project extension environment will be used.
args - New environment key-value map of properties.Adds the system path to the execution environment.
Groovy Documentation