com.vaadin.flow.server.frontend.
Class FrontendToolsSettings
- java.lang.Object
-
- com.vaadin.flow.server.frontend.FrontendToolsSettings
-
All Implemented Interfaces:
public class FrontendToolsSettings extends Object implements Serializable
Configuration object for controlling the
FrontendTools
features.This can be modified, but the choices will be locked in
FrontendTools
when it is initialized. Until then any settings can be changed.See Also:
-
-
Constructor Summary
Constructors Constructor Description FrontendToolsSettings(String baseDir, SerializableSupplier<String> alternativeDirGetter)
Create a tools configuration object.
-
Method Summary
All Methods Modifier and Type Method Description Supplier<String>
getAlternativeDirGetter()
Get the alternative directory getter.
String
getBaseDir()
Get the defined base dir.
URI
getNodeDownloadRoot()
Get the node download root to be used for downloading node.
String
getNodeVersion()
Get the defined node version.
boolean
isAutoUpdate()
Check if automatic updates are enabled.
boolean
isForceAlternativeNode()
Check if alternative node usage should be forced.
boolean
isIgnoreVersionChecks()
Check if version checks should be ignored.
boolean
isUseGlobalPnpm()
Check if global pnpm should be used.
void
setAlternativeDirGetter(SerializableSupplier<String> alternativeDirGetter)
Set the installation directory if no tools are found.
void
setAutoUpdate(boolean autoUpdate)
When set to true the alternative version is updated to the latest default node version as defined for the framework.
void
setBaseDir(String baseDir)
Set the base directory for locating tools.
void
setForceAlternativeNode(boolean forceAlternativeNode)
Set if the alternative folder should always be used even if a global installation exists.
void
setIgnoreVersionChecks(boolean ignoreVersionChecks)
Set if node and npm versions should be checked or not.
void
setNodeDownloadRoot(URI nodeDownloadRoot)
Set the root URI for downloading node.
void
setNodeVersion(String nodeVersion)
Set the node version to install when installation is required.
void
setUseGlobalPnpm(boolean useGlobalPnpm)
Force usage of global pnpm.
-
-
-
Constructor Detail
-
FrontendToolsSettings
public FrontendToolsSettings(String baseDir, SerializableSupplier<String> alternativeDirGetter)
Create a tools configuration object.
The
baseDir
is used as a base directory to locate the tools andalternativeDirGetter
is the directory to install tools if they are not found.Note that if
alternativeDir
isnull
tools won't be installed.Parameters:
baseDir
- the base directory to locate the tools, notnull
alternativeDirGetter
- the getter for a directory where tools will be installed if they are not found globally or in thebaseDir
, may benull
-
-
Method Detail
-
setBaseDir
public void setBaseDir(String baseDir)
Set the base directory for locating tools.
Parameters:
baseDir
- the base directory to locate the tools, notnull
-
setAlternativeDirGetter
public void setAlternativeDirGetter(SerializableSupplier<String> alternativeDirGetter)
Set the installation directory if no tools are found.
Parameters:
alternativeDirGetter
- the getter for a directory where tools will be installed if they are not found globally or in thebaseDir
, may benull
-
setNodeDownloadRoot
public void setNodeDownloadRoot(URI nodeDownloadRoot)
Set the root URI for downloading node.
Parameters:
nodeDownloadRoot
- node download root uri, default is "https://nodejs.org/dist/"
-
setNodeVersion
public void setNodeVersion(String nodeVersion)
Set the node version to install when installation is required.
Parameters:
nodeVersion
- The node.js version to be used when node.js is installed automatically, default is "v16.18.1"
-
setIgnoreVersionChecks
public void setIgnoreVersionChecks(boolean ignoreVersionChecks)
Set if node and npm versions should be checked or not.
Parameters:
ignoreVersionChecks
- set if versions should be validated, default is system property for "vaadin.ignoreVersionChecks"
-
setForceAlternativeNode
public void setForceAlternativeNode(boolean forceAlternativeNode)
Set if the alternative folder should always be used even if a global installation exists.
This will force the installation if a version doesn't exist in the folder defined in
alternativeDirGetter
.Parameters:
forceAlternativeNode
- iftrue
force usage of node executable from alternative directory
-
setUseGlobalPnpm
public void setUseGlobalPnpm(boolean useGlobalPnpm)
Force usage of global pnpm.
Parameters:
useGlobalPnpm
- use globally installed pnpm instead of the default version "5.18.10"
-
setAutoUpdate
public void setAutoUpdate(boolean autoUpdate)
When set to true the alternative version is updated to the latest default node version as defined for the framework.
Parameters:
autoUpdate
- update node inalternativeDirGetter
if version older than the current default "v16.18.1"
-
getBaseDir
public String getBaseDir()
Get the defined base dir.
Returns:
defined base dir
-
getAlternativeDirGetter
public Supplier<String> getAlternativeDirGetter()
Get the alternative directory getter.
Returns:
alternative directory getter
-
getNodeVersion
public String getNodeVersion()
Get the defined node version.
Returns:
node version
-
getNodeDownloadRoot
public URI getNodeDownloadRoot()
Get the node download root to be used for downloading node.
Returns:
node download root
-
isIgnoreVersionChecks
public boolean isIgnoreVersionChecks()
Check if version checks should be ignored.
Returns:
ignore version checks
-
isForceAlternativeNode
public boolean isForceAlternativeNode()
Check if alternative node usage should be forced.
Returns:
force alternative node usage
-
isUseGlobalPnpm
public boolean isUseGlobalPnpm()
Check if global pnpm should be used.
Returns:
use global pnpm
-
isAutoUpdate
public boolean isAutoUpdate()
Check if automatic updates are enabled.
Returns:
automatic update
-
-