1.2.0 • Published 4 years ago
@softvisio/env v1.2.0
:information_source: Please, see the full project documentation here: https://softvisio.github.io/env/.
Introduction
Provides set of function to manage project environment.
Install
npm i @softvisio/envUsage
import env from "@softvisio/env";
console.log(env.root);env.mode
- Returns: <string> Value of
NODE_ENVor"production".
This property is writable under the nodejs only.
env.isDevelopment
- Returns: <boolean>
trueif mode is development.
env.isProduction
- Returns: <boolean>
trueif mode is production.
env.isTest
- Returns: <boolean>
trueif mode is test.
env.root
- Returns: <string> Top-level package root directory.
env.package
- Returns: <Object> Top-level
package.json.
env.apply( env, options? )
env<Object>options?<Object>
readConfig( options? )
options?<Object>
env.getUserConfig()
- Returns: <Promise> Fullfils with the
softvisio/config.jsexport.
env.getXDGConfigDir( name )
name<string> Project name.- Returns: <string> Path to the project XDG config directory.
env.getXDGDataDir( name )
name<string> Project name.- Returns: <string> Path to the project XDG data directory.
env.getXDGCacheDir( name )
name<string> Project name.- Returns: <string> Path to the project XDG cache directory.
env.getXDGRuntimeDir( name )
name<string> Project name.- Returns: <string> Path to the project XDG runtime directory.
env.findXDGConfig( name )
name<string> Config name in the formatproject-name/config-name.- Returns: <string> | <null> Absolute path to the found config or <null>.
Tries to find application config, following XDG specification.