@rentpath/hive-utils

1.1.3 • Public • Published

hive-utils

Utility methods/classes

makeDir(dir, [options])

Promisified version of mkdirp.

readFile(file, [options])

Promisified of of fs.readFile.

writeFile(file, data, [options])

Promisified version of fs.writeFile.

interpolateName(name, options)

A simplified version of webpack's interpolateName loader utility method.

  • name (String): The filename template. The following tokens are available:
    • [ext] the resource extension
    • [name] the resource basename
    • [path] the resource path, relative to the context option
    • [folder] the directory the resource is in
    • [hash] a md5 hash of either options.content or options.resource
  • options (Object): A configuration object supporting the following options:
    • resource (String): The relative file path of a resource.
    • context (String): An absolute directory path that template tokens are resolved relative to (optional).
    • content (String): If provided, is used as source content when generating a hash token (optional).

Env

A collection of methods for interacting with environment variables.

Env.load(paths, [options])

A light wrapper around dotenv.config for loading environment variables.

  • paths (String|Array) A single environment file path, or an array of paths.
  • options (Object) Configuration options passed to dotenv.config.

Env.get(key, [default])

  • key (String) The environment variable name.
  • default (String) A default if the value is undefined. Reads environment variables from process.env.

Env.set(key, value)

  • key (String) The environment variable name.
  • value (String) The environment variable value. Writes environment variables to process.env.

Log

A collection of methods that wrap chalk for printing console messages.

Log.print(message, [color])

Logs a message to the console with a given color (defaults to white).

Log.info(message)

Logs a info message using blue color.

Log.warn(message)

Logs a warning message using orange color.

Log.success(message)

Logs a success message using green color.

Log.error(message)

Logs a error message using red color.

Readme

Keywords

none

Package Sidebar

Install

npm i @rentpath/hive-utils

Weekly Downloads

18

Version

1.1.3

License

MIT

Unpacked Size

9.7 kB

Total Files

11

Last publish

Collaborators

  • orionstein
  • rentpath-admin
  • tadjohnston
  • ninomichaels
  • plifshiz
  • kevinolson
  • mneumark83
  • patmfitz
  • kaborso
  • cubbyjs