# ardunno-cli-gen

> Generates nice-grpc API for the Arduino CLI

Latest version **0.1.10** (published 2024-11-17) · MIT license · 0 weekly downloads

## Install

```sh
npm install ardunno-cli-gen
pnpm add ardunno-cli-gen
yarn add ardunno-cli-gen
bun add ardunno-cli-gen
```

Provides the command `ardunno-cli`.

## Health

**Score 40/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads; pre 1.0.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.10 |
| Published | 2024-11-17 |
| First published | 2022-11-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 13 |
| Unpacked size | 21.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | dankeboy36 |
| Maintainers | dankeboy36 |
| Keywords | arduino, arduino-cli, proto, grpc, nice-grpc |

## Links

- npm: https://www.npmjs.com/package/ardunno-cli-gen
- Repository: https://github.com/dankeboy36/ardunno-cli-gen
- Homepage: https://github.com/dankeboy36/ardunno-cli-gen#readme
- Issues: https://github.com/dankeboy36/ardunno-cli-gen/issues
- npm.io page: https://npm.io/package/ardunno-cli-gen

## Dependencies (13)

- [debug](https://npm.io/package/debug.md) ^4.3.4
- [execa](https://npm.io/package/execa.md) ^7.1.1
- [globby](https://npm.io/package/globby.md) ^13.1.4
- [rimraf](https://npm.io/package/rimraf.md) ^5.0.1
- [semver](https://npm.io/package/semver.md) ^7.5.1
- [ts-proto](https://npm.io/package/ts-proto.md) ^1.153.3
- [unzipper](https://npm.io/package/unzipper.md) ^0.10.14
- [commander](https://npm.io/package/commander.md) ^10.0.1
- [protobufjs](https://npm.io/package/protobufjs.md) ^7.2.3
- [tmp-promise](https://npm.io/package/tmp-promise.md) ^3.0.3
- [nice-grpc-common](https://npm.io/package/nice-grpc-common.md) ^2.0.0
- [@pingghost/protoc](https://npm.io/package/@pingghost/protoc.md) ^1.0.2
- [https-proxy-agent](https://npm.io/package/https-proxy-agent.md) ^5.0.1

## Recent versions

- 0.1.10 (latest) — 2024-11-17
- 0.1.9 — 2024-11-17
- 0.1.8 — 2024-11-17
- 0.1.7 — 2023-10-22
- 0.1.6 — 2023-10-22
- 0.1.5 — 2023-07-14
- 0.1.4 — 2023-05-28
- 0.1.4-beta.5 — 2023-05-28
- 0.1.4-beta.4 — 2023-05-28
- 0.1.4-beta.3 — 2023-05-23
- 0.1.4-beta.2 — 2023-05-23
- 0.1.4-beta.1 — 2023-05-23
- 0.1.3 — 2022-11-21
- 0.1.2 — 2022-11-21
- 0.1.1 — 2022-11-20
- … 14 more at https://npm.io/package/ardunno-cli-gen/versions

## README

# `ardunno-cli-gen`

Generates [`nice-grpc`](https://github.com/deeplay-io/nice-grpc) API for the [Arduino CLI](https://github.com/arduino/arduino-cli) from the [`proto` files](https://github.com/arduino/arduino-cli/tree/master/rpc)

## Installing

```
npm i ardunno-cli-gen -S
```

## Usage

### CLI

```
Usage: ardunno-cli generate [options] <src>

Generates TS/JS API for the Arduino CLI

Arguments:
  src                 The source of the proto files to generate from.
                      The input source can be a path to the folder
                      which contains the proto files. The source can be
                      a valid semver. Then, the proto files will be
                      downloaded from the Arduino CLI's GitHub release.
                      It can be a GitHub commit in the following format
                      `(?<owner>)/(?<repo>)(#(?<commit>))?`. Then, the
                      proto files will be cloned and checked out from
                      GitHub.

Options:
  -o, --out <string>  Specify an output folder for all emitted files.
  -f, --force         Override previously emitted files in the output
                      location.
  -h, --help          display help for command
```

Examples:

```sh
# generates from local proto files
npx ardunno-cli generate ./path/to/rpc --out ./src-gen
```

```sh
# generates from a valid semver
npx ardunno-cli generate 0.29.0 --out ./src-gen
```

```sh
# generates from the HEAD of the default branch
npx ardunno-cli generate arduino/arduino-cli --out ./src-gen
```

```sh
# generates from a specific commit
npx ardunno-cli generate arduino/arduino-cli#5a4ffe0 --out ./src-gen
```

```sh
# generates from a specific branch of a fork
npx ardunno-cli generate cmaglie/arduino-cli#alternate-homedir --out ./src-gen
```

### API

CommonJS:

```js
const { generate } = require('ardunno-cli-gen');
```

TypeScript:

```ts
import { generate } from 'ardunno-cli-gen';
```

Generate:

```js
// `src` is a path like, a valid semver or a GitHub ref as `(?<owner>)/(?<repo>)(#(?<commit>))?`
// `out` is the output folder
// user `force` if you want to override the generated output
await generate({ src: '0.29.0', out: './src-gen', force: true });
```

## Running the tests

```
npm run test
```

## Using

-   [`nice-grpc`](https://github.com/deeplay-io/nice-grpc) - A TypeScript gRPC library that is nice to you
-   [`ts-proto`](https://github.com/stephenh/ts-proto) - An idiomatic protobuf generator for TypeScript
-   [`protobufjs`](https://github.com/protobufjs/protobuf.js) - Protocol Buffers for JavaScript (& TypeScript)
-   [`protoc`](https://github.com/YePpHa/node-protoc) - A simple wrapper for the protoc

### Notes

-   The underlying `protoc` version is `3.19.1`. It comes from the [`@pingghost/protoc`](https://www.npmjs.com/package/@pingghost/protoc) dependency. `protoc` is not required on the `$PATH`

    ```sh
    npx @pingghost/protoc --version
    libprotoc 3.19.1
    ```

-   Use [`debug`](https://www.npmjs.com/package/debug) to log additional details

    ```sh
    % DEBUG=ardunno-cli* npx ardunno-cli generate ./path/to/rpc --out ./src-gen
      ardunno-cli-gen generating with {"src":"./path/to/rpc","out":"./src-gen","force":false} +0ms
      ardunno-cli-gen accessible ./src-gen +2ms
      ardunno-cli-gen glob ./path/to/rpc +1ms
      ardunno-cli-gen accessible ./path/to/rpc +1ms
    [...]
    ```

-   Run the generator from the sources (or use the predefined `generate` VS Code task):
    -   `npm run compile`
    -   `node dist/cli.js generate v1.1.0 --out ./gen-output`

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

I made [`ardunno-cli-gen`](https://github.com/dankeboy36/ardunno-cli-gen) with pure ❤️

## Acknowledgments

-   [@per1234](https://github.com/per1234) for the tireless support on the [Arduino Forum](https://forum.arduino.cc/)

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