Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 2.69 KB

README.md

File metadata and controls

50 lines (36 loc) · 2.69 KB

TSConfig

NPM version NPM downloads Build status Test coverage

Resolve and parse tsconfig.json, with support for filesGlob (array of glob strings).

Usage

See the TypeScript wiki for information on setting up tsconfig.json. Additionally, this module will parse the filesGlob option, if it exists.

API

  • resolve(dir: string): Promise Find up the location of tsconfig.json.
  • resolveSync(dir: string): string Synchronous resolve.
  • load(dir: string, options?: Options): Promise Resolve, load and parse tsconfig.json.
  • loadSync(dir: string): TSConfig Synchronous load.
  • readFile(filename: string, options?: Options): Promise Read a file as tsconfig.json (BOM, JSON parse, empty file and files expansion).
  • readFileSync(filename: string, options?: Options): TSConfig Synchronous readFile.
  • parseFile(contents: string, filename: string, options?: Options): Promise Parse a string as tsconfig.json (BOM, JSON parse, empty contents and expansion).
  • parseFileSync(contents: string, filename: string, options?: Options): TSConfig Synchronous parseFile.
  • resolveConfig(config: TSConfig, filename: string, options?: Options): Promise Expand a raw tsconfig.json object.
  • resolveConfigSync(config: TSConfig, filename: string, options?: Options): TSConfig Synchronous resolveConfig.

The TSConfig result will always contain an expanded files array (from either filesGlob or exclude). Both files and exclude will be resolved relative to the tsconfig.json file.

Options

  • compilerOptions Default compiler options to apply on expansion (default: {}).
  • filterDefinitions Return a list files which are only .d.ts files (default: false).
  • resolvePaths Resolve paths to absolute and remove duplicate entries (default: true).

Contributing

Please open issues for discussion.

License

MIT License