NPM Build Utilities @ 0.2.0-alpha.1
    Preparing search index...

    Class PackageStage

    Default package 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(): { utils: {} }

      Default args for this stage.

      Returns { utils: {} }

    • get releaseDir(): string

      Path to release directory for building a package for the current version.

      Returns string

    • Gets the paths from the config for the given dist sub directory.

      Parameters

      • OptionalsubDir: DistDirectory

        Sub-path to get.

      • ...subpaths: string[]

        Optional additional subpaths.

      Returns string

    • Gets an absolute path to the Config.Paths.scripts directories.

      Parameters

      • OptionalsubDir: "logs"

        Sub-path to get.

      • ...subpaths: string[]

        Optional additional subpaths.

      Returns string

    • If there's a subdir, the return will be an array of strings.

      Parameters

      • subDir: SourceDirectory

        Sub-path to get.

      • ...subpaths: string[]

        Optional additional subpaths.

      Returns string[]

    • If there's no subdir, the return will be a string.

      Parameters

      • OptionalsubDir: undefined

        Sub-path to get.

      • ...subpaths: string[]

        Optional additional subpaths.

      Returns string

    Constructor

    Errors

    • Alias for internal.logError.

      Parameters

      • logMsg: string

        Message to prepend to the return for output to the console.

      • error: unknown

        Caught error to log.

      • level: number

        Depth level for output to the console.

      • OptionalerrMsg: string
      • Optionaldate: Date

        Used for the timestamp.

      Returns BulkMsgs

    • Handles uncaught errors in node.

      Parameters

      • error: unknown

        To handle.

      Returns void

      0.2.0-alpha

    • 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 isDraftVersion(): boolean

      Wheather the current project version is a draft (e.g., this is not a non-dryrun release).

      Returns boolean

    • 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;
      }

    • get version(): SemVer

      Current version object for the project.

      Returns SemVer

    • set version(input: undefined | string | SemVer): void

      If undefined, nothing is set. Otherwise, a SemVer is created and the value of AbstractStage.pkg.version is updated.

      Parameters

      • input: undefined | string | SemVer

      Returns void

    Running

    subStages: Stage.SubStage.Package[] = ...

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

        public readonly subStages: Stage.SubStage.Package[] = [
    'snapshot',
    'build',
    'copy',
    'zip',
    ];
    • 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.

      Returns Promise<void>

    • Experimental

      This runs a custom sub-stage that only copies a whole folder at the given subpath from the source to the dist directories.

      Deletes any existing, logs update messages, etc.

      Parameters

      • subpath: string

        The subdriectory, relative to src path.

      • Optional_distDir: string

        Optionally force a diffrent output directory than the auto-generated one.

      • logLevelBase: number = 1

        Base output level for log messages.

      Returns Promise<void>

      0.1.4-alpha

      0.2.0-alpha.1 — Added logLevelBase param.

    • Experimental

      This runs a custom sub-stage that uses globs to find non-partial scss/sass files and compile them at the given subpath from the source to the dist directories.

      Deletes any existing, logs update messages, etc.

      Parameters

      • subpath: string

        The subdriectory, relative to src path.

      • Optional_distDir: string

        Optionally force a diffrent output directory than the auto-generated one.

      • postCSS: boolean = true

        Whether to run PostCSS on the output css. Default true.

      • logLevelBase: number = 1

        Base output level for log messages.

      Returns Promise<void>

      0.1.4-alpha

      0.2.0-alpha — Added postCSS param and PostCSS compatibility.

      0.2.0-alpha.1 — Added logLevelBase param.

    • 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>

    • Runs the prompters to confirm before starting the substages.

      Returns Promise<void>

    Sub-Stages

    • Runs the project's build class.

      Returns Promise<void>

    • Copies all project files to the release directory.

      Returns Promise<void>

    • Runs the project's snapshot class.

      Returns Promise<void>

    • Zips the release directory.

      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.

    • get fs(): FileSystem

      Instance used to deal with files and paths.

      Returns FileSystem

    • set fs(fs: undefined | FileSystem): void

      Instance used to deal with files and paths.

      Parameters

      Returns void

    • If there's a subdir, the return will be an array of strings.

      Parameters

      • subDir: SourceDirectory

        Sub-path to get.

      • ...subpaths: string[]

        Optional additional subpaths.

      Returns string[]

    • If there's no subdir, the return will be a string.

      Parameters

      • OptionalsubDir: undefined

        Sub-path to get.

      • ...subpaths: string[]

        Optional additional subpaths.

      Returns string

    • 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.