@jsheaven/read-config-file
v1.0.1
Published
Tiny library to read config files like your.config.js, your.config.mjs your.config.ts, your.conifg.json and your.config.json5 from disk.
Downloads
13
Readme
Tiny library to read config files like
your.config.js
,your.config.mjs
,your.config.ts
,your.conifg.json
oryour.config.json5
from 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
,.json
and.json5
- ✅ Available as a simple API and simple to use CLI
- ✅ Just
636 bytes
nano 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