Skip to content

Instantly share code, notes, and snippets.

@timostamm
timostamm / protoc-gen-reg.ts
Created November 23, 2023 15:38
protoc-gen-reg - generate a reg.ts file for each proto file, with a registry for all types in the file
#!/usr/bin/env -S npx tsx
// See here how to run this plugin: https://github.com/bufbuild/protobuf-es/tree/main/packages/protoplugin-example
import { createEcmaScriptPlugin, runNodeJs } from "@bufbuild/protoplugin";
import type { Schema } from "@bufbuild/protoplugin/ecmascript";
import type {
DescEnum,
DescExtension,
DescFile,