{"id":37685647,"url":"https://github.com/fischor/protogen-javascript","last_synced_at":"2026-01-16T12:32:07.774Z","repository":{"id":57138313,"uuid":"398624751","full_name":"fischor/protogen-javascript","owner":"fischor","description":"The protogen package makes it easy to write protoc plugins in JavaScript/Typescript","archived":false,"fork":false,"pushed_at":"2021-08-28T11:32:44.000Z","size":110,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-19T22:22:40.621Z","etag":null,"topics":["code-generation","javascript","protobuf","protoc","protocol-buffers","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fischor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-21T17:59:21.000Z","updated_at":"2022-05-26T05:51:38.000Z","dependencies_parsed_at":"2022-08-25T10:01:24.794Z","dependency_job_id":null,"html_url":"https://github.com/fischor/protogen-javascript","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/fischor/protogen-javascript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fischor%2Fprotogen-javascript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fischor%2Fprotogen-javascript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fischor%2Fprotogen-javascript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fischor%2Fprotogen-javascript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fischor","download_url":"https://codeload.github.com/fischor/protogen-javascript/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fischor%2Fprotogen-javascript/sbom","scorecard":{"id":401282,"data":{"date":"2025-08-11","repo":{"name":"github.com/fischor/protogen-javascript","commit":"937d790ba9d2f589153f6ea4fd226aaefe5ad9f9"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.4,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Dangerous-Workflow","score":10,"reason":"no dangerous workflow patterns detected","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Code-Review","score":0,"reason":"Found 0/16 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Token-Permissions","score":0,"reason":"detected GitHub workflow tokens with excessive permissions","details":["Warn: no topLevel permission defined: .github/workflows/prepare-release.yaml:1","Warn: no topLevel permission defined: .github/workflows/prettier.yaml:1","Warn: no topLevel permission defined: .github/workflows/publish-npm.yaml:1","Warn: no topLevel permission defined: .github/workflows/test.yaml:1","Info: no jobLevel write permissions found"],"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Pinned-Dependencies","score":4,"reason":"dependency not pinned by hash detected -- score normalized to 4","details":["Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/prepare-release.yaml:13: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/prepare-release.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/prepare-release.yaml:18: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/prepare-release.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/prepare-release.yaml:36: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/prepare-release.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/prepare-release.yaml:44: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/prepare-release.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/prepare-release.yaml:66: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/prepare-release.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/prettier.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/prettier.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/prettier.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/prettier.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/prettier.yaml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/prettier.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-npm.yaml:12: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/publish-npm.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-npm.yaml:15: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/publish-npm.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/publish-npm.yaml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/publish-npm.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:14: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/test.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:17: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/test.yaml/main?enable=pin","Warn: third-party GitHubAction not pinned by hash: .github/workflows/test.yaml:24: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/test.yaml/main?enable=pin","Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/test.yaml:32: update your workflow using https://app.stepsecurity.io/secureworkflow/fischor/protogen-javascript/test.yaml/main?enable=pin","Info:   0 out of  12 GitHub-owned GitHubAction dependencies pinned","Info:   0 out of   3 third-party GitHubAction dependencies pinned","Info:   4 out of   4 npmCommand dependencies pinned"],"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"SAST","score":0,"reason":"SAST tool is not run on all commits -- score normalized to 0","details":["Warn: 0 commits out of 3 are checked with a SAST tool"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Vulnerabilities","score":0,"reason":"11 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-5v2h-r2cx-5xgj","Warn: Project is vulnerable to: GHSA-rrrm-qjm4-v8hf","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-qrpm-p2h7-hrv2","Warn: Project is vulnerable to: GHSA-mwcw-c2x4-8c55","Warn: Project is vulnerable to: GHSA-76p7-773f-r4q5"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-18T20:08:58.548Z","repository_id":57138313,"created_at":"2025-08-18T20:08:58.548Z","updated_at":"2025-08-18T20:08:58.548Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28478672,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T11:59:17.896Z","status":"ssl_error","status_checked_at":"2026-01-16T11:55:55.838Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-generation","javascript","protobuf","protoc","protocol-buffers","typescript"],"created_at":"2026-01-16T12:32:07.096Z","updated_at":"2026-01-16T12:32:07.759Z","avatar_url":"https://github.com/fischor.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# `protogen`\n\nPackage `protogen` makes writing `protoc` plugins easy.\nWorking with the raw protobuf descriptor messages can be cumbersome.\n`protogen` resolves and links the dependencies and references between the raw Protobuf descriptors and turns them into their corresponding `protogen` classes that are easier to work with.\nIt also provides mechanisms that are espacially useful to generate JavaScript/TypeScript code like dealing with module imports.\n\n# Installation\n\nPackage `protogen` is available via npm. To install run:\n\n```\nnpm install @protogenjs/protogen\n```\n\n## API\n\nMost classes in `protogen` are simply replacements of their corresponding Protobuf descriptors: `protogen.File` represents a FileDescriptor, `protogen.Message` a Descriptor, `protogen.Field` a FieldDescriptor and so on. They should be self explanatory. You can read their docstrings for more information about them.\n\nThe classes `protogen.Options`, `protogen.Plugin` and `protogen.GeneratedFile` make up a framework to generate files.\nYou can see these in action in the following example plugin:\n\n```typescript\n#!/usr/bin/env node\n/** An example plugin. */\n\nimport * as protogen from \"@protogenjs/protogen\";\n\nnew protogen.Options().run((gen: protogen.Plugin) =\u003e {\n  for (let file of gen.filesToGenerate) {\n    let g = gen.newGeneratedFile(\n      file.name.replace(\".proto\", \".ts\"),\n      file.jsImportPath\n    );\n    g.P(\"# Generated code ahead.\");\n    g.P();\n    g.printImports();\n    g.P();\n    for (let message of file.messages) {\n      g.P(\"export class \", message.jsIdent.name, \"{\");\n      for (let field of message.fields) {\n        // TODO: generate code for the field\n      }\n      g.P(\"}\");\n      g.P();\n    }\n    for (let service of file.services) {\n      g.P(\"export class \", service.jsIdent.name, \"Client {\");\n      g.P(\"constructor (private host: string) {}\");\n      for (let method of service.methods) {\n        // prettier-ignore\n        g.P(method.jsName, \"(request: \", method.input.jsIdent, \"): \", method.output.jsIdent, \"{\");\n        // TODO: generate the method implementation\n        g.P(\"}\");\n        g.P();\n      }\n      g.P(\"}\");\n      g.P();\n    }\n  }\n});\n```\n\n# Misc\n\n## What is a protoc plugin anyway?\n\n`protoc`, the **Proto**buf **c**ompiler, is used to generate code derived from Protobuf definitions (`.proto` files).\nUnder the hood, `protoc`'s job is to read and parse the definitions into their *Descriptor* types (see [google/protobuf/descriptor.proto](https://github.com/protocolbuffers/protobuf/blob/4f49062a95f18a6c7e21ba17715a2b0a4608151a/src/google/protobuf/descriptor.proto)).\nWhen `protoc` is run (with a plugin) it creates a CodeGeneratorRequest (see [google/protobuf/compiler/plugin.proto#L68](https://github.com/protocolbuffers/protobuf/blob/4f49062a95f18a6c7e21ba17715a2b0a4608151a/src/google/protobuf/compiler/plugin.proto#L68)) that contains the descriptors for the files to generate and everything they import and passes it to the plugin via `stdin`.\n\nA *protoc plugin* is an executable. It reads the CodeGeneratorRequest from `stdin` and returns a CodeGeneratorResponse (see [google/protobuf/compiler/plugin.proto#L99](https://github.com/protocolbuffers/protobuf/blob/4f49062a95f18a6c7e21ba17715a2b0a4608151a/src/google/protobuf/compiler/plugin.proto#L99)) via `stdout`.\nThe plugin can use the descriptors from the CodeGeneratorRequest to create output files (in memory).\nIt returns these output files (consisting of name and content as string) in the CodeGeneratorResponse to `protoc`.\n\n`protoc` then writes these files to disk.\n\n## Run `protoc` with your plugin\n\nAssume you have an executable plugin under `path/to/plugin/main.js`.\nYou can invoke it via:\n\n```\nprotoc \n    --plugin=protoc-gen-myplugin=path/to/plugin/main.js \\\n    --plugin_out=./output_root \\\n    myproto.proto myproto2.proto\n```\n\nCaveats:\n- you must use the `--plugin=protoc-gen-\u003cplugin_name\u003e` prefix, otherwise `protoc` fails with \"plugin not executable\"\n- your plugin must be executable (`chmod +x path/to/plugin/main.js` and put a `#!/usr/bin/env node` at the top of the file)\n\n# See also\n\n- if you want to write protoc plugins with Python: [github.com/fischor/protogen-python](https://github.com/fischor/protogen-python)\n- if you want to write protoc plugins with Golang: [google.golang.org/protobuf/compiler/protogen](https://google.golang.org/protobuf/compiler/protogen)\n\n# Credits\n\nThis package is inspired by the [google.golang.org/protobuf/compiler/protogen Golang](https://pkg.go.dev/google.golang.org/protobuf@v1.27.1/compiler/protogen) package.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffischor%2Fprotogen-javascript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffischor%2Fprotogen-javascript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffischor%2Fprotogen-javascript/lists"}