Skip to content

fuhrmanator/FamixTypeScriptImporter

Repository files navigation

FamixTypeScriptImporter

Node.js CI

Create a FamixTypeScript model in JSON of TypeScript files.

Installation

npm install -g ts2famix

npm versions

  • Version 2.x.x is for Moose 11+
  • Version <= 1.x.x is for Moose 10, but lacks support for several elements of TypeScript (arrow functions, full generics).

Usage

Instructions for using the command-line importer:

ts2famix --help

Parse a full project

ts2famix -i ../path/to/project/tsconfig.json -o JSONModels/projectName.json

or

ts2famix -i "../path/to/project/**/*.ts" -o JSONModels/projectName.json

Import the JSON model into Moose

  • Copy the "JSONModels/projectName.json" into your "Pharo/images/[imageName]" directory.
  • In a Moose Playground, load the FamixTypeScript metamodel:
    Metacello new 
      githubUser: 'fuhrmanator' project: 'FamixTypeScript' commitish: 'master' path: 'src';
      baseline: 'FamixTypeScript';
      load.
    Load the model into Moose:
    'projectName.json' asFileReference readStreamDo:
      [ :stream | model := FamixTypeScriptModel new 
        importFromJSONStream: stream. model install ].
    Note: Windows 10/11 users can drag-and-drop the projectName.json model file onto the Pharo window (once the TypeScript metamodel has been loaded) for an easier way to load.

Developer info

To run tests:

npm test

To build ts2famix locally:

npx tsc

To run the locally built version (not the globally installed one with npm).:

npx ts2famix [options]

TypeScript Metamodel API documentation (visualization)

The following was generated by CI using tplant, in a similar fashion described here.

FamixTypeScript API Metamodel

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages