TypeScript configuration library that normalizes how values are loaded from multiple sources.
npm install @jonloucks/variants-ts
import {
BOOTSTRAPPED,
VERSION,
createInstaller,
type Installer,
type InstallerConfig
} from '@jonloucks/variants-ts';
import {
createEnvironment,
createProcessSource,
createRecordSource,
createVariant,
CONTRACTS
} from "@jonloucks/variants-ts/auxiliary/Convenience";
const portVariant = createVariant<string>({
name: "server.port",
keys: ["PORT"],
fallback: "3000"
});
const processSource = createProcessSource();
const recordSource = createRecordSource({ PORT: "8080" });
const env = createEnvironment({
sources: [processSource, recordSource]
});
const port = env.getVariance(portVariant);
npm install
npm run build
npm test
npm run test:watch
npm run test:coverage
npm run lint
npm run lint:fix
npm run docs
variants-ts
├── .github/
│ └── workflows/
│ ├── main-pull-request-matrix.yml
│ ├── main-pull-request-smoke.yml
│ ├── main-pull-request.yml
│ ├── main-push-smoke.yml
│ ├── main-push.yml
│ ├── main-release-smoke.yml
│ └── main-release.yml
├── CODE_OF_CONDUCT.md
├── CODING_STANDARDS.md
├── CONTRIBUTING.md
├── .editorconfig
├── eslint.config.mjs
├── LICENSE
├── package-lock.json
├── package.json
├── PULL_REQUEST_TEMPLATE.md
├── README.md
├── SECURITY.md
├── DOCUMENTATION.md
├── notes/
├── src/
│ ├── api/
│ ├── auxiliary/
│ ├── data/
│ ├── impl/
│ ├── test/
│ ├── index.ts
│ └── version.ts
├── tsconfig.json
└── typedoc.json
The CI workflow runs on every push and pull request to main branch. It:
The publish workflow creates an official release package.
main-release-smoke and runs only when the smoke matrix completes successfully.To set up your own publishing:
npm pkg delete private to remove the private flag from the package.name field in package.json to your desired package name.MIT