# cyfs-objs-generator

> Implement the conversion of .proto files into custom object typescript files quickly.

Latest version **1.0.3** (published 2022-10-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install cyfs-objs-generator
pnpm add cyfs-objs-generator
yarn add cyfs-objs-generator
bun add cyfs-objs-generator
```

Provides the command `cyfs-objs-generator`.

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-10-20 |
| First published | 2022-10-20 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 30.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | cyfs |
| Maintainers | barton111 |
| Keywords | cyfs, generator, cyfs-objs-generator |

## Links

- npm: https://www.npmjs.com/package/cyfs-objs-generator
- npm.io page: https://npm.io/package/cyfs-objs-generator

## Dependencies (6)

- [ora](https://npm.io/package/ora.md) 5.4.1
- [chalk](https://npm.io/package/chalk.md) 4.1.2
- [figlet](https://npm.io/package/figlet.md) ^1.5.2
- [fs-extra](https://npm.io/package/fs-extra.md) ^10.1.0
- [inquirer](https://npm.io/package/inquirer.md) ^8.2.2
- [commander](https://npm.io/package/commander.md) ^9.2.0

## Recent versions

- 1.0.3 (latest) — 2022-10-20
- 1.0.2 — 2022-10-20
- 1.0.1 — 2022-10-20
- 1.0.0 — 2022-10-20

## README

# cyfs-objs-generator

You can use this tool to implement the conversion of .proto files into custom object typescript files quickly.

## Installation

Currently, the supported .proto Types are: double, float, int32, int64, uint32, uint64, bool, string, bytes and enum.
Nested definitions are not supported.

## Note

Every .proto file should contain a NoneObject, As follows:

```proto
message NoneObject {
}
```

## Command

1. Convert a .proto file into several custom object typescript files.

```sh
cyfs-objs-generator -i ./obj_proto.proto -o ./test_out
```

2. To retrieve the tool version.

```sh
cyfs-objs-generator --version
```

3. For helps.

```sh
cyfs-objs-generator --help
```

## Usage

Use protoc to compile .proto files into XX_pb.js and XX_pb.d.ts. It is recommended to use cyfs-dapp-cli to create template projects. The project project already contains protoc programs and quick generation commands.
Then, You can use this tool to generate objects .ts files.

### Reference .proto

```proto
syntax = "proto3";

enum ArticleType {
	NEWS = 0;
	ENTERTAINMENT = 1;
	HEALTHY = 2;
	HISTORY = 3;
}

message Article {
	ArticleType type = 1;
	string title = 2;
	string content = 3;
	bytes authorId = 4;
	float rewardAmount = 5;
	bool isPassed = 6;
	uint64 timestamp = 7;
}

message NoneObject {
}
```

---
_Source: https://npm.io/package/cyfs-objs-generator · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
