ts2famix
v2.0.3
Published
A TypeScript to JSON importer for Moose.
Downloads
137
Maintainers
Readme
FamixTypeScriptImporter
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:
Load the model into Moose:Metacello new githubUser: 'fuhrmanator' project: 'FamixTypeScript' commitish: 'master' path: 'src'; baseline: 'FamixTypeScript'; load.
Note: Windows 10/11 users can drag-and-drop the'projectName.json' asFileReference readStreamDo: [ :stream | model := FamixTypeScriptModel new importFromJSONStream: stream. model install ].
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.