@rentpath/hive-utils
v1.1.3
Published
Utility methods/classes
Downloads
10
Maintainers
Keywords
Readme
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 thecontext
option[folder]
the directory the resource is in[hash]
a md5 hash of eitheroptions.content
oroptions.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 todotenv.config
.
Env.get(key, [default])
key
(String) The environment variable name.default
(String) A default if the value is undefined. Reads environment variables fromprocess.env
.
Env.set(key, value)
key
(String) The environment variable name.value
(String) The environment variable value. Writes environment variables toprocess.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.