Builder
This is the main "bridge service" for building: It connects the rest of the building services and perform most of the "building-related tasks".
Constructor Summary
Public Constructor | ||
public |
constructor(buildCleaner: BuildCleaner, buildCopier: BuildCopier, buildEngines: BuildEngines, buildTranspiler: buildTranspiler, targets: Targets) Class constructor. |
Member Summary
Public Members | ||
public |
A local reference for the |
|
public |
A local reference for the |
|
public |
A local reference for the |
|
public |
A local reference for the |
|
public |
A local reference for the |
Method Summary
Public Methods | ||
public |
cleanTarget(targetName: string | target): Promise<undefined, Error> Removes all previous builds/copies of a target from the distribution directory. |
|
public |
Copy a target files to the distribution directory. |
|
public |
getTargetBuildCommand(target: Target, buildType: string, forceRun: boolean, forceWatch: boolean, forceInspect: boolean, forceAnalyze: boolean): string Get a build command for a target. |
|
public |
Transpile a target files that have been previously copied to the distribution directory. |
Public Constructors
public constructor(buildCleaner: BuildCleaner, buildCopier: BuildCopier, buildEngines: BuildEngines, buildTranspiler: buildTranspiler, targets: Targets) source
Class constructor.
Params:
Name | Type | Attribute | Description |
buildCleaner | BuildCleaner | Used to clean a target builded files before building again. |
|
buildCopier | BuildCopier | Used to copy a target files if it doesn't require bundling. |
|
buildEngines | BuildEngines | To access the engines in charge of building targets. |
|
buildTranspiler | buildTranspiler | To transpile files of atarget that doesn't require bundling. |
|
targets | Targets | To access targets information. |
Public Members
Public Methods
public cleanTarget(targetName: string | target): Promise<undefined, Error> source
Removes all previous builds/copies of a target from the distribution directory.
Params:
Name | Type | Attribute | Description |
targetName | string | target | The name of the target, or the target itself. |
public copyTarget(targetName: string, buildType: string): Promise<undefined, Error> source
Copy a target files to the distribution directory. The only reason to copy a target files are:
If the target needs to be transpiles or if the build type is production
, on all the other
cases the method won't do anything.
public getTargetBuildCommand(target: Target, buildType: string, forceRun: boolean, forceWatch: boolean, forceInspect: boolean, forceAnalyze: boolean): string source
Get a build command for a target. If the target doesn't require bundling, it will return an empty string, otherwise, it will ask the build engine the target uses for the required shell command.
Params:
Name | Type | Attribute | Description |
target | Target | The target information. |
|
buildType | string | The type of build intended: |
|
forceRun | boolean |
|
Whether or not the build command should also run the
target. It's "forced" because it overwrites the
|
forceWatch | boolean |
|
Whether or not the target files should be watched and the build recreated when they changed. |
forceInspect | boolean |
|
Whether or not the Node inspector should be enabled. Only valid for Node targets. |
forceAnalyze | boolean |
|
Whether or not the target bundle should be analyzed. |
TODO:
- These parameters should be an object.