-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from km229/dev
mseTsGenerator v2.1.1
- Loading branch information
Showing
23 changed files
with
178 additions
and
1,075 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,94 @@ | ||
|
||
# mseTsGenerator | ||
|
||
Ce projet consiste à générer un MSE à partir de fichiers source d'une projet Typescript. | ||
|
||
Il a été réalisé dans le cadre du cours MGL843 - Sujets avancés en conception logicielle du trimestre d'hiver 2021. | ||
|
||
Librairies utilisées : | ||
- ts-complex : ./lib/ts-complex - https://github.com/anandundavia/ts-complex/blob/master/LICENCE.md | ||
- pascalerni/famix : ./lib/pascalerni/license - https://github.com/pascalerni/famix/blob/master/LICENSE | ||
## Fonctionnement | ||
|
||
Le fichier MSE généré part d'un code source en langage TypeScript qui est analysé à l'aide de la librairie ts-morph. | ||
Le projet lie les noeuds identifiés par ts-morph aux entités FAMIX correspondantes pour générer un MSE. | ||
|
||
Liens utiles : | ||
* [Documentation Moose](https://modularmoose.org/moose-wiki/) | ||
* [Documentation FAMIX](https://www.researchgate.net/publication/265428652_MSE_and_FAMIX_30_an_Interexchange_Format_and_Source_Code_Model_Family) | ||
* https://github.com/moosetechnology | ||
|
||
## Etapes d'installation | ||
|
||
Pour installer, le projet il faut récupérer l'ensemble du code source depuis : | ||
https://github.com/km229/mseTsGenerator | ||
|
||
Ensuite, il faut lancer à partir du répertoire racine la commande : | ||
`` | ||
npm install | ||
`` pour récupérer les dépendances. | ||
|
||
Il est nécessaire de posséder npm pour l'installation : | ||
https://docs.npmjs.com/downloading-and-installing-node-js-and-npm | ||
|
||
## Etapes d'exécution | ||
|
||
Après avoir effectué les étapes d'installation, il faut éditer le fichier `` index.ts `` pour ajouter les informations d'entrée et de sortie pour la génération du MSE. | ||
|
||
Pour l'entrée, il faut pour cela créer une instance de MSEDocument avec le chemin du fichier/dossier à analyser : | ||
|
||
```ts | ||
let mse = new MSEDocument("[ROOT PATH OF SOURCE CODE]") | ||
``` | ||
|
||
Pour la sortie (générer un fichier MSE), il faut appeler la méthode ``generateMseFile()`` sur la même instance : | ||
|
||
```ts | ||
mse.generateMseFile("[PATH OF GENERATED FILE]") | ||
``` | ||
|
||
Après avoir défini le projet Typescript, il est possible de lancer la commande `` npm start `` pour générer le fichier MSE. | ||
|
||
### Précisions sur l'utilisation | ||
|
||
Ce projet académique reste incomplet sur la structure et l'analyse du code TypeScript mais propose une 1ère approche en la matière. | ||
Il serait intéressant par la suite d'étudier plus en profondeur le fonctionnement de ts_morph pour mieux appréhender le language TypeScript. | ||
La même chose serait utile du côté de Pharo pour approfondir la compréhension des métamodèles. Cela permettrait de créer un métamodèle spécifique au langage TypeScript. | ||
|
||
Approfondissement : | ||
* [Création d'un métamodèle](https://modularmoose.org/moose-wiki/Developers/CreateNewMetamodel.html) | ||
* [Modular Moose](https://www.researchgate.net/publication/346143234_Modular_Moose_A_new_generation_software_reverse_engineering_environment) | ||
|
||
### Exemple (index.ts) | ||
|
||
```ts | ||
import {MSEDocument} from './src/model/MSEDocument' | ||
|
||
// Example to generate a MSE file | ||
let mse = new MSEDocument('./sample-ts') | ||
mse.generateMseFile('./result.mse') | ||
``` | ||
|
||
## Structure du projet | ||
|
||
``` | ||
. | ||
|-- examples # Examples de fichiers MSE et autre | ||
|-- lib # Librairies externes | ||
|-- sample-ts # Example de projet Typescript pour la génération d'un MSE | ||
|-- src # Code source | ||
|-- package.json | ||
|-- package_lock.json | ||
|-- mgl843.pdf | ||
|-- LICENSE | ||
|-- README.md | ||
``` | ||
|
||
### Auteurs / Contributeurs | ||
- DELLAC Aurélien - https://github.com/OrelExia | ||
- DEREN Nelson - https://github.com/nelsonderen24 | ||
- PEYRET Romain - https://github.com/PtitCaillou | ||
- MORICEAU Kévin - https://github.com/km229 | ||
- VAN DRIESSCHE Rémi - https://github.com/remivand | ||
|
||
### Librairies utilisées (voir /lib) : | ||
- ts-morph : https://github.com/dsherret/ts-morph | ||
- ts-complex : Utilisation partielle du code dans src/model/metricService.ts - https://github.com/anandundavia/ts-complex | ||
- pascalerni/famix : https://github.com/pascalerni/famix |
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,10 @@ | ||
import {MSEDocument} from './src/model/MSEDocument' | ||
|
||
// let mse = new MSEDocument('./sample-ts') | ||
// mse.generateMseFile('./result.mse') | ||
// let mse2 = new MSEDocument('C:\\Users\\kevin\\Downloads\\ts_projects\\joist-ts-main\\packages') | ||
// mse2.generateMseFile('./joist.mse') | ||
// let mse3 = new MSEDocument('C:\\Users\\kevin\\Downloads\\ts_projects\\prisma-master\\src') | ||
// mse3.generateMseFile('./prisma.mse') | ||
// let mse4 = new MSEDocument('C:\\Users\\kevin\\Downloads\\ts_projects\\playwright\\v1.0\\src') | ||
// mse4.generateMseFile('./playwright_v1.0.mse') | ||
// let mse5 = new MSEDocument('C:\\Users\\kevin\\Downloads\\ts_projects\\playwright\\v1.10\\src') | ||
// mse5.generateMseFile('./playwright_v1.10.mse') | ||
let mse6 = new MSEDocument('C:\\Users\\kevin\\Downloads\\ts_projects\\typeorm-master\\src') | ||
mse6.generateMseFile('./typeorm.mse') | ||
// Example to generate a MSE file | ||
let mse = new MSEDocument('./sample-ts') | ||
mse.generateMseFile('./result.mse') | ||
|
||
/* You can add your own code to analyse like this : | ||
let mse = new MSEDocument([ROOT PATH OF SOURCE CODE]) | ||
mse.generateMseFile([PATH OF GENERATED FILE]) | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2019 David Sherret | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
Binary file not shown.
Oops, something went wrong.