read-tsconfig-up
Version:
Find up and read `tsconfig.json` file
68 lines (46 loc) • 1.53 kB
Markdown
# read-tsconfig-up
[](https://travis-ci.org/iguntur/read-tsconfig-up)
[](#)
[](https://www.npmjs.org/package/read-tsconfig-up)
[](#)
---
## Install
```console
$ npm install read-tsconfig-up
```
## Usage
```js
const readTsconfigUp = require('read-tsconfig-up');
readTsconfigUp().then(result => {
console.log(result);
/*
{
tsconfig: {
compilerOptions: {
outDir: 'dist',
// ...
}
},
path: '/path/to/project/tsconfig.json'
}
*/
});
console.log(readTsconfigUp.sync({cwd: './packages/foo'}));
```
## API
### readTsconfigUp(`options`)
- Params:
- `options`: [`<ReadOptions>`](#readoptions)
- Returns: `Promise<{}>`
### readTsconfig.sync(`options`)
- Params:
- `options`: [`<ReadOptions>`](#readoptions)
- Returns: `<object>`
#### `ReadOptions`
- `cwd`: `<string>` - Directory to start from.
- default: `process.cwd()`
## Related
- [read-tsconfig](https://github.com/iguntur/read-tsconfig) - Read `tsconfig.json` file.
- [has-tsconfig](https://github.com/iguntur/has-tsconfig) - Indicates whether the project has `tsconfig.json` file.
## License
MIT © [Guntur Poetra](https://github.com/iguntur)