Class Options
java.lang.Object
io.jmix.flowui.devserver.frontend.Options
- All Implemented Interfaces:
Serializable
Build a
NodeExecutor
instance.- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptioncopyLocalResources
(File localResourcesFolder) Set local frontend files to be copied from given folder.copyResources
(Set<File> jars) Sets whether copy resources from classpath to the appropriate npm package folder so as they are available for webpack build.createMissingPackageJson
(boolean create) Sets whether to create the package file if missing.enableImportsUpdate
(boolean enableImportsUpdate) Sets whether to enable imports file update.enableNpmFileCleaning
(boolean forceClean) Deprecated.enablePackagesUpdate
(boolean enablePackagesUpdate) Sets whether to enable packages and webpack file updates.Gets the directory used for the build output.Get the name of the used build directory.com.vaadin.flow.server.frontend.scanner.ClassFinder
Gets the used class finder.protected com.vaadin.experimental.FeatureFlags
Get the defined frontend directory.Gets the folder where frontend files should be generated.Gets the folder to which frontend resources from add-on jars are copied.Gets the folder containing java resources, typically src/main/resources in a Maven project.com.vaadin.flow.di.Lookup
Gets the lookup instance to use for internal lookups.Get the npm folder used for this build.elemental.json.JsonObject
Get the output directory for webpack output.boolean
Check if a bundle build should run.boolean
boolean
boolean
boolean
boolean
Check if a dev mode bundle build should run.boolean
boolean
boolean
boolean
boolean
boolean
Checks if running with a dev server (when not in production mode).boolean
boolean
boolean
Gets the production mode.boolean
boolean
boolean
Is dev bundle build skipped or not.boolean
boolean
populateTokenFileData
(elemental.json.JsonObject object) Fill token file data into the providedobject
.setJavaResourceFolder
(File javaResourceFolder) Set the java resources folder to be checked for feature file.setNodeAutoUpdate
(boolean update) Sets whether it is fine to automatically update the alternate node installation if installed version is older than the current default.skipDevBundleBuild
(boolean skip) Set to true to skip dev bundle build in case a dev bundle exists.useByteCodeScanner
(boolean byteCodeScanner) Sets frontend scanner strategy: byte code scanning strategy is used ifbyteCodeScanner
istrue
, full classpath scanner strategy is used otherwise (by default).useGlobalPnpm
(boolean useGlobalPnpm) Uses globally installed pnpm tool for frontend packages installation.withBuildDirectory
(String buildDirectory) Use the specified directory name (inside the project folder) for the build output.withBundleBuild
(boolean bundleBuild) Whether to run bundle build.withCiBuild
(boolean ciBuild) Enables ci build.withCopyTemplates
(boolean copyTemplates) Sets whether copy templates toMETA-INF/VAADIN/config/templates
.withEmbeddableWebComponents
(boolean generateEmbeddableWebComponents) Sets whether to collect and packageWebComponentExporter
dependencies.withEnablePnpm
(boolean enable) Enables pnpm tool.withFeatureFlags
(com.vaadin.experimental.FeatureFlags featureFlags) withForceProductionBuild
(boolean forceProductionBuild) Setting this totrue
will force a build of the production build even if there is a default production bundle that could be used.withFrontendDirectory
(File frontendDirectory) Sets the directory containing the project's frontend fileswithFrontendGeneratedFolder
(File frontendGeneratedFolder) Set the folder where frontend files should be generated.withFrontendHotdeploy
(boolean frontendHotdeploy) Whether to run with a dev server (when not in production mode).withHomeNodeExecRequired
(boolean requireHomeNodeExec) Requires node executable to be installed in vaadin home folder.withJarFrontendResourcesFolder
(File jarFrontendResourcesFolder) Sets the appropriate npm package folder for copying flow resources in jars.withNodeDownloadRoot
(URI nodeDownloadRoot) Sets the download node.js URL.withNodeVersion
(String nodeVersion) Sets the node.js version to be used when node.js is installed automatically by Vaadin, for example"v16.0.0"
.withPostinstallPackages
(List<String> postinstallPackages) Sets the additional npm packages to runpostinstall
for.withProductionMode
(boolean productionMode) Sets the production mode.withRunNpmInstall
(boolean runNpmInstall) Sets whether runnpm install
after updating dependencies.withStudioFolder
(File studioFolder) withThemeClass
(String themeClass) withThemeValue
(String themeValue) withThemeVariant
(String themeVariant) withTokenFile
(File tokenFile) Sets the token file (flow-build-info.json) path.withWebpack
(File webappResourcesDirectory, File resourceOutputDirectory) Sets the webpack related properties.
-
Constructor Details
-
Options
Creates a new instance.- Parameters:
lookup
- aLookup
to discover services used by Flow (SPI)
-
-
Method Details
-
withStudioFolder
-
getStudioFolder
-
withThemeValue
-
getThemeValue
-
withThemeVariant
-
getThemeVariant
-
withThemeClass
-
getThemeClass
-
withFrontendDirectory
Sets the directory containing the project's frontend files- Parameters:
frontendDirectory
- a directory with project's frontend files- Returns:
- this
-
withBuildDirectory
Use the specified directory name (inside the project folder) for the build output.- Parameters:
buildDirectory
- project build directory- Returns:
- this builder
-
withWebpack
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
Sets whether to enable packages and webpack file updates. Default istrue
.- Parameters:
enablePackagesUpdate
-true
to enable packages and webpack update, otherwisefalse
- Returns:
- this builder
-
enableNpmFileCleaning
Deprecated.Sets whether to perform always perform clean up procedure. Default isfalse
. When the value is false, npm related files will only be removed when a platform version update is detected. This method is only for tests.- Parameters:
forceClean
-true
to clean npm files always, otherwisefalse
- Returns:
- this builder
-
enableImportsUpdate
Sets whether to enable imports file update. Default isfalse
. 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
-
withRunNpmInstall
Sets whether runnpm install
after updating dependencies.- Parameters:
runNpmInstall
- run npm install. Default isfalse
- Returns:
- the builder
-
withJarFrontendResourcesFolder
Sets the appropriate npm package folder for copying flow resources in jars.- Parameters:
jarFrontendResourcesFolder
- target folder- Returns:
- the builder
-
copyResources
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
-
withCopyTemplates
Sets whether copy templates toMETA-INF/VAADIN/config/templates
.- Parameters:
copyTemplates
- whether to copy templates- Returns:
- the builder
-
withEmbeddableWebComponents
Sets whether to collect and packageWebComponentExporter
dependencies.- Parameters:
generateEmbeddableWebComponents
- collect dependencies. Default istrue
- Returns:
- the builder
-
createMissingPackageJson
Sets whether to create the package file if missing.- Parameters:
create
- create the package- Returns:
- the builder
-
copyLocalResources
Set local frontend files to be copied from given folder.- Parameters:
localResourcesFolder
- folder to copy local frontend files from- Returns:
- the builder, for chaining
-
withFrontendGeneratedFolder
Set the folder where frontend files should be generated.- Parameters:
frontendGeneratedFolder
- folder to generate frontend files in.- Returns:
- the builder, for chaining
-
getFrontendGeneratedFolder
Gets the folder where frontend files should be generated.- Returns:
- folder to generate frontend files in
-
useByteCodeScanner
Sets frontend scanner strategy: byte code scanning strategy is used ifbyteCodeScanner
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
Fill token file data into the providedobject
.- Parameters:
object
- the object to fill with token file data- Returns:
- the builder, for chaining
-
withTokenFile
Sets the token file (flow-build-info.json) path.- Parameters:
tokenFile
- token file path- Returns:
- the builder, for chaining
-
withEnablePnpm
Enables pnpm tool."pnpm" will be used instead of "npm".
- Parameters:
enable
- enables pnpm.- Returns:
- the builder, for chaining
-
withCiBuild
Enables ci build."npm ci" will be used instead of "npm install". "--frozen-lockfile" will be used if pnpm is used instead of npm.
- Parameters:
ciBuild
- true to enable ci build- Returns:
- the builder, for chaining
-
withForceProductionBuild
Setting this totrue
will force a build of the production build even if there is a default production bundle that could be used. -
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
Requires node executable to be installed in vaadin home folder.- Parameters:
requireHomeNodeExec
- requires vaadin home node exec- Returns:
- the builder, for chaining
-
withNodeVersion
Sets the node.js version to be used when node.js is installed automatically by Vaadin, for example"v16.0.0"
. Defaults to "v18.17.1".- Parameters:
nodeVersion
- the new node version to download, not null.- Returns:
- the builder, for chaining
-
withNodeDownloadRoot
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 toNodeInstaller.DEFAULT_NODEJS_DOWNLOAD_ROOT
.- Parameters:
nodeDownloadRoot
- the new download URL to set, not null.- Returns:
- the builder, for chaining
-
withProductionMode
Sets the production mode.- Parameters:
productionMode
-true
to enable production mode, otherwisefalse
- Returns:
- this builder
-
withFrontendHotdeploy
Whether to run with a dev server (when not in production mode).- Parameters:
frontendHotdeploy
- true to run with a dev server, false to run in development bundle mode- Returns:
- this builder
-
isFrontendHotdeploy
public boolean isFrontendHotdeploy()Checks if running with a dev server (when not in production mode).- Returns:
- true to run with a dev server, false to run in development bundle mode
-
isDevBundleBuild
public boolean isDevBundleBuild()Check if a dev mode bundle build should run.- Returns:
- true to run the build, false otherwise
-
withBundleBuild
Whether to run bundle build. Needed when not using a dev server or running for production.- Parameters:
bundleBuild
- true to run a bundle build- Returns:
- this builder
-
isBundleBuild
public boolean isBundleBuild()Check if a bundle build should run.- Returns:
- true to run the build, false otherwise
-
setNodeAutoUpdate
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 used- Returns:
- the builder
-
setJavaResourceFolder
Set the java resources folder to be checked for feature file.Needed for plugin execution.
- Parameters:
javaResourceFolder
- java resources folder- Returns:
- this builder
-
withPostinstallPackages
Sets the additional npm packages to runpostinstall
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 for- Returns:
- the builder, for chaining
-
getNpmFolder
Get the npm folder used for this build.- Returns:
- npmFolder
-
getWebappResourcesDirectory
Get the output directory for webpack output.- Returns:
- webpackOutputDirectory
-
getFrontendDirectory
Get the defined frontend directory.- Returns:
- frontendDirectory
-
getBuildDirectoryName
Get the name of the used build directory.By default this will be
target
for maven andbuild
for gradle.- Returns:
- The name of the build directory
-
getBuildDirectory
Gets the directory used for the build output.- Returns:
- the build directory
-
withFeatureFlags
-
getFeatureFlags
protected com.vaadin.experimental.FeatureFlags getFeatureFlags() -
getJarFrontendResourcesFolder
Gets the folder to which frontend resources from add-on jars are copied.- Returns:
- the jar resource folder
-
getClassFinder
public com.vaadin.flow.server.frontend.scanner.ClassFinder getClassFinder()Gets the used class finder.- Returns:
- the class finder
-
getNodeModulesFolder
-
getResourceOutputDirectory
-
isEnablePackagesUpdate
public boolean isEnablePackagesUpdate() -
isCreateMissingPackageJson
public boolean isCreateMissingPackageJson() -
isEnableImportsUpdate
public boolean isEnableImportsUpdate() -
isEnableWebpackConfigUpdate
public boolean isEnableWebpackConfigUpdate() -
isRunNpmInstall
public boolean isRunNpmInstall() -
getJarFiles
-
isGenerateEmbeddableWebComponents
public boolean isGenerateEmbeddableWebComponents() -
isCleanNpmFiles
public boolean isCleanNpmFiles() -
getLocalResourcesFolder
-
isUseByteCodeScanner
public boolean isUseByteCodeScanner() -
getTokenFileData
public elemental.json.JsonObject getTokenFileData() -
getTokenFile
-
isEnablePnpm
public boolean isEnablePnpm() -
isCiBuild
public boolean isCiBuild() -
isForceProductionBuild
public boolean isForceProductionBuild() -
isUseGlobalPnpm
public boolean isUseGlobalPnpm() -
isRequireHomeNodeExec
public boolean isRequireHomeNodeExec() -
isCopyTemplates
public boolean isCopyTemplates() -
getNodeVersion
-
getNodeDownloadRoot
-
isNodeAutoUpdate
public boolean isNodeAutoUpdate() -
getLookup
public com.vaadin.flow.di.Lookup getLookup()Gets the lookup instance to use for internal lookups.- Returns:
- the lookup instance
-
isProductionMode
public boolean isProductionMode()Gets the production mode.- Returns:
true
if production mode is enabled, otherwisefalse
-
getJavaResourceFolder
Gets the folder containing java resources, typically src/main/resources in a Maven project.- Returns:
- the java resource folder
-
getPostinstallPackages
-
skipDevBundleBuild
Set to true to skip dev bundle build in case a dev bundle exists.Dev bundle build will not be skipped in case no dev bundle is found.
- Parameters:
skip
-true
to skip rebuild of dev bundle- Returns:
- this builder
-
isSkipDevBundle
public boolean isSkipDevBundle()Is dev bundle build skipped or not.- Returns:
true
to skip dev bundle checks,false
to run normally. Default isfalse
-