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 |
configure(dev.jeka.core.api.project.JkProject project,
java.lang.String jsAppBaseDir,
java.lang.String distDir,
java.lang.String copyToDir,
java.util.List<java.lang.String> buildCommands,
java.util.List<java.lang.String> testCommands)
Configures the specified project to include a Node.js build right after main compilation.
|
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 |
setUseJekaLogging(boolean useJekaLog)
Configures whether Jeka logging is used for Node.js operations.
|
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 JkNodeJs setUseJekaLogging(boolean useJekaLog)
useJekaLog - true to enable Jeka logging; false to disable it.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'.public JkNodeJs configure(dev.jeka.core.api.project.JkProject project, java.lang.String jsAppBaseDir, java.lang.String distDir, java.lang.String copyToDir, java.util.List<java.lang.String> buildCommands, java.util.List<java.lang.String> testCommands)
project - The project to configurejsAppBaseDir - The path of the Node.js subproject (relative to the base dir).distDir - The path, relative to jsAppBaseDir of the directory containing the build result.copyToDir - If not empty, the result of the client build will be copied to this directory in class dir (e.g. 'static').buildCommands - The commands (npm o npx) to execute to build the Node.js project.