1.1.0 • Published 3 years ago
yanv v1.1.0
Yanv
Tiny CLI that converts any YAML file into a .env file.
ℹ️ This lib is intended to be used with the dotenv lib.
✨ Features
The package includes the following features:
- watch for file change:
--watchor-w - run a command after .env generation:
--commandor-c - take custom file:
--fileor-f - look for YAML .env with specific suffix file:
--suffixor-s - output in a .env file instead of running command with the loaded environment:
--outputor-o - avoid overriding existing environment variables:
--noOverrideor-n
Get started
- Install the dependecy as dev dependency:
npm install --dev yanvyarn add --dev yanvpnpm add --save-dev yanv- Use
yanvin your package.json scripts like:
# Basic usage. Will build .env.yaml or .env.yml
yanv
# Run a command and watch for env. changes
yanv -c 'yarn dev' --watch
# Look for .env.staging.yaml or .env.staging.yml
yanv -s 'staging' --watch
# Look for a specific file
yanv -c 'yarn dev' --watch --file yanv/my-yanv.yamlWhy this lib?
At Fifteen, we have some projects with a lot a .env configurations in variables, including ones which change frequently for internal testing (API URLs, theming, config...).
We developped this lib to suit our needs, notably by using the --watch and --command options.