Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Builder

Builds scaffolding files and directories copying from a Blueprint src directory.

Hierarchy

  • Builder

Index

Properties

Private genStore

genStore: BlueprintStore

Stores all the blueprints

type

{{}}

Static Private nameConstrain

nameConstrain: RegExp = /^[a-z0-9_]+$/i

Alphanumeric and underscore regex, used to constrain the Name of new generated module.

type

{RegExp}

Static Private replaceName

replaceName: string = "__name__"

String to be replaced when build the blueprint, in any file or directory name, or withing the file content.

Methods

addBlueprints

  • addBlueprints(rootPath: string): void
  • Search for all the blueprint in the 'rootPath' and add them to the genreratorsRegistry

    Parameters

    • rootPath: string

    Returns void

build

  • build(blueprintName: string, moduleName: string, destPath: string): string[]
  • Builds a new directory structure based on the selected blueprint with 'blueprintName'.

    When building de directory structure of the blueprint is copied from the blueprint to the 'destPath'. All Directories, file Names and string occurrences matching the string 'name' are replaced by the string 'moduleName'

    Parameters

    • blueprintName: string
    • moduleName: string
    • destPath: string

    Returns string[]

    a list of the files generated

getBlueprintNames

  • getBlueprintNames(): string[]
  • Returns an array containing all the names of the available blueprints.

    Returns string[]

Static findBlueprints

  • findBlueprints(rootPath: string): Blueprint[]
  • Search for all the blueprints in a given 'rootPath'. A blueprint is any subdirectory of rootPaht containing another subdirectory named "name". The search is not recursive the blueprint needs to be a direct subdirectory of rootPath.

    rootPath +── blueprint1 | └── name | +── nameController.js | +── nameController.js | └── nameTemplate.html └── blueprint2 └── name +── nameController.js +── nameController.js └── nameTemplate.html

    Parameters

    • rootPath: string

    Returns Blueprint[]

Static getNameConstrain

  • getNameConstrain(): RegExp
  • Returns the regexp used to constrain the allowed module names

    Returns RegExp

Static Private replacePath

  • replacePath(path: string, src_root: string, dest_root: string, moduleName: string): string
  • Gets a blueprint path and return the path required for the new generated file/directory

    Parameters

    • path: string
    • src_root: string
    • dest_root: string
    • moduleName: string

    Returns string

Generated using TypeDoc