Skip to content

Latest commit

 

History

History
77 lines (53 loc) · 2.13 KB

OPTIONAL-DEP.md

File metadata and controls

77 lines (53 loc) · 2.13 KB

Skipping optional dependencies

To reduce dependency size, you can install nest-typed-config without optional dependencies with:

# No optional dependency is installed
$ npm i --no-optional nest-typed-config

By skipping optional dependencies, you have to install the dependencies of configuration loaders by yourself. Please checkout the installation guide for corresponding loader:

Installation guide for different loaders

Dotenv loader

To use dotenvLoader, you should install dotenv first. If you want to expand environment variables, dotenv-expand should be installed as well.

# For NPM
$ npm i --save dotenv

# If you want to expand environment variables, remember to install dotenv-expand
$ npm i --save dotenv dotenv-expand

File loader

To use fileLoader, you should install cosmiconfig first. If you want to load .toml configuration files, @iarna/toml should be installed as well.

# For NPM
$ npm i --save cosmiconfig

# If you want to load .toml configs, remember to install @iarna/toml
$ npm i --save @iarna/toml

Directory loader

To use directoryLoader, you should install cosmiconfig first. If you want to load .toml configuration files, @iarna/toml should be installed as well.

# For NPM
$ npm i --save cosmiconfig

# If you want to load .toml configs, remember to install @iarna/toml
$ npm i --save @iarna/toml

Remote loader

To use remoteLoader, you should install @nestjs/axios first. Then, depending on the config file format, you should install corresponding config file parser. That is:

  • parse-json to parse .json configurations.
  • yaml to parse .yml or .yaml configurations.
  • toml to parse .toml configurations.
$ npm i --save @nestjs/axios

# For .toml config
$ npm i --save @iarna/toml
# For .json config
$ npm i --save parse-json
# For .yaml/.yml config
$ npm i --save yml

Custom loader

Just implement your own logic, no extra dependency is required!