Options
All
  • Public
  • Public/Protected
  • All
Menu

Generator environment adapter to be used for generator loading, usage, and invocation.

Hierarchy

  • GeneratorEnv

Index

Constructors

constructor

Methods

list

  • list(name?: string | string[]): string[]
  • list available generators by name. This method does not add the generators to the environment, and is generally useful when validating user inputs that lead to generator invocation.

    Parameters

    • Optional name: string | string[]

      filter to a specific generator by name(s)

    Returns string[]

load

  • load(generators?: string | string[]): this

loadAll

  • loadAll(): this
  • Convenience method for loading all generator implementations in the workspace same as this.load() with no arguments

    Returns this

namespace

  • namespace(name: string): this
  • Give the generators a namespace (prefix)

    Parameters

    • name: string

      the namespace to set

    Returns this

reset

  • reset(): this
  • Reset the environment to clear registered generators

    Returns this

run

  • Invoke a generator registered with the environment

    todo

    generator args can include both options and arguments to be parsed by the generator.

    Parameters

    • generator: string

      generator name to run

    • Default value options: IBaseGeneratorOptions = {}

      options passed to the generator

    • Rest ...args: any[]

      additional arguments to run inside the generator

    Returns Promise<void>

usage

Static relativeTo

  • Create an instance relative to a fs path. Both a generators and a templates directory must exist in a directory above or at the provided source

    Parameters

    • src: string

      path of file or directory from which the env is based

    • Optional namespace: string

      generator namespace to use, if any

    Returns GeneratorEnv