Tiny library to read config files like
your.config.js,your.config.mjs,your.config.ts,your.conifg.jsonoryour.config.json5from disk.
- As a developer, I want to read config files for my project/library/framework
- As a developer, I don't want to write that code again and again
- ✅ Reads and evalutates config files from disk:
.js,.mjs,.ts,.jsonand.json5 - ✅ Available as a simple API and simple to use CLI
- ✅ Just
636 bytesnano sized (ESM, gizpped) - ✅ Tree-shakable and side-effect free
- ✅ Runs on Windows, Mac, Linux, CI tested
- ✅ First class TypeScript support
- ✅ 100% Unit Test coverage
NODE_OPTIONS='--experimental-vm-modules' npx @jsheaven/read-config-file --config ./test/some.config.ts
You need at least version 18 of Node.js installed.
- yarn:
yarn add @jsheaven/read-config-file - npm:
npm install @jsheaven/read-config-file
import { readConfigFile } from '@jsheaven/read-config-file'
const result = await readConfigFile({
configFilePath: './test/some.config.ts',
})const { readConfigFile } = require('@jsheaven/read-config-file')
// same API like ESM variant