Enhanced ENV Schema CLI (npm package)
The missing CLI (enhanced) and programmatic wrapper around env-schema that conveniently validates environment variables against JSON Schema in your CI pipelines.
This package provide missing CLI for env-schema and adds support for loading schemas from a file or URL and validating multiple environment files against the same schema.
Motivation
Provide the ready-made env validation for CI pipelines. Simplifies the programmatic validation to get built into custom CI pipelines code.
Key Features
- Validate multiple
.env
files against a single schema - Load schemas from local files or remote URLs
- Detailed error reporting with exact variable mismatches
- TypeScript-first design with full IDE documentation
- Zero runtime dependencies
Engineering Highlights
- Custom error types with aggregated validation failures
- Schema support via file path, URL, or raw objects
- TDD codebase designed for extensibility
Technology
- Node.js + TypeScript
- env-schema + Ajv: Leverages schema validation from
env-schema
internally - Commander.js: Quick and robust command-line UX
- ESM + Type Declarations: Distributed as ES modules with full TypeScript types (
.d.ts
)
Tooling & Development
- Vitest: Snapshot and foundational tests for correctness
- ESLint + Markdown Checker: Code and documentation linting integrated into CI workflow
- tsx + tsc-alias: Efficient TypeScript builds with path alias resolution
- Mockttp + Nock: Used for testing CLI’s external interactions
- Structured packaging: Uses
cpy-cli
,.delivery
folder, andnpm pack
for clean dist builds and publish