Main class instantiated to prompt for values, build up the data object, and run whatever commands are necessary.

Constructors

Properties

Methods

Constructors

  • Initialize the builder, providing the file url or file path to the init script. (This is used to find the templates dir via a relative path.)

    Parameters

    • src: string

    Returns Init

Properties

positionals: string[]
values: Record<string, string>

Parsed command-line values from util.parseArgs().

If it ends up being set by a prompt, it'll always be a string, possibly '' if no default is provided.

Methods

  • Prompt the user for a given value, returning the value they provide, and saving it to values for Init#build to consume.

    If they have already specified it on the command line, then the prompt is skipped, and this simply returns the value.

    If they have set -y or --yes on the command line, or if the npm_config_yes environment variable is set to "true", and a default is provided, then the prompt is skipped.

    Parameters

    • message: string
    • key: string
    • options: ReadOptions<string> = {}

    Returns Promise<string>

  • Run a command in the target directory.

    This can only be done after the build has completed.

    Parameters

    • cmd: string

    Returns Promise<void>