Home Manual Reference Source
public class | source

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 buildCleaner service.

public

A local reference for the buildCopier service.

public

A local reference for the buildEngines service.

public

A local reference for the buildTranspiler service.

public

A local reference for the targets service.

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

copyTarget(targetName: string, buildType: string): Promise<undefined, Error>

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

transpileTarget(targetName: string, buildType: string): Promise<undefined, Error>

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:

NameTypeAttributeDescription
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 buildCleaner: BuildCleaner source

A local reference for the buildCleaner service.

public buildCopier: BuildCopier source

A local reference for the buildCopier service.

public buildEngines: BuildEngines source

A local reference for the buildEngines service.

public buildTranspiler: BuildTranspiler source

A local reference for the buildTranspiler service.

public targets: Targets source

A local reference for the targets service.

Public Methods

public cleanTarget(targetName: string | target): Promise<undefined, Error> source

Removes all previous builds/copies of a target from the distribution directory.

Params:

NameTypeAttributeDescription
targetName string | target

The name of the target, or the target itself.

Return:

Promise<undefined, Error>

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.

Params:

NameTypeAttributeDescription
targetName string

The name of the target.

buildType string

The type of build it's being made: production or development.

Return:

Promise<undefined, Error>

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:

NameTypeAttributeDescription
target Target

The target information.

buildType string

The type of build intended: production or development.

forceRun boolean
  • optional
  • default: false

Whether or not the build command should also run the target. It's "forced" because it overwrites the runOnDevelopment setting.

forceWatch boolean
  • optional
  • default: false

Whether or not the target files should be watched and the build recreated when they changed.

forceInspect boolean
  • optional
  • default: false

Whether or not the Node inspector should be enabled. Only valid for Node targets.

forceAnalyze boolean
  • optional
  • default: false

Whether or not the target bundle should be analyzed.

Return:

string

TODO:

  • These parameters should be an object.

public transpileTarget(targetName: string, buildType: string): Promise<undefined, Error> source

Transpile a target files that have been previously copied to the distribution directory. If the target is not a Node target or it doesn't require transpiling, this method won't do anything.

Params:

NameTypeAttributeDescription
targetName string

The name of the target.

buildType string

The type of build it's being made: production or development.

Return:

Promise<undefined, Error>