@groovy.transform.CompileStatic abstract class BaseNodeJSExtension<T extends BaseNodeJSExtension> extends org.ysb33r.grolifant5.api.core.runnable.AbstractToolExtension<T> implements NodeJSExtensionMethods, org.ysb33r.grolifant5.api.core.runnable.ProvisionedExecMethods<NodeJSExecSpec>
Base class for configuring project defaults or task specifics for Node.js.
| Modifiers | Name | Description |
|---|---|---|
class |
BaseNodeJSExtension.1 |
| Modifiers | Name | Description |
|---|---|---|
protected java.util.concurrent.Callable<NpmExtensionMethods> |
locateNpm |
| Type | Name and description |
|---|---|
org.ysb33r.grolifant5.api.core.ConfigCacheSafeOperations |
configCacheSafeOperations |
java.util.Map<String, ?> |
environment |
| Constructor and description |
|---|
protected BaseNodeJSExtension
(Project project)Constructs a new extension which is attached to the provided project. |
protected BaseNodeJSExtension
(Task task, T alternativeProjectExt)Constructs a new extension which is attached to the provided task. |
protected BaseNodeJSExtension
(Task task, String projectExtName)Constructs a new extension which is attached to the provided task. |
protected BaseNodeJSExtension
(Task task, java.util.concurrent.Callable<T> extClass)Constructs a new extension which is attached to the provided task. |
| Type Params | Return Type | Name and description |
|---|---|---|
|
void |
appendPath(Provider<String> postfix)Add search to system path. |
|
void |
environment(java.util.Map<String, ?> args)Add environmental variables to be passed to the exe. |
|
protected org.ysb33r.grolifant5.api.core.downloader.ExecutableDownloader |
getDownloader()Gets the downloader implementation. |
|
java.util.Map<String, String> |
getEnvironment()Environment for running the exe |
|
Provider<java.util.Map<String, String>> |
getEnvironmentProvider() |
|
Provider<File> |
getNpmCliJsProvider()Resolves a path to a npm executable that is associated with the configured Node.js. |
|
void |
prefixPath(Provider<String> prefix)Add search to system path |
|
protected String |
runExecutableAndReturnVersion()Runs the executable and returns the version. |
|
void |
setEnvironment(java.util.Map<String, ?> args)Replace current environment with new one. |
|
void |
useSystemPath()Adds the system path to the execution environment. |
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.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 - A function object that will return an 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.Add environmental variables to be passed to the exe.
args - Environmental variable key-value map.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.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.
Prefixes are in reversed other - the last prefix added will be the first in the path list.
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.grolifant5.internal.core.executable.ExecUtils#parseVersionFromOutput as a helper to implement this method.
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