1.0.29 • Published 1 year ago

@clsx524/nx-buf v1.0.29

Weekly downloads
-
License
-
Repository
-
Last release
1 year ago

nx-buf

An Nx plugin for performing codegen from Protobuf/gRPC projects using Buf.

Installation

To install this plugin, run the following command:

npm install @clsx524/nx-buf

And add it to the list of plugins in nx.json:

{
  // ...
  "plugins": [
    // ...
    "@clsx524/nx-buf"
  ]
}

Features

This plugin assumes that you have a separate Nx project in your workspace that contains your .proto files, as well as buf.yaml and buf.gen.yaml in that project root.

Linting

To enable linting a buf project, use the @clsx524/nx-buf:lint executor in that project's project.json:

{
  // ...
  "targets": {
    "lint": {
      "executor": "@clsx524/nx-buf:lint"
    }
  }
}

Codegen

To generate source files from a buf project into another project, use the @clsx524/nx-buf:generate executor in the destination project:

{
  // ...
  "targets": {
    "proto-gen": {
      "executor": "@clsx524/nx-buf:generate",
      "outputs": ["{projectRoot}/{options.copyTo}"],
      "options": {
        "srcProject": "proto",
        "copyFrom": ["gen/*"],
        "copyTo": "src/gen",
        "options": "--include-imports"
      }
    },
    "build": {
      "dependsOn": ["proto-gen"],
      // ...
    }
  }
}

The options are as follows:

  • srcProject: the project from where to grab the generated sources after running buf generate.
  • copyFrom: a list of glob patterns to copy from that project, relative to its root.
  • copyTo: the destination folder, relative to the target project.
  • options: (optional) additional command-line arguments to pass to buf generate.

Dependency graph

This plugin will automatically establish a dependency between any project that contain a @clsx524/nx-buf:generate target and the respective project specified in options.srcProject.

1.0.29

1 year ago

1.0.28

1 year ago

1.0.27

1 year ago

1.0.26

1 year ago

1.0.25

1 year ago

1.0.24

1 year ago

1.0.23

1 year ago

1.0.22

1 year ago

1.0.21

1 year ago

1.0.20

1 year ago

1.0.19

1 year ago

1.0.18

1 year ago

1.0.17

1 year ago

1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.12

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago