1.2.0 • Published 4 years ago

@softvisio/env v1.2.0

Weekly downloads
-
License
ISC
Repository
github
Last release
4 years ago

: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/env

Usage

import env from "@softvisio/env";

console.log(env.root);

env.mode

  • Returns: <string> Value of NODE_ENV or "production".

This property is writable under the nodejs only.

env.isDevelopment

  • Returns: <boolean> true if mode is development.

env.isProduction

  • Returns: <boolean> true if mode is production.

env.isTest

  • Returns: <boolean> true if 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.js export.

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 format project-name/config-name.
  • Returns: <string> | <null> Absolute path to the found config or <null>.

Tries to find application config, following XDG specification.

1.2.0

4 years ago

1.1.0

4 years ago

1.0.0

4 years ago