com.vaadin.flow.server.frontend.
Class Options
- java.lang.Object
-
- com.vaadin.flow.server.frontend.Options
-
All Implemented Interfaces:
public class Options extends Object implements Serializable
Build a
NodeExecutor
instance.See Also:
-
-
Constructor Summary
Constructors Constructor Description Options(Lookup lookup, File npmFolder, File generatedPath, File frontendDirectory, String buildDirectory)
Create a builder instance with all parameters.
Options(Lookup lookup, File npmFolder, File generatedPath, String buildDirectory)
Create a builder instance with custom npmFolder and generatedPath
Options(Lookup lookup, File npmFolder, String buildDirectory)
Create a builder instance given an specific npm folder.
-
Method Summary
All Methods Modifier and Type Method Description Options
copyLocalResources(File localResourcesFolder)
Set local frontend files to be copied from given folder.
Options
copyResources(Set<File> jars)
Sets whether copy resources from classpath to the appropriate npm package folder so as they are available for webpack build.
Options
copyTemplates(boolean copyTemplates)
Sets whether copy templates to
META-INF/VAADIN/config/templates
.Options
createMissingPackageJson(boolean create)
Sets whether to create the package file if missing.
Options
enableImportsUpdate(boolean enableImportsUpdate)
Sets whether to enable imports file update.
Options
enablePackagesUpdate(boolean enablePackagesUpdate)
Sets whether to enable packages and webpack file updates.
Options
enablePnpm(boolean enable)
Enables pnpm tool.
File
getApplicationProperties()
Get application properties file for Spring project.
String
getBuildDirectory()
Get the name of the used build directory.
ClassFinder
getClassFinder()
protected FeatureFlags
getFeatureFlags()
File
getFrontendDirectory()
Get the defined frontend directory.
File
getGeneratedFolder()
Get the generated folder for this build.
File
getJarFrontendResourcesFolder()
File
getNpmFolder()
Get the npm folder used for this build.
File
getWebappResourcesDirectory()
Get the output directory for webpack output.
Options
populateTokenFileData(elemental.json.JsonObject object)
Fill token file data into the provided
object
.Options
runNpmInstall(boolean runNpmInstall)
Sets whether run
npm install
after updating dependencies.Options
setJavaResourceFolder(File javaResourceFolder)
Set the java resources folder to be checked for feature file.
Options
setNodeAutoUpdate(boolean update)
Sets whether it is fine to automatically update the alternate node installation if installed version is older than the current default.
Options
useByteCodeScanner(boolean byteCodeScanner)
Sets frontend scanner strategy: byte code scanning strategy is used if
byteCodeScanner
istrue
, full classpath scanner strategy is used otherwise (by default).Options
useGlobalPnpm(boolean useGlobalPnpm)
Uses globally installed pnpm tool for frontend packages installation.
Options
useV14Bootstrap(boolean useDeprecatedV14Bootstrapping)
Use V14 bootstrapping that disables index.html entry point.
Options
withApplicationProperties(File applicationProperties)
Set application properties file for Spring project.
Options
withEmbeddableWebComponents(boolean generateEmbeddableWebComponents)
Sets whether to collect and package
WebComponentExporter
dependencies.Options
withEndpointGeneratedOpenAPIFile(File endpointGeneratedOpenAPIFile)
Set output location for the generated OpenAPI file.
Options
withEndpointSourceFolder(File endpointSourceFolder)
Set source paths that OpenAPI generator searches for endpoints.
Options
withFrontendGeneratedFolder(File frontendGeneratedFolder)
Set the folder where frontend files should be generated.
Options
withHomeNodeExecRequired(boolean requireHomeNodeExec)
Requires node executable to be installed in vaadin home folder.
Options
withJarFrontendResourcesFolder(File jarFrontendResourcesFolder)
Sets the appropriate npm package folder for copying flow resources in jars.
Options
withNodeDownloadRoot(URI nodeDownloadRoot)
Sets the download node.js URL.
Options
withNodeVersion(String nodeVersion)
Sets the node.js version to be used when node.js is installed automatically by Vaadin, for example
"v16.0.0"
.Options
withPostinstallPackages(List<String> postinstallPackages)
Sets the additional npm packages to run
postinstall
for.Options
withProductionMode(boolean productionMode)
Sets the production mode.
Options
withTokenFile(File tokenFile)
Sets the token file (flow-build-info.json) path.
Options
withWebpack(File webappResourcesDirectory, File resourceOutputDirectory)
Sets the webpack related properties.
-
-
-
Constructor Detail
-
Options
public Options(Lookup lookup, File npmFolder, String buildDirectory)
Create a builder instance given an specific npm folder.
Parameters:
lookup
- aLookup
to discover services used by Flow (SPI)npmFolder
- folder with the `package.json` filebuildDirectory
- project build directory
-
Options
public Options(Lookup lookup, File npmFolder, File generatedPath, String buildDirectory)
Create a builder instance with custom npmFolder and generatedPath
Parameters:
lookup
- aLookup
to discover services used by Flow (SPI)npmFolder
- folder with the `package.json` filegeneratedPath
- folder where flow generated files will be placed.buildDirectory
- project build directory
-
Options
public Options(Lookup lookup, File npmFolder, File generatedPath, File frontendDirectory, String buildDirectory)
Create a builder instance with all parameters.
Parameters:
lookup
- aLookup
to discover services used by Flow (SPI)npmFolder
- folder with the `package.json` filegeneratedPath
- folder where flow generated files will be placed.frontendDirectory
- a directory with project's frontend filesbuildDirectory
- project build directory
-
-
Method Detail
-
withWebpack
public Options withWebpack(File webappResourcesDirectory, File resourceOutputDirectory)
Sets the webpack related properties.
Parameters:
webappResourcesDirectory
- the directory to set for webpack to output its build results, meant for serving from context root.resourceOutputDirectory
- the directory to output generated non-served resources, such as the "config/stats.json" stats file, and the "config/flow-build-info.json" token file.Returns:
this builder
-
enablePackagesUpdate
public Options enablePackagesUpdate(boolean enablePackagesUpdate)
Sets whether to enable packages and webpack file updates. Default is
true
.Parameters:
enablePackagesUpdate
-true
to enable packages and webpack update, otherwisefalse
Returns:
this builder
-
enableImportsUpdate
public Options enableImportsUpdate(boolean enableImportsUpdate)
Sets whether to enable imports file update. Default is
false
. This will also enable creation of missing package files if set to true.Parameters:
enableImportsUpdate
-true
to enable imports file update, otherwisefalse
Returns:
this builder
-
runNpmInstall
public Options runNpmInstall(boolean runNpmInstall)
Sets whether run
npm install
after updating dependencies.Parameters:
runNpmInstall
- run npm install. Default isfalse
Returns:
the builder
-
withJarFrontendResourcesFolder
public Options withJarFrontendResourcesFolder(File jarFrontendResourcesFolder)
Sets the appropriate npm package folder for copying flow resources in jars.
Parameters:
jarFrontendResourcesFolder
- target folderReturns:
the builder
-
copyResources
public Options copyResources(Set<File> jars)
Sets whether copy resources from classpath to the appropriate npm package folder so as they are available for webpack build.
Parameters:
jars
- set of class nodes to be visited. Notnull
Returns:
the builder
-
copyTemplates
public Options copyTemplates(boolean copyTemplates)
Sets whether copy templates to
META-INF/VAADIN/config/templates
.Parameters:
copyTemplates
- whether to copy templatesReturns:
the builder
-
withEmbeddableWebComponents
public Options withEmbeddableWebComponents(boolean generateEmbeddableWebComponents)
Sets whether to collect and package
WebComponentExporter
dependencies.Parameters:
generateEmbeddableWebComponents
- collect dependencies. Default istrue
Returns:
the builder
-
createMissingPackageJson
public Options createMissingPackageJson(boolean create)
Sets whether to create the package file if missing.
Parameters:
create
- create the packageReturns:
the builder
-
copyLocalResources
public Options copyLocalResources(File localResourcesFolder)
Set local frontend files to be copied from given folder.
Parameters:
localResourcesFolder
- folder to copy local frontend files fromReturns:
the builder, for chaining
-
useV14Bootstrap
public Options useV14Bootstrap(boolean useDeprecatedV14Bootstrapping)
Use V14 bootstrapping that disables index.html entry point.
Parameters:
useDeprecatedV14Bootstrapping
-true
to use legacy V14 bootstrappingReturns:
the builder, for chaining
-
withFrontendGeneratedFolder
public Options withFrontendGeneratedFolder(File frontendGeneratedFolder)
Set the folder where frontend files should be generated.
Parameters:
frontendGeneratedFolder
- folder to generate frontend files in.Returns:
the builder, for chaining
-
withApplicationProperties
public Options withApplicationProperties(File applicationProperties)
Set application properties file for Spring project.
Parameters:
applicationProperties
- application properties file.Returns:
this builder, for chaining
-
getApplicationProperties
public File getApplicationProperties()
Get application properties file for Spring project.
Returns:
application properties file
-
withEndpointGeneratedOpenAPIFile
public Options withEndpointGeneratedOpenAPIFile(File endpointGeneratedOpenAPIFile)
Set output location for the generated OpenAPI file.
Parameters:
endpointGeneratedOpenAPIFile
- the generated output file.Returns:
the builder, for chaining
-
withEndpointSourceFolder
public Options withEndpointSourceFolder(File endpointSourceFolder)
Set source paths that OpenAPI generator searches for endpoints.
Parameters:
endpointSourceFolder
- java source folderReturns:
the builder, for chaining
-
useByteCodeScanner
public Options useByteCodeScanner(boolean byteCodeScanner)
Sets frontend scanner strategy: byte code scanning strategy is used if
byteCodeScanner
istrue
, full classpath scanner strategy is used otherwise (by default).Parameters:
byteCodeScanner
- iftrue
then byte code scanner is used, full scanner is used otherwise (by default).Returns:
the builder, for chaining
-
populateTokenFileData
public Options populateTokenFileData(elemental.json.JsonObject object)
Fill token file data into the provided
object
.Parameters:
object
- the object to fill with token file dataReturns:
the builder, for chaining
-
withTokenFile
public Options withTokenFile(File tokenFile)
Sets the token file (flow-build-info.json) path.
Parameters:
tokenFile
- token file pathReturns:
the builder, for chaining
-
enablePnpm
public Options enablePnpm(boolean enable)
Enables pnpm tool.
"pnpm" will be used instead of "npm".
Parameters:
enable
- enables pnpm.Returns:
the builder, for chaining
-
useGlobalPnpm
public Options useGlobalPnpm(boolean useGlobalPnpm)
Uses globally installed pnpm tool for frontend packages installation.
Parameters:
useGlobalPnpm
- uses globally installed pnpm instead of default one, seeFrontendTools.DEFAULT_PNPM_VERSION
.Returns:
the builder, for chaining
-
withHomeNodeExecRequired
public Options withHomeNodeExecRequired(boolean requireHomeNodeExec)
Requires node executable to be installed in vaadin home folder.
Parameters:
requireHomeNodeExec
- requires vaadin home node execReturns:
the builder, for chaining
-
withNodeVersion
public Options withNodeVersion(String nodeVersion)
Sets the node.js version to be used when node.js is installed automatically by Vaadin, for example
"v16.0.0"
. Defaults to "v18.13.0".Parameters:
nodeVersion
- the new node version to download, not null.Returns:
the builder, for chaining
-
withNodeDownloadRoot
public Options withNodeDownloadRoot(URI nodeDownloadRoot)
Sets the download node.js URL. Handy in heavily firewalled corporate environments where the node.js download can be provided from an intranet mirror. Defaults to
NodeInstaller.DEFAULT_NODEJS_DOWNLOAD_ROOT
.Parameters:
nodeDownloadRoot
- the new download URL to set, not null.Returns:
the builder, for chaining
-
withProductionMode
public Options withProductionMode(boolean productionMode)
Sets the production mode.
Parameters:
productionMode
-true
to enable production mode, otherwisefalse
Returns:
this builder
-
setNodeAutoUpdate
public Options setNodeAutoUpdate(boolean update)
Sets whether it is fine to automatically update the alternate node installation if installed version is older than the current default.
Parameters:
update
- true to update alternate node when usedReturns:
the builder
-
setJavaResourceFolder
public Options setJavaResourceFolder(File javaResourceFolder)
Set the java resources folder to be checked for feature file.
Needed for plugin execution.
Parameters:
javaResourceFolder
- java resources folderReturns:
this builder
-
withPostinstallPackages
public Options withPostinstallPackages(List<String> postinstallPackages)
Sets the additional npm packages to run
postinstall
for.By default, postinstall is only run for internal dependencies which rely on post install scripts to work, e.g. esbuild
Parameters:
postinstallPackages
- the additional npm packages to run postinstall forReturns:
the builder, for chaining
-
getNpmFolder
public File getNpmFolder()
Get the npm folder used for this build.
Returns:
npmFolder
-
getGeneratedFolder
public File getGeneratedFolder()
Get the generated folder for this build.
Returns:
generatedFolder
-
getWebappResourcesDirectory
public File getWebappResourcesDirectory()
Get the output directory for webpack output.
Returns:
webpackOutputDirectory
-
getFrontendDirectory
public File getFrontendDirectory()
Get the defined frontend directory.
Returns:
frontendDirectory
-
getBuildDirectory
public String getBuildDirectory()
Get the name of the used build directory.
By default this will be
target
for maven andbuild
for gradle.Returns:
buildDirectory
-
getFeatureFlags
protected FeatureFlags getFeatureFlags()
-
getJarFrontendResourcesFolder
public File getJarFrontendResourcesFolder()
-
getClassFinder
public ClassFinder getClassFinder()
-
-