How to use the @ts-morph/bootstrap.Project function in @ts-morph/bootstrap

To help you get started, we’ve selected a few @ts-morph/bootstrap examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dtinth / a-javascript-and-typescript-documentation-generator-based-on-typescript-compiler / src / ModelGenerator.ts View on Github external
export function generateDocs(
  rootFileNames: string[],
  generateOptions: GenerateOptions = {},
): GenerateDocsResult {
  rootFileNames = rootFileNames.map(n => fs.realpathSync(n))
  const basePath = require('commondir')(rootFileNames.map(f => path.dirname(f)))

  const { options } = ts.convertCompilerOptionsFromJson(
    { allowJs: true },
    basePath,
  )
  const project = new Project({
    compilerOptions: options,
  })
  const entrySourceFiles = project.addSourceFilesByPaths(rootFileNames)
  const program = project.createProgram()
  const typeChecker = program.getTypeChecker()
  const languageService = project.getLanguageService()

  if (generateOptions.debug) {
    void languageService
    debugger
  }

  const entryModuleSymbolIds: string[] = []
  const entrySourceFileIds: string[] = []

  function main() {

@ts-morph/bootstrap

API for getting quickly set up with the TypeScript Compiler API.

MIT
Latest version published 1 month ago

Package Health Score

91 / 100
Full package analysis

Popular @ts-morph/bootstrap functions