An open API service indexing awesome lists of open source software.

https://github.com/ulivz/load-config-ts

An out-of-the-box config loader with TypeScript support.
https://github.com/ulivz/load-config-ts

config config-loader loader out-of-the-box ts typescript

Last synced: about 1 year ago
JSON representation

An out-of-the-box config loader with TypeScript support.

Awesome Lists containing this project

README

          

load-config-ts


An out-of-the-box config loader with TypeScript support.


NPM version
NPM downloads
Build Status

## Install

```bash
npm i load-config-ts -S
```

## Usage

```js
import { loadConfig } from 'load-config-ts';
// This load try to load at process.cwd():
// - ulivz.config.js
// - ulivz.config.ts
// - ulivzrc.js
// - ulivzrc.ts
const config = loadConfig({
configKey: 'ulivz',
});
```

Custom config path:

```js
// This will load `ulivz.config.test.js` directly:
const config = loadConfig({
cwd: useScene('config-suffix'),
configKey: 'ulivz',
configFile: 'ulivz.config.test.js',
});
```

## Credits

`load-config-ts` wouldn't exist without the inspirations from following projects:

- [esbuild](https://github.com/evanw/esbuild)
- [bundle-require](https://github.com/egoist/bundle-require)

## License

MIT © [ULIVZ](https://github.com/sponsors/ulivz)