src/contains all TypeScript source. Public entrypoint issrc/index.ts, which re‑exports the main API (envParse) and error types.- Core logic lives in
src/structured.ts; errors are defined insrc/errors.ts. - Tests are colocated in
src/*.test.ts(currentlysrc/structured.test.ts). - Build output goes to
dist/(generated bytsc; not committed).
This repo uses Bun + TypeScript.
bun install— install dependencies.bun run build— compilesrc/todist/usingtsconfig.build.json.bun run typecheck— run TypeScript in--noEmitmode.bun run lint— type‑aware lint viaoxlintand formatting check viaoxfmt --check.bun run fmt— auto‑format files withoxfmt.bunx vitest— run the Vitest suite (config:vitest.config.ts). Add--watchfor TDD.
- TypeScript, ESM (
"type": "module"). Keep imports/exports explicit and tree‑shakable. - Indentation: 2 spaces. Prefer double quotes in TS to match existing files.
- Filenames:
kebab-case.ts; tests:*.test.ts. - Keep API surface in
src/index.ts; add new helpers in focused modules undersrc/. - Run
bun run fmtbefore pushing.
- Framework: Vitest. Tests should live next to the module they cover (e.g.,
src/foo.test.ts). - Prefer small, deterministic unit tests. Cover both valid parsing and validation error paths.
- Commit messages are short, imperative, and scoped to the change (e.g.,
fix defaults,add async guard). No enforced conventional‑commit format. - PRs should include: a clear description, rationale, and any API changes with examples. If behavior changes, add/adjust tests.
- Never commit real secrets. Use
.envlocally and document new variables inREADME.mdexamples.