ts2famix 1.0.9 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -45
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -7,21 +7,60 @@ Create a [FamixTypeScript](https://github.com/fuhrmanator/FamixTypeScript) model
|
|
|
7
7
|
## Installation
|
|
8
8
|
|
|
9
9
|
```sh
|
|
10
|
-
npm install
|
|
10
|
+
npm install ts2famix
|
|
11
11
|
```
|
|
12
12
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
|
-
Instructions for using the command-line importer
|
|
15
|
+
Instructions for using the command-line importer:
|
|
16
16
|
|
|
17
17
|
```sh
|
|
18
|
-
|
|
18
|
+
ts2famix --help
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Parse a full project
|
|
22
|
+
|
|
23
|
+
```sh
|
|
24
|
+
ts2famix -i ../path/to/project/tsconfig.json -o JSONModels/projectName.json
|
|
19
25
|
```
|
|
20
26
|
or
|
|
21
27
|
```sh
|
|
22
|
-
ts-
|
|
28
|
+
ts2famix -i "../path/to/project/**/*.ts" -o JSONModels/projectName.json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Import the JSON model into Moose 🫎
|
|
32
|
+
|
|
33
|
+
You need to copy the "```JSONModels/projectName.json```" into your "```Pharo/images/[imageName]```" directory.
|
|
34
|
+
|
|
35
|
+
For a Moose Suite 10 (stable) user with the Pharo directory in the root directory, do :
|
|
36
|
+
```sh
|
|
37
|
+
cp JSONModels/projectName.json ~/Pharo/images/Moose\ Suite\ 10\ \(stable\)/.
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Then, in a Moose Playground, do :
|
|
41
|
+
```st
|
|
42
|
+
Metacello new
|
|
43
|
+
githubUser: 'fuhrmanator' project: 'FamixTypeScript' commitish: 'master' path: 'src';
|
|
44
|
+
baseline: 'FamixTypeScript';
|
|
45
|
+
load
|
|
23
46
|
```
|
|
24
47
|
|
|
48
|
+
This command installs the TypeScript metamodel into Moose.
|
|
49
|
+
|
|
50
|
+
Then, generate the metamodel with :
|
|
51
|
+
```Library > Famix > Manage metamodels > Regenerate all metamodels```
|
|
52
|
+
|
|
53
|
+
Then, in a Moose Playground, do :
|
|
54
|
+
```st
|
|
55
|
+
'projectName.json' asFileReference readStreamDo:
|
|
56
|
+
[ :stream | model := FamixTypeScriptModel new
|
|
57
|
+
importFromJSONStream: stream. model install ].
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
This command imports the JSON model into Moose.
|
|
61
|
+
|
|
62
|
+
## Developer info
|
|
63
|
+
|
|
25
64
|
Run tests :
|
|
26
65
|
```sh
|
|
27
66
|
npm test
|
|
@@ -57,53 +96,12 @@ Then, open "```doc-uml/metamodel.svg```" with your favorite image viewer :
|
|
|
57
96
|
eog doc-uml/metamodel.svg &
|
|
58
97
|
```
|
|
59
98
|
|
|
60
|
-
## Parse a full project
|
|
61
|
-
|
|
62
|
-
```sh
|
|
63
|
-
ts-node src/ts2famix-tsconfig.ts -i ../path/to/project/tsconfig.json -o JSONModels/projectName.json
|
|
64
|
-
```
|
|
65
|
-
or
|
|
66
|
-
```sh
|
|
67
|
-
ts-node src/ts2famix-cli.ts -i "../path/to/project/**/*.ts" -o JSONModels/projectName.json
|
|
68
|
-
```
|
|
69
|
-
|
|
70
99
|
## Generate an object diagram of the JSON model
|
|
71
100
|
|
|
72
101
|
```sh
|
|
73
102
|
ts-node src/famix2puml.ts -i JSONModels/projectName.json -o PUMLModels/projectName.puml
|
|
74
103
|
```
|
|
75
104
|
|
|
76
|
-
## Import the JSON model into Moose 🫎
|
|
77
|
-
|
|
78
|
-
You need to copy the "```JSONModels/projectName.json```" into your "```Pharo/images/[imageName]```" directory.
|
|
79
|
-
|
|
80
|
-
For a Moose Suite 10 (stable) user with the Pharo directory in the root directory, do :
|
|
81
|
-
```sh
|
|
82
|
-
cp JSONModels/projectName.json ~/Pharo/images/Moose\ Suite\ 10\ \(stable\)/.
|
|
83
|
-
```
|
|
84
|
-
|
|
85
|
-
Then, in a Moose Playground, do :
|
|
86
|
-
```st
|
|
87
|
-
Metacello new
|
|
88
|
-
githubUser: 'fuhrmanator' project: 'FamixTypeScript' commitish: 'master' path: 'src';
|
|
89
|
-
baseline: 'FamixTypeScript';
|
|
90
|
-
load
|
|
91
|
-
```
|
|
92
|
-
|
|
93
|
-
This command installs the TypeScript metamodel into Moose.
|
|
94
|
-
|
|
95
|
-
Then, generate the metamodel with :
|
|
96
|
-
```Library > Famix > Manage metamodels > Regenerate all metamodels```
|
|
97
|
-
|
|
98
|
-
Then, in a Moose Playground, do :
|
|
99
|
-
```st
|
|
100
|
-
'projectName.json' asFileReference readStreamDo:
|
|
101
|
-
[ :stream | model := FamixTypeScriptModel new
|
|
102
|
-
importFromJSONStream: stream. model install ].
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
This command imports the JSON model into Moose.
|
|
106
|
-
|
|
107
105
|
## TypeScript Metamodel API documentation (visualization)
|
|
108
106
|
|
|
109
107
|
The following was generated by CI using [tplant](https://github.com/bafolts/tplant), in a similar fashion described [here](https://modularmoose.org/2021/07/19/automatic-metamodel-documentation-generation.html).
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts2famix",
|
|
3
|
-
"version": "1.0.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.0.10",
|
|
4
|
+
"description": "A TypeScript to JSON importer for Moose 10.",
|
|
5
5
|
"main": "dist/ts2famix-cli.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "ts-node src/ts2famix-cli.ts",
|