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 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 Details

    • 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 and alternativeDirGetter is the directory to install tools if they are not found.

      Note that if alternativeDir is null tools won't be installed.

      Parameters:
      baseDir - the base directory to locate the tools, not null
      alternativeDirGetter - the getter for a directory where tools will be installed if they are not found globally or in the baseDir, may be null
  • Method Details

    • setBaseDir

      public void setBaseDir(String baseDir)
      Set the base directory for locating tools.
      Parameters:
      baseDir - the base directory to locate the tools, not null
    • 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 the baseDir, may be null
    • 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 "v20.9.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 - if true 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 "8.6.11"
    • 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 in alternativeDirGetter if version older than the current default "v20.9.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