Skip to content

Commit 8a100f9

Browse files
committed
Updated docs
1 parent c3c7ce4 commit 8a100f9

14 files changed

+235
-186
lines changed

docs/Requirements.md

-9
This file was deleted.

docs/VSCode.md

-95
This file was deleted.

docs/about.md

+2-46
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,3 @@
1-
# Temperat agros cremet
1+
# About
22

3-
## Probarunt facta sua praeceps Sicanias puerum
4-
5-
Lorem markdownum nympha? Undas virus eripitur parentes mater
6-
[iuvenumque](http://telephonexpulsa.com/iovisque) tempus tamen arcana, neve
7-
summo meritumque igitur. *Noctes creamur* Chariclo me operosa capite.
8-
9-
> Viso ulla siqua inmunesque quoque, tollensque subruit unda tamen, perire:
10-
> tinnulaque sub cum! Deus remissos cape, *si resupinus* iussos
11-
> [vidit](http://www.coniunx.org/provida) Charybdis amico veteres territa:
12-
> gravis Cythereide abire formatum pugnet, pro.
13-
14-
## Instimulat tenues
15-
16-
Deriguit lacus [altissima](http://timent-viros.net/suosaperite), in undas
17-
fortuna! Pallade molli: [paulumque dei](http://www.tumulo.net/corpusque) est
18-
flabat odoribus Hippothousque, ille tua Haemonio patris poscentem deae versus.
19-
Viribus Heliadum hostem [vox](http://tendentemque.io/) tamen arma: versata
20-
**dicta sequentia qui**. Pello iuvenci secessit communes in **venit** disiecta
21-
iugo notam! Domestica solusque Dryantis ilia!
22-
23-
Tenebant rettulit intonat citraque iacta. Nec inclusos, moratum lactis animique
24-
discedunt autumnos. Dea huic esset, ipso caeli eruerit moenia e Minervam corpore
25-
ferreus tinnitibus furor mansit: opes novat? Rursus dedecus sontes, proelia
26-
erat, vel alta Meleagron Scirone. Montis in Aeneaden, tectis quas, tot facinus
27-
passurae captus, ima et!
28-
29-
## Habes parabat audit
30-
31-
Palmis in genitore tonarent, clam me Ceycis ex tota iam terra inquit; longeque.
32-
Perpetuum iuvenalis blandisque Haemus solidum, liquet dolor potentior torum
33-
quiescet adesset vincat, natura lurida, tenentem impetus plenumque. Simplex quid
34-
exponit nam hospita matre! Caeli praecipue dedit is effugimus tamen et relaxant
35-
semina; et tenebat colubris: ensis sed per offensa quid.
36-
37-
> Inminet in nova Deucalioneas piscem condor fit est tristes aevum alternaque
38-
> munere patriam **ut esse** petitis maturus ingenium fuit! Tactu par nisi amori
39-
> simul cum iam bene iacens dentes deus [mutavit
40-
> paelex](http://quoque-ratione.io/), veni. Confugit Iolao quod, ore falsa
41-
> vestros clipeo *iuvenalia* ceciderunt ignis, et hos ages fuisti dum diu illa,
42-
> est. Illa luna, cursus illum, quod Eueni fatale sentire.
43-
44-
Corpora inquam tamen deducentia saepes perterrita, telae, pavefacta, mox partes
45-
verus, cara et pleni vel. Circumvolat debes diu dat mille quoque manum senectus
46-
increpor causa limus. Cum iuvenalibus iube potiora capiunt, natorum; falsosque
47-
Menephron.
3+
Developed by Max Bilbow as part of a Masters in Computer Science at Coventry University

docs/documentation.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# ng2react Documentation
2+
3+
ng2react is a tool that converts AngularJS components to React components using the OpenAI API. It consists of an IDE plugin, a core library, a CLI, and a feedback API.
4+
5+
![System Context Diagram](./diagrams/structurizr-1-SystemContext.png)
6+
7+
## Features
8+
9+
- **Convert AngularJS Components**: The plugin allows users to easily convert AngularJS components to React components by sending the components to the ng2react core library, which uses TypeScript for parsing AngularJS components and the OpenAI API to generate the React version of the component.
10+
11+
- **Feedback Submission**: The plugin enables users to submit feedback about the conversion results directly from the IDE. This feedback helps the ng2react team to identify areas for improvement and ensure the tool continues to meet user needs.
12+
13+
- **User-friendly Interface**: The ng2react IDE plugin is designed with usability in mind, providing a seamless experience for developers working with both AngularJS and React codebases.
14+
15+
## IDE Plugin
16+
17+
The ng2react IDE plugin is an essential component of the ng2react software system. It integrates with the user's development environment and provides an interface for converting AngularJS components to React components using the core library. The plugin also enables users to submit feedback about the conversion results directly to the feedback API.
18+
19+
Two types of IDE plugins are supported:
20+
21+
- **NodeJS Based IDE Plugins**: These plugins are built for IDEs that support NodeJS plugins, such as VSCode and Atom. They can use @ng2react/core directly.
22+
- **Other IDE Plugins**: These plugins are built for IDEs that do not support NodeJS plugins, such as IntelliJ and Eclipse. They can be immpemented via the @ng2react/cli.
23+
24+
### NodeJS Based IDE Plugin
25+
26+
![NodeJS IDE Plugins](./diagramsstructurizr-1-VSCode_IDE.png)
27+
28+
### Other IDE Plugins
29+
30+
![Generic IDE Plugins](./diagrams/structurizr-1-Generic_IDE_CLI.png)
31+
32+
## Ng2React
33+
34+
### Core
35+
36+
The ng2react core library is responsible for converting AngularJS components to React components. It leverages the TypeScript AST for parsing AngularJS components and uses the OpenAI API to generate the corresponding React components.
37+
38+
### CLI
39+
40+
The ng2react CLI is a command-line interface that enables developers to convert AngularJS components to React components without using an IDE plugin. It provides a convenient way for developers to integrate the ng2react functionality into their existing workflows and tooling.
41+
42+
### Feedback API
43+
44+
The feedback API allows users to submit feedback about the conversion results directly from the ng2react IDE plugin. It stores the feedback data in a database for later analysis and review by the ng2react team. This feedback is essential for identifying areas for improvement and ensuring the tool continues to meet user needs.
45+
46+
![Feedback API](./diagrams/structurizr-1-Feedback_API.png)
47+
48+
## Existing Plugins
49+
50+
[VSCode](https://marketplace.visualstudio.com/items?itemName=maxbilbow.ng2react-vscode)
51+
52+

docs/getting-started.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# Getting Started
2+
3+
1. Get an OpenAI API key from <https://openai.com/>
4+
2. Add the OpenAI API key to your IDE extension settings
5+
3. Open an AngularJS project and ensure that the source roots are configured correctly
6+
4. Run the `ng2react: Check Connection` command
7+
5. Install the `@ng2react/support` library in your AngularJS project: `npm install --save @ng2react/support`
8+
9+
## Project Recommendations
10+
11+
### Testing, testing testing
12+
13+
The generated code is not guaranteed to be correct. It is generated by an AI model and may contain bugs. It is highly recommended that you write UI tests that will work for both AngularJS and React.
14+
15+
If you currently use Protractor, you may want to consider switching to [Cypress](https://www.cypress.io). Cypress is a modern testing framework that is much easier to use and maintain than Protractor. It also supports both AngularJS and React.
16+
17+
Good behavioural tests will help you catch bugs in the generated code and have confidence that parity has been achieved.
18+
19+
### Use a UI component library
20+
21+
## Configuration
22+
23+
Important configuration options.
24+
25+
### OpenAI Settings
26+
27+
- `ng2react.openai.apiKey`: The OpenAI API key to use for generating React components from AngularJS components.
28+
- `ng2react.openai.model`: The OpenAI engine to use for generating React components from AngularJS components. Defaults to `gpt-4`.
29+
- `ng2react.openai.temperature`: The OpenAI temperature to use for generating React components from AngularJS components. Defaults to `0.2`.
30+
- `ng2react.openai.orginization`: An optional organization ID assiciated with your OpenAI account and can be used to prevent OpenAI from using your code to train their models.
31+
32+
### Project Settings
33+
34+
- `ng2react.source.angularRoot`: The source root of your AngularJS code. Defaults to `src`.
35+
- `ng2react.source.reactRoot`: The source root of your AngularJS code. Defaults to `src`.
36+
- `ng2react.source.testRoot`: The source root where React unit tests should be generated. Defaults to `src/test`.
37+
38+
![VSCode Project .settings.json](./images/vscode_guide_project-settings.png)
39+
40+
## Examples
41+
42+
Have a look at some examples in [@ng2react/examples](https://github.com/ng2react/examples)

docs/images/tech-icons.png

878 KB
Loading
485 KB
Loading
47.3 KB
Loading
977 KB
Loading
140 KB
Loading
169 KB
Loading

docs/index.md

+73-34
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,101 @@
1-
# ng2react Documentation
1+
# AngularJS to React - VSCode Extension
22

3-
ng2react is a tool that converts AngularJS components to React components using the OpenAI API. It consists of an IDE plugin, a core library, a CLI, and a feedback API.
3+
An extension for converting AngularJS to React, leveraging OpenAI's GPT API.
44

5-
![System Context Diagram](./diagrams/structurizr-1-SystemContext.png)
5+
[View in marketplace](https://marketplace.visualstudio.com/items?itemName=maxbilbow.ng2react-vscode&ssr=false#overview)
66

77
## Features
88

9-
- **Convert AngularJS Components**: The plugin allows users to easily convert AngularJS components to React components by sending the components to the ng2react core library, which uses TypeScript for parsing AngularJS components and the OpenAI API to generate the React version of the component.
9+
- **Convert AngularJS Components**: The plugin allows users to easily convert AngularJS components to React components by sending the components to the ng2react core library, which uses TypeScript for parsing AngularJS components and the OpenAI API to generate the React version of the component.
1010

11-
- **Feedback Submission**: The plugin enables users to submit feedback about the conversion results directly from the IDE. This feedback helps the ng2react team to identify areas for improvement and ensure the tool continues to meet user needs.
11+
![Component Conversion](images/todolist-conversion-example.png)
1212

13-
- **User-friendly Interface**: The ng2react IDE plugin is designed with usability in mind, providing a seamless experience for developers working with both AngularJS and React codebases.
13+
## Requirements
1414

15-
## IDE Plugin
15+
- **OpenAI API Key**: The plugin requires an OpenAI API key to be set in the `ng2react.openai.apiKey` setting. You can get an API key by signing up for the [OpenAI API](https://beta.openai.com/).
1616

17-
The ng2react IDE plugin is an essential component of the ng2react software system. It integrates with the user's development environment and provides an interface for converting AngularJS components to React components using the core library. The plugin also enables users to submit feedback about the conversion results directly to the feedback API.
17+
## Configuration
1818

19-
Two types of IDE plugins are supported:
19+
### OpenAI Settings
2020

21-
- **NodeJS Based IDE Plugins**: These plugins are built for IDEs that support NodeJS plugins, such as VSCode and Atom. They can use @ng2react/core directly.
22-
- **Other IDE Plugins**: These plugins are built for IDEs that do not support NodeJS plugins, such as IntelliJ and Eclipse. They can be immpemented via the @ng2react/cli.
21+
- `ng2react.openai.apiKey`: The OpenAI API key to use for generating React components from AngularJS components.
22+
- `ng2react.openai.model`: The OpenAI engine to use for generating React components from AngularJS components. Defaults to `gpt-4`.
23+
- `ng2react.openai.temperature`: The OpenAI temperature to use for generating React components from AngularJS components. Defaults to `0.2`.
24+
- `ng2react.openai.orginization`: An optional organization ID assiciated with your OpenAI account.
2325

24-
![IDE Containers Diagram](./diagrams/structurizr-1-IDE_Containers.png)
26+
### Project Settings
2527

26-
### NodeJS Based IDE Plugin
28+
- `ng2react.angularRoot`: The source root of your AngularJS code. Defaults to `src`.
29+
- `ng2react.reactRoot`: The source root of your AngularJS code. Defaults to `src`.
30+
- `ng2react.testRoot`: The source root where React unit tests should be generated
31+
- `ng2react.testFileSuffix`: Default test file suffix. Defaults to `.test.tsx`.
32+
- `ng2react.enabled`: Whether or not the extension is enabled. Defaults to `auto`.
33+
- `ng2react.sandboxMode`: Whether or not to run the extension in sandbox mode. Defaults to `false`.
2734

28-
![NodeJS IDE Plugins](./diagrams/structurizr-1-NodeJS_IDE_Plugins.png)
35+
## Known Issues
2936

30-
### Other IDE Plugins
37+
This is an early alpha release of the extension. There are many known issues and limitations, including:
3138

32-
![Generic IDE Plugins](./diagrams/structurizr-1-Generic_IDE_Plugins.png)
39+
- AI Generated Code: The generated code is not guaranteed to be correct. It is generated by an AI model and may contain bugs.
40+
- Limited Support: The extension currently only supports converting AngularJS components to React components. It does not support converting AngularJS services, directives, or other types of AngularJS code.
3341

34-
## Ng2React
42+
## Wrapping React Components
3543

36-
### Core
44+
A [support library is availabe for wrapping React components in AngularJS](https://www.npmjs.com/package/@ng2react/support)components. This library may not have long-term support, but you are free to use, fork, or copy whatever you like from it.
3745

38-
The ng2react core library is responsible for converting AngularJS components to React components. It leverages the TypeScript AST for parsing AngularJS components and uses the OpenAI API to generate the corresponding React components.
46+
### Installation
3947

40-
![Ng2React Core](./diagrams/structurizr-1-Ng2React_Core.png)
48+
```bash
49+
npm install --save @ng2react/support
50+
```
4151

42-
### CLI
52+
### Usage
4353

44-
The ng2react CLI is a command-line interface that enables developers to convert AngularJS components to React components without using an IDE plugin. It provides a convenient way for developers to integrate the ng2react functionality into their existing workflows and tooling.
54+
#### Convert your AngularJS component or directive to React
4555

46-
![Ng2React Core](./diagrams/structurizr-1-Ng2React_CLI.png)
56+
You may do this manually or with the help of the [ng2react vscode extension](https://marketplace.visualstudio.com/items?itemName=maxbilbow.ng2react-vscode)
4757

48-
### Feedback API
58+
```jsx
59+
// React Component
60+
import React, { useState } from "react";
61+
import { useService, NgTranslate } from "@ng2react/support";
4962

50-
The feedback API allows users to submit feedback about the conversion results directly from the ng2react IDE plugin. It stores the feedback data in a database for later analysis and review by the ng2react team. This feedback is essential for identifying areas for improvement and ensuring the tool continues to meet user needs.
63+
const MyReactComponent = ({ title, myController }) => {
64+
const myService = useService("myService");
65+
const [state, setState] = useState(myService.getState());
66+
return (
67+
<>
68+
<h1>{title}</h1>
69+
<p>{state}</p>
70+
<p>
71+
<NgTranslate
72+
id={"TRANLATED_TEXT_ID"}
73+
substitutions={myController.getValue()}
74+
/>
75+
</p>
76+
</>
77+
);
78+
};
79+
```
5180

52-
![Feedback API](./diagrams/structurizr-1-Feedback_API.png)
81+
#### Wrap your React component
5382

54-
### Feedback Analysis Client
83+
```js
84+
// AngularJS Component
85+
import * as angular from "angular";
86+
import { angularize } from "@ng2react/support";
87+
import { MyReactComponent } from "./MyReactComponent.jsx";
5588

56-
The feedback analysis client is a tool used by the ng2react team to review and analyze the feedback submitted by users. It provides an interface for browsing, filtering, and analyzing feedback data stored in the feedback database. This tool helps the team identify trends, common issues, and areas for improvement in the ng2react system.
57-
58-
## Existing Plugins
59-
60-
### VSCode
61-
62-
![VSCode IDE Diagram](./diagrams/structurizr-1-IDE_Containers_VSCode.png)
89+
const myApp = angular.module("myApp", []);
90+
angularize(MyReactElement, {
91+
module: myApp,
92+
name: "myAngularComponent",
93+
bindings: {
94+
title: "@",
95+
},
96+
require: {
97+
myController: "^myController",
98+
},
99+
replace: true,
100+
});
101+
```

0 commit comments

Comments
 (0)