NPM Build Utilities @ 0.1.3
    Preparing search index...

    Class BuildStage

    Default build stage.

    0.1.0-alpha

    Hierarchy (View Summary)

    Index

    Config

    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.

    • get ARGS_DEFAULT(): {
          compile: true;
          document: false;
          minimize: (
              _stage: Stage,
          ) => {
              css: false;
              html: false;
              js: false;
              json: { globs: [`${string}/**/*.json`] };
          };
          prettify: (
              _stage: Stage,
          ) => {
              css: readonly [readonly [`${string}/**/*.css`, `${string}/**/*.css`]];
              html: readonly [readonly [`${string}/**/*.html`]];
              js: readonly [
                  readonly [
                      `${string}/**/*.js`,
                      `${string}/**/*.jsx`,
                      `${string}/**/*.js`,
                      `${string}/**/*.jsx`,
                  ],
              ];
              json: readonly [readonly [`${string}/**/*.json`]];
              md: undefined;
              mdx: undefined;
              scss: readonly [readonly [`${string}/**/*.scss`, `${string}/**/*.scss`]];
              ts: readonly [
                  readonly [
                      `${string}/**/*.ts`,
                      `${string}/**/*.tsx`,
                      `${string}/**/*.ts`,
                      `${string}/**/*.tsx`,
                  ],
              ];
              yaml: readonly [readonly [`${string}/**/*.yaml`]];
          };
          replace: (
              stage: Stage,
          ) => { current?: string[]; ignore?: string[]; package?: string[] };
          test: false;
          utils: {};
      }

      Default args for this stage.

      Returns {
          compile: true;
          document: false;
          minimize: (
              _stage: Stage,
          ) => {
              css: false;
              html: false;
              js: false;
              json: { globs: [`${string}/**/*.json`] };
          };
          prettify: (
              _stage: Stage,
          ) => {
              css: readonly [readonly [`${string}/**/*.css`, `${string}/**/*.css`]];
              html: readonly [readonly [`${string}/**/*.html`]];
              js: readonly [
                  readonly [
                      `${string}/**/*.js`,
                      `${string}/**/*.jsx`,
                      `${string}/**/*.js`,
                      `${string}/**/*.jsx`,
                  ],
              ];
              json: readonly [readonly [`${string}/**/*.json`]];
              md: undefined;
              mdx: undefined;
              scss: readonly [readonly [`${string}/**/*.scss`, `${string}/**/*.scss`]];
              ts: readonly [
                  readonly [
                      `${string}/**/*.ts`,
                      `${string}/**/*.tsx`,
                      `${string}/**/*.ts`,
                      `${string}/**/*.tsx`,
                  ],
              ];
              yaml: readonly [readonly [`${string}/**/*.yaml`]];
          };
          replace: (
              stage: Stage,
          ) => { current?: string[]; ignore?: string[]; package?: string[] };
          test: false;
          utils: {};
      }

    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: Stage.SubStage.Build[] = ...

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

        public readonly subStages: Stage.SubStage.Build[] = [
    'compile',
    'replace',
    'prettify',
    'minimize',
    'test',
    'document',
    ];

    Sub-Stages

    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.