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.
- Host: GitHub
- URL: https://github.com/ulivz/load-config-ts
- Owner: ulivz
- License: mit
- Created: 2023-01-20T07:20:33.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2023-01-20T09:33:36.000Z (over 3 years ago)
- Last Synced: 2025-03-28T18:51:51.581Z (about 1 year ago)
- Topics: config, config-loader, loader, out-of-the-box, ts, typescript
- Language: TypeScript
- Homepage:
- Size: 83 KB
- Stars: 10
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
load-config-ts
An out-of-the-box config loader with TypeScript support.
## 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)