/read-tsconfig

Read tsconfig.json file in your project.

Primary LanguageTypeScriptMIT LicenseMIT

@mnrendra/read-tsconfig

Read tsconfig.json file in your project.

Install

npm i @mnrendra/read-tsconfig

Usage

Using CommonJS:

const { readTSConfig, readTSConfigSync } = require('@mnrendra/read-tsconfig')

// Asynchronously
readTSConfig()
  .then(({ compilerOptions }) => {
    console.log('asynchronously:', compilerOptions)
  })

// Synchronously
const { compilerOptions } = readTSConfigSync()
console.log('synchronously:', compilerOptions)

Using ES Module:

import { readTSConfig, readTSConfigSync } from '@mnrendra/read-tsconfig'

// Asynchronously
readTSConfig()
  .then(({ compilerOptions }) => {
    console.log('asynchronously:', compilerOptions)
  })

// Synchronously
const { compilerOptions } = readTSConfigSync()
console.log('synchronously:', compilerOptions)

Types

import type {
  TSConfig,
  BuildOptions,
  CompileOnSave,
  CompilerOptions,
  BaseURL,
  Paths,
  Exclude,
  Extends,
  Files,
  Include,
  MDX,
  References,
  TSNode,
  WatchOptions,
  TypeAcquisition
} from '@mnrendra/read-tsconfig'

License

MIT

Author

@mnrendra