NPM Build Utilities @ 0.1.3
    Preparing search index...

    Class AbstractStage<T_Args, T_SubStage>Abstract

    Abstract class for a single build stage, along with a variety of utilities for building projects.

    0.1.0-alpha

    Type Parameters

    • T_Args extends Stage.Args

      Argument object for this stage.

    • T_SubStage extends string

      String literal of substages to run within this stage.

    Hierarchy (View Summary)

    Implements

    Index

    Config

    args: T_Args

    A completed args object for this instance.

    clr: Colour

    Colour used for colour-coding this stage.

    config: Config.Class

    Complete project configuration.

    name: string

    Name for this stage used for notices.

    params: Params

    Current CLI params.

    Constructor

    Errors

    • Alias for internal.writeLog.

      Parameters

      • msg: string | string[] | BulkMsgs

        Log message to write.

      • filename: string

        File name for the log.

      • subDir: string[] = []

        Subdirectories used for the path to write the log file.

      • date: null | Date = null

        Used for the timestamp.

      Returns string | false

      If false, writing the log failed. Otherwise, this is the path to the written log file.

    Project

    • get pkg(): {
          bin: undefined
          | string
          | { [key: string]: string };
          bugs: undefined | { email?: string; url?: string };
          config: undefined | { [key: string | number]: any };
          description: undefined | string;
          engines: undefined | { [key: string]: string };
          files: undefined | string[];
          homepage: undefined | string;
          license: undefined | string;
          main: undefined | string;
          name: string;
          repository: undefined | string;
          version: string;
      }

      Current value of the package.json file for this project.

      Returns {
          bin: undefined | string | { [key: string]: string };
          bugs: undefined | { email?: string; url?: string };
          config: undefined | { [key: string | number]: any };
          description: undefined | string;
          engines: undefined | { [key: string]: string };
          files: undefined | string[];
          homepage: undefined | string;
          license: undefined | string;
          main: undefined | string;
          name: string;
          repository: undefined | string;
          version: string;
      }

    Running

    subStages: T_SubStage[]

    All sub-stages to run in this stage (in order).

    • Prints a message to the console signalling the start or end of this build stage.

      Parameters

      • which: null | "start" | "end"

        Whether we are starting or ending.

      • watcherVersion: boolean = false

        Whether to display the watcher version of the message if applicable. Default false.

      Returns void | Promise<void>

    • Runs the given stage as a sub-stage to the current one.

      This method should probably not be overwritten.

      Parameters

      • stage: Name

        Stage to run as a substage.

        • "snapshot"
        • "compile"
        • "test"
        • "document"
        • "build"
        • "package"
        • "release"
      • level: number

        Depth level for output to the console.

      Returns Promise<void>

    Utilities

    compiler: Stage_Compiler

    Instance used to compile files from the src directory.

    console: Stage_Console

    Instance used to send messages to the console.

    • Replaces placeholders in files as defined by Config.replace.

      Parameters

      • globs: string[]

        Where to find & replace placeholders.

      • version: "package" | "current"

        Which version of the replacements to run.

      • level: number

        Depth level for output to the console.

      • ignore: string[] = []

        Globs to ignore while replacing. Default FileSystem.globs.SYSTEM.

      • docsMode: boolean = false

        Whether to make the replacements in 'docs' mode (i.e., assumes markdown in comments was converted to HTML).

      Returns string[]

      Paths where placeholders were replaced.