Package com.vaadin.flow.server.frontend
Class FrontendBuildUtils
java.lang.Object
com.vaadin.flow.server.frontend.FrontendBuildUtils
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 Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringgetJarResourceString(String jarImport, ClassFinder finder) Get resource from JAR package.getVaadinVersion(ClassFinder finder) Gets the current Vaadin platform version from the core versions JSON resource.static booleanisHillaUsed(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.protected static booleanisPlatformMajorVersionUpdated(ClassFinder finder, File npmFolder, File nodeModules, File buildDirectory) Compares current platform version with the one last recorded as installed in node_modules/.vaadin/vaadin_version.protected static booleanisPlatformVersionUpdated(ClassFinder finder, File npmFolder, File nodeModules) Compares current platform version with the one last recorded as installed in node_modules/.vaadin/vaadin_version.static booleanisReactModuleAvailable(Options options) Is the React module available in the classpath.static booleanisTailwindCssEnabled(Options options) Checks if integration with Tailwind CSS framework is enabled.
-
Constructor Details
-
FrontendBuildUtils
public FrontendBuildUtils()
-
-
Method Details
-
isReactModuleAvailable
Is the React module available in the classpath.- Parameters:
options- the build options- Returns:
- true if the React module is available, false otherwise
-
isTailwindCssEnabled
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 findernpmFolder- npm root foldernodeModules- node_modules folderbuildDirectory- project build directory, to find dev-bundle folder- Returns:
trueif the version has changed,falseif 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 findernpmFolder- npm root foldernodeModules- node_modules folder- Returns:
trueif the version has changed,falseif not- Throws:
IOException- when file reading fails
-
getVaadinVersion
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
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
nullif not found
-
isHillaUsed
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 directoryclassFinder- class finder to check the presence of Hilla endpoint class- Returns:
trueif Hilla is available and Hilla views are used,falseotherwise
-