Options
All
  • Public
  • Public/Protected
  • All
Menu

zignis

Index

Variables

Let cachedInstance

cachedInstance: NodeCache

Const delay

delay: sleep = sleep

hash

hash: hash

Functions

Const debugCore

  • debugCore(...args: any[]): any
  • debug core

    Parameters

    • Rest ...args: any[]

    Returns any

Const error

  • error(message: any, exit?: boolean, errorCode?: number): void
  • Print error message, and exit process.

    Parameters

    • message: any

      Error message to log

    • Default value exit: boolean = true
    • Default value errorCode: number = 1

      Error code

    Returns void

Const exec

  • exec(command: string, options?: any): any
  • Execute command, because npm install running info can not be catched by shelljs, temporarily use this one

    Parameters

    • command: string

      Command to exec

    • Default value options: any = {}

      Options stdio default is [0, 1, 2]

    Returns any

Const extendSubCommand

  • extendSubCommand(command: string, module: string, yargs: Argv, basePath: string): void
  • Extend command's sub command, it give other plugins an opportunity to extend it's sub command. So if you want other plugins to extend your sub commands, you can use this util function to replace default yargs.commandDir

    Parameters

    • command: string

      Current command name.

    • module: string

      Current plugin name.

    • yargs: Argv

      Yargs reference.

    • basePath: string

      Often set to __dirname.

    Returns void

Const fileExistsSyncCache

  • fileExistsSyncCache(filePath: any): any
  • Parameters

    • filePath: any

    Returns any

Const formatRcOptions

  • formatRcOptions(opts: any): object
  • Format options keys

    Make compatible of param cases and camel cases

    Parameters

    • opts: any

    Returns object

Const getAllPluginsMapping

  • getAllPluginsMapping(): object
  • Get all plugins path mapping. Same name plugins would be overriden orderly. This function also influence final valid commands and configs.

    Returns object

    • [propName: string]: string

Const getApplicationConfig

  • getApplicationConfig(cwd?: string | undefined): any
  • Get application zignis config only.

    Parameters

    • Default value cwd: string | undefined = undefined

    Returns any

Const getCache

  • getCache(namespace: string): NodeCache
  • Get Zignis cache instance by namespace

    Parameters

    • namespace: string

    Returns NodeCache

Const getCombinedConfig

  • getCombinedConfig(): object
  • Get commbined config from whole environment.

    Returns object

    • [propName: string]: any

Const getInternalCache

  • getInternalCache(): NodeCache
  • Get Zignis internal cache instance

    Returns NodeCache

Const getNodeEnv

  • getNodeEnv(): string
  • Get current node env setting

    You can change the node-env-key in command args or zignis rc file

    Returns string

Const info

  • info(message: any, exit?: boolean, errorCode?: number): void
  • Print info message with green color.

    Parameters

    • message: any

      Error message to log

    • Default value exit: boolean = false
    • Default value errorCode: number = 0

    Returns void

Const invokeHook

  • invokeHook(hook: string, options?: IHookOption): Promise<any>
  • Run hook in all valid plugins and return the combined results. Plugins implement hook in module.exports, could be generator function or promise function or non-function For non-function, it will be used as hook data directly, likely to be returned by function

    Parameters

    • hook: string

      Hook name, suggest plugin defined hook include a prefix, e.g. zhike:hook

    • Default value options: IHookOption = { mode: 'assign' }

      Options

    Returns Promise<any>

Const isDevelopment

  • isDevelopment(): boolean
  • Shortcut for checking if or not current env is development

    Returns boolean

Const isProduction

  • isProduction(): boolean
  • Shortcut for checking if or not current env is production

    Returns boolean

Const loadCorePackageInfo

  • loadCorePackageInfo(): any
  • Load core package.json

    Returns any

Const loadPackageInfo

  • loadPackageInfo(pkg?: string | undefined, paths?: never[]): any
  • Load any package's package.json

    Parameters

    • Default value pkg: string | undefined = undefined

      package name

    • Default value paths: never[] = []

      search paths

    Returns any

Const log

  • log(message: any): void
  • Print message with format and color.

    Parameters

    • message: any

      Message to log

    Returns void

Const md5

  • md5(s: string): string
  • Compute md5.

    Parameters

    • s: string

    Returns string

Const outputTable

  • outputTable(columns: string[][], caption: string, borderOptions?: object): void
  • Print a simple table. A table style for zignis status, if you don't like this style, can use Utils.table

    Parameters

    • columns: string[][]

      Table columns

    • caption: string

      Table caption

    • Default value borderOptions: object = {}

      Border options

    Returns void

Const parsePackageNames

  • parsePackageNames(input: string | string[]): string[]
  • Parse packages from yargs option

    Parameters

    • input: string | string[]

      yarns option input, could be string or array

    Returns string[]

    Package list

Const sleep

  • sleep(ms: number): Promise<unknown>
  • Sleep a while of ms

    Parameters

    • ms: number

    Returns Promise<unknown>

Const splitByChar

  • splitByChar(input: string, char: string): string[]
  • Split input by a specific char and blank.

    Parameters

    • input: string
    • char: string

    Returns string[]

    input separated by comma

Const splitComma

  • splitComma(input: string): string[]
  • Split input by comma and blank.

    Parameters

    • input: string

    Returns string[]

    input separated by comma

Const success

  • success(message: any, exit?: boolean, errorCode?: number): void
  • Print success message with green color.

    Parameters

    • message: any

      Error message to log

    • Default value exit: boolean = false
    • Default value errorCode: number = 0

    Returns void

Const warn

  • warn(message: any, exit?: boolean, errorCode?: number): void
  • Print warn message with yellow color.

    Parameters

    • message: any

      Error message to log

    • Default value exit: boolean = false
    • Default value errorCode: number = 0

    Returns void

Generated using TypeDoc