programming-linguist
v0.0.0
Published
A Construct-based model to generate source code
Downloads
3
Maintainers
Readme
programming-linguist
A library to facilitate generation of TypeScript code from TypeScript/Javascript applications.
Quick Start
Installation
Add the library to your dependencies using your package manager of choice:
npm install programming-linguist
yarn add programming-linguist
Usage
Start by creating a new Project
, then add SourceFile
s to it with statements
in those, and finally synthesize the Project
:
import * as linguist from 'programming-linguist';
// Creating a root TypeScript Project
const project = new linguist.Project();
// Creating a new SourceFile in the project
const sourceFile = new linguist.SourceFile(project, 'index');
// Adding a new Interface declaration
new linguist.Interface(sourceFile, 'FooInterface', {
documentation: 'This is an example interface',
exported: true,
name: 'FooInterface',
});
// Synthesizing the project into `/target/directory`:
project.synthesize('/target/directory');