Class Options

java.lang.Object
io.jmix.flowui.devserver.frontend.Options
All Implemented Interfaces:
Serializable

public class Options extends Object implements Serializable
Build a NodeExecutor instance.
See Also:
  • Constructor Details

    • Options

      public Options(com.vaadin.flow.di.Lookup lookup, File npmFolder)
      Creates a new instance.
      Parameters:
      lookup - a Lookup to discover services used by Flow (SPI)
  • Method Details

    • withStudioFolder

      public Options withStudioFolder(File studioFolder)
    • getStudioFolder

      public File getStudioFolder()
    • withThemeValue

      public Options withThemeValue(String themeValue)
    • getThemeValue

      public String getThemeValue()
    • withThemeVariant

      public Options withThemeVariant(String themeVariant)
    • getThemeVariant

      public String getThemeVariant()
    • withThemeClass

      public Options withThemeClass(String themeClass)
    • getThemeClass

      public String getThemeClass()
    • withFrontendDirectory

      public Options withFrontendDirectory(File frontendDirectory)
      Sets the directory containing the project's frontend files
      Parameters:
      frontendDirectory - a directory with project's frontend files
      Returns:
      this
    • withBuildDirectory

      public Options withBuildDirectory(String buildDirectory)
      Use the specified directory name (inside the project folder) for the build output.
      Parameters:
      buildDirectory - project build directory
      Returns:
      this builder
    • 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, otherwise false
      Returns:
      this builder
    • enableNpmFileCleaning

      @Deprecated public Options enableNpmFileCleaning(boolean forceClean)
      Deprecated.
      Sets whether to perform always perform clean up procedure. Default is false. 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, otherwise false
      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, otherwise false
      Returns:
      this builder
    • withRunNpmInstall

      public Options withRunNpmInstall(boolean runNpmInstall)
      Sets whether run npm install after updating dependencies.
      Parameters:
      runNpmInstall - run npm install. Default is false
      Returns:
      the builder
    • withJarFrontendResourcesFolder

      public Options withJarFrontendResourcesFolder(File jarFrontendResourcesFolder)
      Sets the appropriate npm package folder for copying flow resources in jars.
      Parameters:
      jarFrontendResourcesFolder - target folder
      Returns:
      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. Not null
      Returns:
      the builder
    • withCopyTemplates

      public Options withCopyTemplates(boolean copyTemplates)
      Sets whether copy templates to META-INF/VAADIN/config/templates.
      Parameters:
      copyTemplates - whether to copy templates
      Returns:
      the builder
    • withEmbeddableWebComponents

      public Options withEmbeddableWebComponents(boolean generateEmbeddableWebComponents)
      Sets whether to collect and package WebComponentExporter dependencies.
      Parameters:
      generateEmbeddableWebComponents - collect dependencies. Default is true
      Returns:
      the builder
    • createMissingPackageJson

      public Options createMissingPackageJson(boolean create)
      Sets whether to create the package file if missing.
      Parameters:
      create - create the package
      Returns:
      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 from
      Returns:
      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
    • getFrontendGeneratedFolder

      public File getFrontendGeneratedFolder()
      Gets the folder where frontend files should be generated.
      Returns:
      folder to generate frontend files in
    • useByteCodeScanner

      public Options useByteCodeScanner(boolean byteCodeScanner)
      Sets frontend scanner strategy: byte code scanning strategy is used if byteCodeScanner is true, full classpath scanner strategy is used otherwise (by default).
      Parameters:
      byteCodeScanner - if true 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 data
      Returns:
      the builder, for chaining
    • withTokenFile

      public Options withTokenFile(File tokenFile)
      Sets the token file (flow-build-info.json) path.
      Parameters:
      tokenFile - token file path
      Returns:
      the builder, for chaining
    • withEnablePnpm

      public Options withEnablePnpm(boolean enable)
      Enables pnpm tool.

      "pnpm" will be used instead of "npm".

      Parameters:
      enable - enables pnpm.
      Returns:
      the builder, for chaining
    • withEnableBun

      public Options withEnableBun(boolean enable)
      Enables bun tool.

      "bun" will be used instead of "npm".

      Parameters:
      enable - enables bun.
      Returns:
      the builder, for chaining
    • withCiBuild

      public Options withCiBuild(boolean ciBuild)
      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

      public Options withForceProductionBuild(boolean forceProductionBuild)
      Setting this to true will force a build of the production build even if there is a default production bundle that could be used.
    • 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, see FrontendTools.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 exec
      Returns:
      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 "v20.10.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, otherwise false
      Returns:
      this builder
    • withFrontendHotdeploy

      public Options withFrontendHotdeploy(boolean frontendHotdeploy)
      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

      public Options withBundleBuild(boolean bundleBuild)
      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

      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 used
      Returns:
      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 folder
      Returns:
      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 for
      Returns:
      the builder, for chaining
    • getNpmFolder

      public File getNpmFolder()
      Get the npm folder used for this build.
      Returns:
      npmFolder
    • getWebappResourcesDirectory

      public File getWebappResourcesDirectory()
      Get the output directory for webpack output.
      Returns:
      webpackOutputDirectory
    • getFrontendDirectory

      public File getFrontendDirectory()
      Get the defined frontend directory.
      Returns:
      frontendDirectory
    • getBuildDirectoryName

      public String getBuildDirectoryName()
      Get the name of the used build directory.

      By default this will be target for maven and build for gradle.

      Returns:
      The name of the build directory
    • getBuildDirectory

      public File getBuildDirectory()
      Gets the directory used for the build output.
      Returns:
      the build directory
    • withFeatureFlags

      public Options withFeatureFlags(com.vaadin.experimental.FeatureFlags featureFlags)
    • getFeatureFlags

      protected com.vaadin.experimental.FeatureFlags getFeatureFlags()
    • getJarFrontendResourcesFolder

      public File 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

      public File getNodeModulesFolder()
    • getResourceOutputDirectory

      public File getResourceOutputDirectory()
    • isEnablePackagesUpdate

      public boolean isEnablePackagesUpdate()
    • isCreateMissingPackageJson

      public boolean isCreateMissingPackageJson()
    • isEnableImportsUpdate

      public boolean isEnableImportsUpdate()
    • isEnableWebpackConfigUpdate

      public boolean isEnableWebpackConfigUpdate()
    • isRunNpmInstall

      public boolean isRunNpmInstall()
    • getJarFiles

      public Set<File> getJarFiles()
    • isGenerateEmbeddableWebComponents

      public boolean isGenerateEmbeddableWebComponents()
    • isCleanNpmFiles

      public boolean isCleanNpmFiles()
    • getLocalResourcesFolder

      public File getLocalResourcesFolder()
    • isUseByteCodeScanner

      public boolean isUseByteCodeScanner()
    • getTokenFileData

      public elemental.json.JsonObject getTokenFileData()
    • getTokenFile

      public File getTokenFile()
    • isEnablePnpm

      public boolean isEnablePnpm()
    • isEnableBun

      public boolean isEnableBun()
    • isCiBuild

      public boolean isCiBuild()
    • isForceProductionBuild

      public boolean isForceProductionBuild()
    • isUseGlobalPnpm

      public boolean isUseGlobalPnpm()
    • isRequireHomeNodeExec

      public boolean isRequireHomeNodeExec()
    • isCopyTemplates

      public boolean isCopyTemplates()
    • getNodeVersion

      public String getNodeVersion()
    • getNodeDownloadRoot

      public URI 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, otherwise false
    • getJavaResourceFolder

      public File getJavaResourceFolder()
      Gets the folder containing java resources, typically src/main/resources in a Maven project.
      Returns:
      the java resource folder
    • getPostinstallPackages

      public List<String> getPostinstallPackages()
    • skipDevBundleBuild

      public Options skipDevBundleBuild(boolean skip)
      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 is false
    • withCompressBundle

      public Options withCompressBundle(boolean compressBundle)
      Set to false to skip frontend bundle compression.
      Parameters:
      compressBundle - false to not compress frontend bundles
      Returns:
      this builder
    • isCompressBundle

      public boolean isCompressBundle()
      Get if frontend bundle should be compressed or not.
      Returns:
      true to copress, false to skip compression