@@ -10,61 +10,79 @@ npm install -g @ng2react/cli
10
10
11
11
## Usage
12
12
13
- ### Search for components
13
+ ` ng2r [comand] --help `
14
14
15
15
``` log
16
- ng2react search <file>
16
+ Commands:
17
+ ng2react search <file> Finds angular components in a file
18
+ ng2react convert <file> <componentName> Converts angular components to react
19
+ ng2react generateReactTest <file> Converts angular components to react
20
+ ```
21
+
22
+ ### Convert your AngularJS component or directive to React
23
+
24
+ ``` log
25
+ ng2react convert <file> <componentName>
17
26
18
- Finds angular components in a file
27
+ Converts angular components to react
19
28
20
29
Positionals:
21
- file The file to search [string] [required]
30
+ file The file containing the component [string] [required]
31
+ componentName The file to convert [string] [required]
22
32
23
33
Options:
24
- --version Show version number [boolean]
25
- --cwd The current working directory
34
+ --version Show version number [boolean]
35
+ --cwd The current working directory
26
36
[string] [default: "/Users/maxbilbow/repos/dissertation/ng2react/cli"]
27
- --quiet Suppresses all logging [boolean]
28
- --json Outputs the result as json. When provided, all responses will be in
29
- the format {data: any, error?: string} [boolean]
30
- --verbose Outputs more information [boolean]
31
- --help Show help [boolean]
37
+ --quiet Suppresses all logging [boolean]
38
+ --verbose Outputs more information [boolean]
39
+ --help Show help [boolean]
40
+ --apiKey The openai api key [string]
41
+ --model The openai model to use [string] [default: "gpt-4"]
42
+ --organization The openai model to use [string]
43
+ --sourceRoot The source root where all AngularJS JS and HTML are located
44
+ [string]
45
+ --temperature The temperature to use when generating text, between 0 and 2
46
+ [number] [default: 0.2]
47
+ --customPrompt Custom rules (Markdown) that will be used instead of the
48
+ default rules regarding pattern conversion. [string]
49
+ --targetLanguage Target language for code generation. If none provided, the
50
+ source language will be used.
51
+ [string] [choices: "javascript", "typescript"]
32
52
```
33
53
34
- ### Convert your AngularJS component or directive to React
54
+ ### Generate a Test
35
55
36
56
``` log
37
- ng2react convert <file> <componentName >
57
+ ng2react generateReactTest <file>
38
58
39
59
Converts angular components to react
40
60
41
61
Positionals:
42
- file The file containing the component [string] [required]
43
- componentName The file to convert [string] [required]
62
+ file The file containing the component [string] [required]
44
63
45
64
Options:
46
- --version Show version number [boolean]
47
- --cwd The current working directory
65
+ --version Show version number [boolean]
66
+ --cwd The current working directory
48
67
[string] [default: "/Users/maxbilbow/repos/dissertation/ng2react/cli"]
49
- --quiet Suppresses all logging [boolean]
50
- --json Outputs the result as json. When provided, all responses will
51
- be in the format {data: any, error?: string} [boolean]
52
- --verbose Outputs more information [boolean]
53
- --help Show help [boolean]
54
- --apiKey The openai api key [string]
55
- --model The openai model to use [string] [default: "gpt-4"]
56
- --organization The openai model to use [string]
57
- --sourceRoot The source root where all AngularJS JS and HTML are located
58
- [string]
59
- --temperature The temperature to use when generating text, between 0 and 2
68
+ --quiet Suppresses all logging [boolean]
69
+ --verbose Outputs more information [boolean]
70
+ --help Show help [boolean]
71
+ --apiKey The openai api key [string]
72
+ --model The openai model to use [string] [default: "gpt-4"]
73
+ --organization The openai model to use [string]
74
+ --temperature The temperature to use when generating text, between 0 and 2
60
75
[number] [default: 0.2]
76
+ --targetLanguage Target language for code generation. If none provided, the
77
+ source language will be used.
78
+ [string] [choices: "javascript", "typescript"]
61
79
```
62
80
63
81
## JSON API
64
82
65
83
If you wish to integrate this into your own application, you can use the JSON API by adding the ` --json ` flag.
66
84
67
- The response types are found in See [ src/lib/model ] ( ./src/lib/model/ ) :
85
+ For response types, see the [ JSON schemas ] ( ./schemas ) :
68
86
69
87
### Search Response:
70
88
@@ -81,7 +99,7 @@ type SearchResult = {
81
99
}
82
100
` ` `
83
101
84
- ### Convert Response:
102
+ ### Convert / Test Gen Response:
85
103
86
104
` ` ` typescript
87
105
type ConvertResult = {
0 commit comments