Class FrontendBuildUtils

java.lang.Object
com.vaadin.flow.server.frontend.FrontendBuildUtils

public class FrontendBuildUtils extends Object
Utility class for frontend build operations.

Provides helper methods for checking frontend framework availability, version management, resource loading, and build configuration during the frontend build process.

For internal use only. May be renamed or removed in a future release.

Since:
25.1
  • Constructor Details

    • FrontendBuildUtils

      public FrontendBuildUtils()
  • Method Details

    • isReactModuleAvailable

      public static boolean isReactModuleAvailable(Options options)
      Is the React module available in the classpath.
      Parameters:
      options - the build options
      Returns:
      true if the React module is available, false otherwise
    • isTailwindCssEnabled

      public static boolean isTailwindCssEnabled(Options options)
      Checks if integration with Tailwind CSS framework is enabled.
      Parameters:
      options - the build options
      Returns:
      true if Tailwind CSS integration is enabled, false otherwise
    • isPlatformMajorVersionUpdated

      protected static boolean isPlatformMajorVersionUpdated(Options options, File npmFolder, File nodeModules, File buildDirectory) throws IOException
      Compares current platform version with the one last recorded as installed in node_modules/.vaadin/vaadin_version. In case there was no existing platform version recorder and node_modules exists, then platform is considered as staying on the same version.
      Parameters:
      options - the task options
      npmFolder - npm root folder
      nodeModules - node_modules folder
      buildDirectory - project build directory, to find dev-bundle folder
      Returns:
      true if the version has changed, false if not
      Throws:
      IOException - when file reading fails
      Since:
      25.3
    • isPlatformVersionUpdated

      protected static boolean isPlatformVersionUpdated(Options options, File npmFolder, File nodeModules) throws IOException
      Compares current platform version with the one last recorded as installed in node_modules/.vaadin/vaadin_version. In case there was no existing platform version recorder and node_modules exists, then platform is considered updated.
      Parameters:
      options - the task options
      npmFolder - npm root folder
      nodeModules - node_modules folder
      Returns:
      true if the version has changed, false if not
      Throws:
      IOException - when file reading fails
      Since:
      25.3
    • getVaadinVersion

      protected static Optional<String> getVaadinVersion(Options options)
      Gets the current Vaadin version, as declared by the versions files the platform ships.

      Only a versions file of the platform itself says what the version is, and where there is none, the version of the Vaadin on the classpath is used instead.

      Parameters:
      options - the task options to take the pinned npm versions from
      Returns:
      the Vaadin version as a string, or empty if neither a versions file of the platform nor the classpath tells it
      Since:
      25.3
    • getJarResource

      public static URL getJarResource(String jarImport, ClassFinder finder)
      Get resource from JAR package.
      Parameters:
      jarImport - jar file to get (no resource folder should be added)
      finder - the class finder to use for locating the resource
      Returns:
      the resource or null if not found
    • getJarResourceString

      public static String getJarResourceString(String jarImport, ClassFinder finder)
      Get resource from JAR package.
      Parameters:
      jarImport - jar file to get (no resource folder should be added)
      finder - the class finder to use for locating the resource
      Returns:
      resource as String or null if not found
    • isHillaUsed

      public static boolean isHillaUsed(File frontendDirectory, ClassFinder classFinder)
      Checks if Hilla is available and Hilla views are used in the project based on what is in routes.ts or routes.tsx file. FrontendUtils.getProjectFrontendDir(AbstractConfiguration) can be used to get the frontend directory. Given class finder is used to check the presence of Hilla in a classpath.
      Parameters:
      frontendDirectory - the frontend directory
      classFinder - class finder to check the presence of Hilla endpoint class
      Returns:
      true if Hilla is available and Hilla views are used, false otherwise