Package com.vaadin.flow.server.frontend
Class FrontendToolsSettings
- java.lang.Object
-
- com.vaadin.flow.server.frontend.FrontendToolsSettings
-
- All Implemented Interfaces:
Serializable
public class FrontendToolsSettings extends Object implements Serializable
Configuration object for controlling theFrontendToolsfeatures.This can be modified, but the choices will be locked in
FrontendToolswhen it is initialized. Until then any settings can be changed.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description FrontendToolsSettings(String baseDir, SerializableSupplier<String> alternativeDirGetter)Create a tools configuration object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Supplier<String>getAlternativeDirGetter()Get the alternative directory getter.StringgetBaseDir()Get the defined base dir.URIgetNodeDownloadRoot()Get the node download root to be used for downloading node.StringgetNodeVersion()Get the defined node version.booleanisAutoUpdate()Check if automatic updates are enabled.booleanisForceAlternativeNode()Check if alternative node usage should be forced.booleanisIgnoreVersionChecks()Check if version checks should be ignored.booleanisUseGlobalPnpm()Check if global pnpm should be used.voidsetAlternativeDirGetter(SerializableSupplier<String> alternativeDirGetter)Set the installation directory if no tools are found.voidsetAutoUpdate(boolean autoUpdate)When set to true the alternative version is updated to the latest default node version as defined for the framework.voidsetBaseDir(String baseDir)Set the base directory for locating tools.voidsetForceAlternativeNode(boolean forceAlternativeNode)Set if the alternative folder should always be used even if a global installation exists.voidsetIgnoreVersionChecks(boolean ignoreVersionChecks)Set if node and npm versions should be checked or not.voidsetNodeDownloadRoot(URI nodeDownloadRoot)Set the root URI for downloading node.voidsetNodeVersion(String nodeVersion)Set the node version to install when installation is required.voidsetUseGlobalPnpm(boolean useGlobalPnpm)Force usage of global pnpm.
-
-
-
Constructor Detail
-
FrontendToolsSettings
public FrontendToolsSettings(String baseDir, SerializableSupplier<String> alternativeDirGetter)
Create a tools configuration object.The
baseDiris used as a base directory to locate the tools andalternativeDirGetteris the directory to install tools if they are not found.Note that if
alternativeDirisnulltools won't be installed.- Parameters:
baseDir- the base directory to locate the tools, notnullalternativeDirGetter- 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.14.0"
-
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- iftrueforce 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 inalternativeDirGetterif version older than the current default "v16.14.0"
-
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
-
-