@dragon-syndicate/dotenv-mono
v1.2.1
Published
Simplify and consolidate the .env files used by a mono repo
Downloads
143
Readme
dotenv-mono
Initial Setup
Architecture
Environment variables are loaded from multiple folders, starting with the current working directory (cwd) and moving up the directory tree until the max depth is reached. The root directory is considered to be the directory at the top of the directory tree, based on the max depth. The environment variables will be loaded starting with the .env
files in the root directory and then moving down the directory tree until the cwd is reached.
Variables are processed from the .env
file into Environment variables based on when they are loaded. Variable interpolation is supported for all variables loaded from the .env
files. If a variable has not already been loaded into the Environment variables and is referenced using interpolation, it will result in an empty string.
A variable defined in multiple .env
files will be overwritten by the last .env
file that is loaded. This means that the .env
file in the cwd will overwrite any variables that are defined in the .env
files in the parent directories.
ENV
and an extension can be added to the .env
files to load additional variables based on the extension. The .env
files are loaded in the following order in each directory:
.env
.env.local
.env.<ENV>
.env.<ENV>.local
.env.<extension>
.env.<extension>.local
.env.<extension>.<ENV>
.env.<extension>.<ENV>.local
Release Process
- The package will build all its files to the root
dist
folder to be published to npmjs- Semantic versioning and Changelog is implement via GitHub Actions
- Deployment is implemented via GitHub Actions
- Published Package only contains: - minified code - README.md - LICENSE.md - package.json (with private packages removed) - changelog
Development
- Run command (Serves the application local on the developers machine):
pnpm run dev
- Test command (Executes the unit tests against the developers local copy of the repository):
pnpm run test
- Build command (Builds the application for deployment):
pnpm run build
- Clean command (Removes all build artifacts build dependencies):
pnpm run clean
Additional Information
To locally test the release process you will need to run the command in the root directory cd dist && npx semantic-release --dry-run
.
NOTE: This command will only work if you have already logged in to npmjs via the command npm login
.