# ts-extractor

> TypeScript AST extractor to useful JSON structure.

Latest version **3.1.5** (published 2018-01-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install ts-extractor
pnpm add ts-extractor
yarn add ts-extractor
bun add ts-extractor
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 3.1.5 |
| Published | 2018-01-09 |
| First published | 2017-11-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 5 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21 |
| Author | SimplrJS |
| Maintainers | quatrodev, simplrjs-admin |
| Keywords | typescript, extractor, ast, abstract, syntax, tree |

## Links

- npm: https://www.npmjs.com/package/ts-extractor
- Repository: https://github.com/SimplrJS/ts-extractor
- Homepage: https://github.com/SimplrJS/ts-extractor#readme
- Issues: https://github.com/SimplrJS/ts-extractor/issues
- npm.io page: https://npm.io/package/ts-extractor

## Dependencies (5)

- [fs-extra](https://npm.io/package/fs-extra.md) ^5.0.0
- [typescript](https://npm.io/package/typescript.md) ^2.6.2
- [simplr-logger](https://npm.io/package/simplr-logger.md) ^1.0.1
- [@types/fs-extra](https://npm.io/package/@types/fs-extra.md) ^5.0.0
- [read-package-json](https://npm.io/package/read-package-json.md) ^2.0.12

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 3.1.5 (latest) — 2018-01-09
- 4.0.0-rc.4 (next) — 2018-02-01
- 4.0.0-rc.3 — 2018-02-01
- 4.0.0-rc.2 — 2018-01-31
- 4.0.0-rc.1 — 2018-01-30
- 4.0.0-beta.8 — 2018-01-26
- 4.0.0-beta.7 — 2018-01-23
- 4.0.0-beta.6 — 2018-01-17
- 4.0.0-beta.5 — 2018-01-16
- 4.0.0-beta.4 — 2018-01-15
- 4.0.0-beta.3 — 2018-01-15
- 4.0.0-beta.2 — 2018-01-15
- 4.0.0-beta — 2018-01-12
- 3.1.4 — 2018-01-05
- 3.1.3 — 2018-01-05
- … 13 more at https://npm.io/package/ts-extractor/versions

## README

# ts-extractor

[![NPM version](https://img.shields.io/npm/v/ts-extractor.svg)](https://www.npmjs.com/package/ts-extractor)
[![Build Status](https://travis-ci.org/SimplrJS/ts-extractor.svg?branch=master)](https://travis-ci.org/SimplrJS/ts-extractor)
[![Coverage Status](https://coveralls.io/repos/github/SimplrJS/ts-extractor/badge.svg?branch=master)](https://coveralls.io/github/SimplrJS/ts-extractor?branch=master)
[![dependencies Status](https://david-dm.org/SimplrJS/ts-extractor/status.svg)](https://david-dm.org/SimplrJS/ts-extractor)
[![devDependencies Status](https://david-dm.org/SimplrJS/ts-extractor/dev-status.svg)](https://david-dm.org/SimplrJS/ts-extractor?type=dev)
[![devDependencies Status](https://img.shields.io/npm/l/ts-extractor.svg)](https://npmjs.org/package/ts-extractor)

TypeScript AST extractor to useful JSON structure.

The purpose of this package is to extract AST into flat JSON structures.

Later on, it can be used for documentation generation tool, easier code analysis with without compiler, etc.

## Usage example

```ts
import * as path from "path";
import * as process from "process";
import { Extractor, GetCompilerOptions } from "ts-extractor";

async function Main(): Promise<void> {
    // Absolute path to projectDirectory
    const projectDirectory = process.cwd();
    const pathToTsconfig = path.join(projectDirectory, "./tsconfig.json");

    const compilerOptions = await GetCompilerOptions(pathToTsconfig);

    const extractor = new Extractor({
        CompilerOptions: compilerOptions,
        ProjectDirectory: projectDirectory
    });

    const extractedOutput = extractor.Extract(["./src/index.ts", "./src/another-entry-file.ts"]);
    console.log(extractedOutput);
}

Main();
```

---
_Source: https://npm.io/package/ts-extractor · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
