Skip to content

Commit

Permalink
Update README.md for 2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
fuhrmanator authored Jul 30, 2024
1 parent 96a200e commit 941a0bf
Showing 1 changed file with 29 additions and 60 deletions.
89 changes: 29 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@ Create a [FamixTypeScript](https://github.com/fuhrmanator/FamixTypeScript) model
## Installation

```sh
npm install ts2famix
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:
Expand All @@ -28,78 +33,42 @@ or
ts2famix -i "../path/to/project/**/*.ts" -o JSONModels/projectName.json
```

## Import the JSON model into Moose 🫎

You need to copy the "```JSONModels/projectName.json```" into your "```Pharo/images/[imageName]```" directory.

For a Moose Suite 10 (stable) user with the Pharo directory in the root directory, do :
```sh
cp JSONModels/projectName.json ~/Pharo/images/Moose\ Suite\ 10\ \(stable\)/.
```

Then, in a Moose Playground, do :
```smalltalk
Metacello new
githubUser: 'fuhrmanator' project: 'FamixTypeScript' commitish: 'master' path: 'src';
baseline: 'FamixTypeScript';
load
```

This command installs the TypeScript metamodel into Moose.

Then, generate the metamodel with :
```Library > Famix > Manage metamodels > Regenerate all metamodels```

Then, in a Moose Playground, do :
```smalltalk
'projectName.json' asFileReference readStreamDo:
[ :stream | model := FamixTypeScriptModel new
importFromJSONStream: stream. model install ].
```

This command imports the JSON model into Moose.
## 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:
```smalltalk
Metacello new
githubUser: 'fuhrmanator' project: 'FamixTypeScript' commitish: 'master' path: 'src';
baseline: 'FamixTypeScript';
load.
```
Load the model into Moose:
```smalltalk
'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

Run tests :
```sh
npm test
```

Generate coverage :
```sh
npm run coverage
```

Then, open "```coverage/lcov-report/index.html```" with your favorite browser :
```sh
firefox coverage/lcov-report/index.html &
```

Generate documentation :
```sh
npm run doc
```
To run tests:

Then, open "```docs/index.html```" with your favorite browser :
```sh
firefox docs/index.html &
npm test
```

Generate plantuml and svg of the metamodel :
```sh
npm run uml
```
To build `ts2famix` locally:

Then, open "```doc-uml/metamodel.svg```" with your favorite image viewer :
```sh
eog doc-uml/metamodel.svg &
npx tsc
```

## Generate an object diagram of the JSON model
To run the locally built version (not the globally installed one with npm).:

```sh
ts-node src/famix2puml.ts -i JSONModels/projectName.json -o PUMLModels/projectName.puml
npx ts2famix [options]
```

## TypeScript Metamodel API documentation (visualization)
Expand Down

0 comments on commit 941a0bf

Please sign in to comment.