com.vaadin.flow.server.frontend.
Class NodeTasks.Builder
- java.lang.Object
-
- com.vaadin.flow.server.frontend.NodeTasks.Builder
-
All Implemented Interfaces:
Enclosing class:
public static class NodeTasks.Builder extends Object implements Serializable
Build a
NodeExecutor
instance.See Also:
-
-
Field Summary
Fields Modifier and Type Field and Description File
generatedFolder
Directory where generated files are written.
File
npmFolder
Directory for for npm and folders and files.
-
Constructor Summary
Constructors Constructor and Description Builder(ClassFinder classFinder, File npmFolder)
Create a builder instance given an specific npm folder.
Builder(ClassFinder classFinder, File npmFolder, File generatedPath)
Create a builder instance with custom npmFolder and generatedPath
Builder(ClassFinder classFinder, File npmFolder, File generatedPath, File frontendDirectory)
Create a builder instance with all parameters.
-
Method Summary
All Methods Modifier and Type Method and Description NodeTasks
build()
Creates a
NodeExecutor
using this configuration.NodeTasks.Builder
copyLocalResources(File frontendResourcesDirectory)
Set local frontend files to be copied from given folder.
NodeTasks.Builder
copyResources(Set<File> jars)
Sets whether copy resources from classpath to the `node_modules` folder as they are available for webpack build.
NodeTasks.Builder
createMissingPackageJson(boolean create)
Sets whether to create the package file if missing.
NodeTasks.Builder
enableImportsUpdate(boolean enableImportsUpdate)
Sets whether to enable imports file update.
NodeTasks.Builder
enableNpmFileCleaning(boolean forceClean)
Sets whether to perform always perform clean up procedure.
NodeTasks.Builder
enablePackagesUpdate(boolean enablePackagesUpdate)
Sets whether to enable packages and webpack file updates.
NodeTasks.Builder
populateTokenFileData(elemental.json.JsonObject object)
Fill token file data into the provided
object
.NodeTasks.Builder
runNpmInstall(boolean runNpmInstall)
Sets whether run
npm install
after updating dependencies.NodeTasks.Builder
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).NodeTasks.Builder
withEmbeddableWebComponents(boolean generateEmbeddableWebComponents)
Sets whether to collect and package
WebComponentExporter
dependencies.NodeTasks.Builder
withPolymerVersion(String version)
Sets the polymer version to use.
NodeTasks.Builder
withTokenFile(File tokenFile)
Sets the token file (flow-build-info.json) path.
NodeTasks.Builder
withWebpack(File webpackOutputDirectory, String webpackTemplate, String webpackGeneratedTemplate)
Sets the webpack related properties.
-
-
-
Field Detail
-
npmFolder
public final File npmFolder
Directory for for npm and folders and files.
-
generatedFolder
public final File generatedFolder
Directory where generated files are written.
-
-
Constructor Detail
-
Builder
public Builder(ClassFinder classFinder, File npmFolder)
Create a builder instance given an specific npm folder.
Parameters:
classFinder
- a class findernpmFolder
- folder with the `package.json` file
-
Builder
public Builder(ClassFinder classFinder, File npmFolder, File generatedPath)
Create a builder instance with custom npmFolder and generatedPath
Parameters:
classFinder
- a class findernpmFolder
- folder with the `package.json` filegeneratedPath
- folder where flow generated files will be placed.
-
Builder
public Builder(ClassFinder classFinder, File npmFolder, File generatedPath, File frontendDirectory)
Create a builder instance with all parameters.
Parameters:
classFinder
- a class findernpmFolder
- folder with the `package.json` filegeneratedPath
- folder where flow generated files will be placed.frontendDirectory
- a directory with project's frontend files
-
-
Method Detail
-
build
public NodeTasks build()
Creates a
NodeExecutor
using this configuration.Returns:
a
NodeExecutor
instance
-
withWebpack
public NodeTasks.Builder withWebpack(File webpackOutputDirectory, String webpackTemplate, String webpackGeneratedTemplate)
Sets the webpack related properties.
Parameters:
webpackOutputDirectory
- the directory to set for webpack to output its build results.webpackTemplate
- name of the webpack resource to be used as template when creating thewebpack.config.js
file.webpackGeneratedTemplate
- name of the webpack resource to be used as template when creating thewebpack.generated.js
file.Returns:
this builder
-
enablePackagesUpdate
public NodeTasks.Builder 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
-
enableNpmFileCleaning
public NodeTasks.Builder enableNpmFileCleaning(boolean forceClean)
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.Parameters:
forceClean
-true
to clean npm files always, otherwisefalse
Returns:
this builder
-
enableImportsUpdate
public NodeTasks.Builder 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 NodeTasks.Builder runNpmInstall(boolean runNpmInstall)
Sets whether run
npm install
after updating dependencies.Parameters:
runNpmInstall
- run npm install. Default isfalse
Returns:
the builder
-
copyResources
public NodeTasks.Builder copyResources(Set<File> jars)
Sets whether copy resources from classpath to the `node_modules` folder as they are available for webpack build.
Parameters:
jars
- set of class nodes to be visited. Notnull
Returns:
the builder
-
withEmbeddableWebComponents
public NodeTasks.Builder withEmbeddableWebComponents(boolean generateEmbeddableWebComponents)
Sets whether to collect and package
WebComponentExporter
dependencies.Parameters:
generateEmbeddableWebComponents
- collect dependencies. Default istrue
Returns:
the builder
-
createMissingPackageJson
public NodeTasks.Builder createMissingPackageJson(boolean create)
Sets whether to create the package file if missing.
Parameters:
create
- create the packageReturns:
the builder
-
copyLocalResources
public NodeTasks.Builder copyLocalResources(File frontendResourcesDirectory)
Set local frontend files to be copied from given folder.
Parameters:
frontendResourcesDirectory
- folder to copy local frontend files fromReturns:
the builder, for chaining
-
useByteCodeScanner
public NodeTasks.Builder 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 NodeTasks.Builder 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 NodeTasks.Builder withTokenFile(File tokenFile)
Sets the token file (flow-build-info.json) path.
Parameters:
tokenFile
- token file pathReturns:
the builder, for chaining
-
withPolymerVersion
public NodeTasks.Builder withPolymerVersion(String version)
Sets the polymer version to use.
Parameters:
version
- a polymer versionReturns:
the builder, for chaining
-
-