Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/pisyukaev/axxon-proto2ts
This is a simple tool to convert Axxon proto files to typescript interfaces.
https://github.com/pisyukaev/axxon-proto2ts
Last synced: 22 days ago
JSON representation
This is a simple tool to convert Axxon proto files to typescript interfaces.
- Host: GitHub
- URL: https://github.com/pisyukaev/axxon-proto2ts
- Owner: Pisyukaev
- License: mit
- Created: 2024-04-11T16:30:04.000Z (7 months ago)
- Default Branch: master
- Last Pushed: 2024-05-06T17:01:02.000Z (6 months ago)
- Last Synced: 2024-05-07T18:23:43.252Z (6 months ago)
- Size: 8.79 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Axxon proto to ts converter
This is a simple tool to convert Axxon proto files to typescript interfaces.
> [!IMPORTANT]
> We must have `protoc` installed in our system to use this tool.
> If you don't have it installed, you can install it by following the instructions [here](https://grpc.io/docs/protoc-installation/).## Installation
Clone the repository
```bash
git clone https://github.com/Pisyukaev/axxon-proto2ts.git
```Install the dependencies
```bash
cd axxon-proto2ts
pnpm install
```Install `protoc` if you don't have it installed in your system. You can install it by following the instructions [here](https://grpc.io/docs/protoc-installation/).
## Usage
Move all proto files/folders with proto to the `proto` directory
Run the following command to convert the proto files to typescript interfaces```bash
pnpm run ts:gen
```The generated typescript interfaces will be saved in the `types` directory
> [!NOTE]
> The generated typescript interfaces may need some manual adjustments to work properly.## Example
### Input
```protobuf /proto/example.proto
syntax = "proto3";
package docs;message User {
string first_name = 1;
string last_name = 2;
bool active = 3;
User manager = 4;
repeated string locations = 5;
map projects = 6;
}```
### Output
```typescript /types/example.ts
/* eslint-disable */export const protobufPackage = "docs";
export interface User {
first_name: string;
last_name: string;
active: boolean;
manager: User | undefined;
locations: string[];
projects: { [key: string]: string };
}export interface User_ProjectsEntry {
key: string;
value: string;
}
```## License
MIT