plutonio
TypeScript icon, indicating that this package has built-in type declarations

0.6.2 • Public • Published

Plutonio

Plutonio is a Typescript library that scans your typescript project and generate a schema of all types and interfaces of the project.

The schema is the following:

type Schema = {
    name: string;
    category: Category;
    type: Primitive;
    original?: string;
    enum?: string[];
    imports: Import[];
    properties?: {
        [k:string]: Schema
    }
};

type Category = 'type' | 'interface';

type Primitive =
  | 'any';
  | 'boolean'
  | 'null'
  | 'number'
  | 'object'
  | 'string'
  | 'undefined'

An example of a schema is the following:

const schema = {
    name: 'Product',
    category: 'interface',
    type: 'object',
    original: 'export interface Product extends Foo.Boo {title: string, price: number}',
    properties: {
        title: {
            type: 'string',
        },
        price: {
            type: 'number',
        },
    },
    imports: [
        {
            text: 'import Foo from "foo"',
            module: 'foo',
            clause: 'Foo',
            specifiers: [],
        },
    ],
},
};

Readme

Keywords

none

Package Sidebar

Install

npm i plutonio

Weekly Downloads

2

Version

0.6.2

License

UNLICENSED

Unpacked Size

110 kB

Total Files

58

Last publish

Collaborators

  • x71c9