public class JkNodeJs
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
DEFAULT_NODE_VERSION |
| Modifier and Type | Method and Description |
|---|---|
JkNodeJs |
exec(java.lang.String commandLine)
Executes the specified 'npm or npx' command line.
|
java.lang.String |
getVersion()
Returns the version of the nodeJs distribution.
|
java.nio.file.Path |
getWorkingDir()
Returns the working directory from where npm and npx commands should be run.
|
JkNodeJs |
npm(java.lang.String commandLine,
java.lang.Object... items)
Executes the specified npm command line.
|
JkNodeJs |
npx(java.lang.String commandLine,
java.lang.Object... items)
Executes the specified npx command line.
|
static JkNodeJs |
of(java.nio.file.Path nodeJsInstallDir)
Creates a
JkNodeJs wrapping on a nodeJs distribution located in the specified install dir. |
static JkNodeJs |
ofDefaultVersion()
Creates a
JkNodeJs wrapping the default version. |
static JkNodeJs |
ofVersion(java.lang.String version)
Creates a
JkNodeJs wrapping the specified version. |
JkNodeJs |
setWorkingDir(java.nio.file.Path workingDir)
Sets the working directory from where
npm(String, Object...) and npx(String, Object...) should be run. |
public static final java.lang.String DEFAULT_NODE_VERSION
public static JkNodeJs of(java.nio.file.Path nodeJsInstallDir)
JkNodeJs wrapping on a nodeJs distribution located in the specified install dir.nodeJsInstallDir - Path to nodeJs installation directorypublic static JkNodeJs ofVersion(java.lang.String version)
JkNodeJs wrapping the specified version.
Jeka caches nodeJs distribution in a specific directory. If the specified version is not
present in cache, it is downloaded automatically.version - Version of nodeJs to use.public static JkNodeJs ofDefaultVersion()
JkNodeJs wrapping the default version.ofVersion(String)public JkNodeJs setWorkingDir(java.nio.file.Path workingDir)
npm(String, Object...) and npx(String, Object...) should be run.public java.nio.file.Path getWorkingDir()
public java.lang.String getVersion()
public JkNodeJs npm(java.lang.String commandLine, java.lang.Object... items)
commandLine - Command line to be executed by npm. The 'npm' command should
not be included in the command line.public JkNodeJs npx(java.lang.String commandLine, java.lang.Object... items)
commandLine - Command line to be executed by npx. The 'npx' command should
not be included in the command line.public JkNodeJs exec(java.lang.String commandLine)
commandLine - mMst start with either 'npm' nor 'npx'.