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.

  • 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(ClassFinder finder, 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:
      finder - project execution class finder
      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
    • isPlatformVersionUpdated

      protected static boolean isPlatformVersionUpdated(ClassFinder finder, 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:
      finder - project execution class finder
      npmFolder - npm root folder
      nodeModules - node_modules folder
      Returns:
      true if the version has changed, false if not
      Throws:
      IOException - when file reading fails
    • getVaadinVersion

      protected static Optional<String> getVaadinVersion(ClassFinder finder)
      Gets the current Vaadin platform version from the core versions JSON resource.
      Parameters:
      finder - the class finder to use for locating the versions resource
      Returns:
      the platform version as a string, or empty 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