Skip to content

Commit 020e742

Browse files
committed
Update docs for nestjs-grpc-helper: Merge branch 'main' into next
1 parent 43ccd02 commit 020e742

1 file changed

Lines changed: 40 additions & 4 deletions

File tree

pages/nestjs-grpc-helper/index.md

Lines changed: 40 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,53 @@ export class UserMicroservice {
5050
You can use any type if fixed types are not an option. However, since it’s passed as JSON, the performance may not be as optimal as with binary. Consider using binary if performance is a concern.
5151

5252
```typescript
53-
@Property({ type: 'any', required: false })
53+
@Property({ type: String, format: 'any', required: false })
5454
@AnyType()
5555
data: any;
5656
```
5757

5858
### Create SDK
5959

60-
To generate a TypeScript SDK for your gRPC services, use the following command:
61-
60+
To generate a TypeScript SDK for your gRPC services, you can use the `make-sdk` command. This command will automatically generate the necessary proto files and package them into a JavaScript SDK.
61+
You also need the following configuration in your sdk-config.json file:
62+
63+
```json
64+
{
65+
"name": "sdkName",
66+
"packageName": "@hodfords/package-name",
67+
"format": true,
68+
"build": true,
69+
"output": "sdk",
70+
"outputBuild": "sdkBuild",
71+
"removeOutput": true,
72+
"addAllowDecorator": true,
73+
"tsconfig": {
74+
"extends": "./tsconfig.json",
75+
"compilerOptions": {
76+
"outDir": "sdkBuild"
77+
},
78+
"include": ["sdk"]
79+
}
80+
}
81+
```
82+
Details of the configuration:
83+
84+
| Field | Description |
85+
|-------------------|-------------------------------------------------------|
86+
| name | Name of the SDK |
87+
| packageName | Name of the package |
88+
| format | Format the generated code |
89+
| build | Build the generated code |
90+
| output | Output directory for the generated code |
91+
| outputBuild | Output directory for the built code |
92+
| removeOutput | Remove the output directory |
93+
| addAllowDecorator | Add the allow decorator, need class-validator package |
94+
| tsconfig | TypeScript configuration |
95+
96+
97+
To generate the SDK, run the following command:
6298
```shell
63-
npm run wz-command make-sdk <package-name> <folder>
99+
npm run wz-command make-sdk
64100
```
65101

66102
#### What this command does

0 commit comments

Comments
 (0)