Skip to content

Commit 4b88dff

Browse files
committed
Updated README.md
1 parent 89aea45 commit 4b88dff

File tree

4 files changed

+104
-82
lines changed

4 files changed

+104
-82
lines changed

README.md

+48-30
Original file line numberDiff line numberDiff line change
@@ -10,61 +10,79 @@ npm install -g @ng2react/cli
1010

1111
## Usage
1212

13-
### Search for components
13+
`ng2r [comand] --help`
1414

1515
```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>
1726
18-
Finds angular components in a file
27+
Converts angular components to react
1928
2029
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]
2232
2333
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
2636
[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"]
3252
```
3353

34-
### Convert your AngularJS component or directive to React
54+
### Generate a Test
3555

3656
```log
37-
ng2react convert <file> <componentName>
57+
ng2react generateReactTest <file>
3858
3959
Converts angular components to react
4060
4161
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]
4463
4564
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
4867
[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
6075
[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"]
6179
```
6280

6381
## JSON API
6482

6583
If you wish to integrate this into your own application, you can use the JSON API by adding the `--json` flag.
6684

67-
The response types are found in See [src/lib/model](./src/lib/model/):
85+
For response types, see the [JSON schemas](./schemas):
6886

6987
### Search Response:
7088

@@ -81,7 +99,7 @@ type SearchResult = {
8199
}
82100
```
83101
84-
### Convert Response:
102+
### Convert / Test Gen Response:
85103
86104
```typescript
87105
type ConvertResult = {

package.json

+54-50
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,56 @@
11
{
2-
"name": "@ng2react/cli",
3-
"version": "1.1.1",
4-
"description": "## Related projects to Investigate * [react-in-angularjs](https://github.com/xjpro/react-in-angularjs)",
5-
"type": "commonjs",
6-
"main": "index.cjs",
7-
"bin": {
8-
"ng2react": "./dist/bin/cli.js"
9-
},
10-
"scripts": {
11-
"prebuild": "rimraf dist",
12-
"build": "npm run schemas && tsc --build ./src/lib/tsconfig.json",
13-
"schemas": "json2ts -i schemas/ -o src/lib/generated/",
14-
"preversion": "npm run lint && npm run test && npm run build",
15-
"prepublishOnly": "npm run build",
16-
"test": "jest",
17-
"lint": "eslint ./src/**/*.ts",
18-
"try": "node ./dist/bin/cli.js findComponents \"./src/test/test_data/todo-list.component.js\""
19-
},
20-
"repository": {
21-
"type": "git",
22-
"url": "git+https://github.com/maxbilbow/angularjs2react-cli.git"
23-
},
24-
"author": "Max Bilbow",
25-
"license": "ISC",
26-
"bugs": {
27-
"url": "https://github.com/maxbilbow/angularjs2react-cli/issues"
28-
},
29-
"homepage": "https://github.com/maxbilbow/angularjs2react-cli#readme",
30-
"dependencies": {
31-
"@ng2react/core": "^1.5.0",
32-
"tslog": "^4.8.2",
33-
"typescript": "^5.0.4",
34-
"yargs": "^17.7.1"
35-
},
36-
"devDependencies": {
37-
"@types/jest": "^29.5.1",
38-
"@types/lodash": "^4.14.191",
39-
"@types/node": "^18.14.6",
40-
"@types/yargs": "^17.0.22",
41-
"@typescript-eslint/eslint-plugin": "^5.54.1",
42-
"@typescript-eslint/parser": "^5.54.1",
43-
"cross-env": "^7.0.3",
44-
"eslint": "^8.36.0",
45-
"jest": "^29.5.0",
46-
"jest-environment-node": "^29.5.0",
47-
"json-schema-to-typescript": "^13.0.1",
48-
"prettier": "^2.8.8",
49-
"rimraf": "^4.4.0",
50-
"ts-jest": "^29.1.0"
51-
}
2+
"name": "@ng2react/cli",
3+
"version": "1.1.1",
4+
"description": "## Related projects to Investigate * [react-in-angularjs](https://github.com/xjpro/react-in-angularjs)",
5+
"type": "commonjs",
6+
"main": "index.cjs",
7+
"bin": {
8+
"ng2react": "./dist/bin/cli.js"
9+
},
10+
"files": [
11+
"dist",
12+
"schemas"
13+
],
14+
"scripts": {
15+
"prebuild": "rimraf dist",
16+
"build": "npm run schemas && tsc --build ./src/lib/tsconfig.json",
17+
"schemas": "json2ts -i schemas/ -o src/lib/generated/",
18+
"preversion": "npm run lint && npm run test && npm run build",
19+
"prepublishOnly": "npm run build",
20+
"test": "jest",
21+
"lint": "eslint ./src/**/*.ts",
22+
"try": "node ./dist/bin/cli.js findComponents \"./src/test/test_data/todo-list.component.js\""
23+
},
24+
"repository": {
25+
"type": "git",
26+
"url": "git+https://github.com/maxbilbow/angularjs2react-cli.git"
27+
},
28+
"author": "Max Bilbow",
29+
"license": "ISC",
30+
"bugs": {
31+
"url": "https://github.com/maxbilbow/angularjs2react-cli/issues"
32+
},
33+
"homepage": "https://github.com/maxbilbow/angularjs2react-cli#readme",
34+
"dependencies": {
35+
"@ng2react/core": "^1.5.0",
36+
"tslog": "^4.8.2",
37+
"typescript": "^5.0.4",
38+
"yargs": "^17.7.1"
39+
},
40+
"devDependencies": {
41+
"@types/jest": "^29.5.1",
42+
"@types/lodash": "^4.14.191",
43+
"@types/node": "^18.14.6",
44+
"@types/yargs": "^17.0.22",
45+
"@typescript-eslint/eslint-plugin": "^5.54.1",
46+
"@typescript-eslint/parser": "^5.54.1",
47+
"cross-env": "^7.0.3",
48+
"eslint": "^8.36.0",
49+
"jest": "^29.5.0",
50+
"jest-environment-node": "^29.5.0",
51+
"json-schema-to-typescript": "^13.0.1",
52+
"prettier": "^2.8.8",
53+
"rimraf": "^4.4.0",
54+
"ts-jest": "^29.1.0"
55+
}
5256
}

schemas/GenerationResponse.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "https://raw.githubusercontent.com/main/schemas/GenerationResponse.json",
2+
"$id": "https://raw.githubusercontent.com/ng2react/cli/main/schemas/GenerationResponse.json",
33
"$schema": "https://json-schema.org/draft/2020-12/schema",
44
"title": "Ng2rGenerationResponse",
55
"type": "object",

schemas/SearchResult.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"$id": "https://raw.githubusercontent.com/main/schemas/SearchResponse.json",
2+
"$id": "https://raw.githubusercontent.com/ng2react/cli/main/schemas/SearchResult.json",
33
"$schema": "https://json-schema.org/draft/2020-12/schema",
44
"title": "Ng2rSearchResult",
55
"type": "object",

0 commit comments

Comments
 (0)