{"id":18996809,"url":"https://github.com/ailhc/egf-protobuf","last_synced_at":"2026-04-02T18:43:37.422Z","repository":{"id":34156425,"uuid":"170665339","full_name":"AILHC/egf-protobuf","owner":"AILHC","description":"1. 提供 protobuf.js 基础运行时库 2. 提供命令行脚本，将 protofile 生成 JavaScript 代码 3. 生成正确的 .d.ts 代码，以方便 TypeScript 项目使用","archived":false,"fork":false,"pushed_at":"2022-06-02T22:32:48.000Z","size":288,"stargazers_count":49,"open_issues_count":3,"forks_count":14,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-07-05T04:44:03.180Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AILHC.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-02-14T09:36:00.000Z","updated_at":"2025-02-20T01:35:09.000Z","dependencies_parsed_at":"2022-09-20T21:52:00.868Z","dependency_job_id":null,"html_url":"https://github.com/AILHC/egf-protobuf","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/AILHC/egf-protobuf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AILHC%2Fegf-protobuf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AILHC%2Fegf-protobuf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AILHC%2Fegf-protobuf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AILHC%2Fegf-protobuf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AILHC","download_url":"https://codeload.github.com/AILHC/egf-protobuf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AILHC%2Fegf-protobuf/sbom","scorecard":{"id":6871,"data":{"date":"2025-08-11","repo":{"name":"github.com/AILHC/egf-protobuf","commit":"e294fd8caeca29d4e7eba4e977e42b55a5710f3b"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.8,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","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":"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":"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":"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":"Code-Review","score":0,"reason":"Found 0/8 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":-1,"reason":"No tokens found","details":null,"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":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"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":"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":"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":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"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 'master'"],"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":"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":"Vulnerabilities","score":8,"reason":"2 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3"],"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-14T13:44:47.190Z","repository_id":34156425,"created_at":"2025-08-14T13:44:47.190Z","updated_at":"2025-08-14T13:44:47.190Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31313235,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T12:59:32.332Z","status":"ssl_error","status_checked_at":"2026-04-02T12:54:48.875Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: 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":[],"created_at":"2024-11-08T17:37:08.078Z","updated_at":"2026-04-02T18:43:37.406Z","avatar_url":"https://github.com/AILHC.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# egf protobuf\n\n## 仓库迁移提示\n\n这个仓库不再更新了哦。因为我把这个工具进行优化集成到我的框架仓库中了。会持续优化更新~\n\n传送门: [EasyGameFramework](https://github.com/AILHC/EasyGameFrameworkOpen.git)\n\n## 特性\n\n\n1. 提供 protobuf.js 基础运行时库\n2. 提供命令行脚本，将 protofile 生成 JavaScript 代码\n3. 生成正确的 .d.ts 代码，以方便 TypeScript 项目使用\n5. 理论上支持所有 HTML5 游戏引擎。欢迎使用 PIXI.js , Cocos2d-js , LayaAir 等其他引擎的开发者使用本库。\n6. 封装protobufjs的命令行，不需另外安装protobufjs\n\n## 原理\n\n封装了 protobufjs 库及命令行。使用 protobufjs 6.8.4 的运行时库和命令行工具。\n\nprotobufjs 自身存在着 pbts 命令，虽然也可以生成 .d.ts 文件，但是在全局模式而非 ES6 module 的情况下存在一些错误，本项目致力于解决这个问题，使 protobufjs 可以在非 ES6 模块项目中（比如白鹭引擎,LayaAir引擎，Cocoscreator引擎）中也可以使用 protobufjs \n\nprotobufjs 提供了多种使用方式，由于微信小游戏禁止 eval , new Function 等动态代码形式，所以本项目只提供了生成代码的形式，不支持通过 ```protobuf.load('awesome.proto')``` 的方式（因为这种方式也无法在微信小游戏中运行）。\n\n\n## 如何安装\n\n```\nnpm install egf-protobuf -g\n或者\nnpm install -S egf-protobuf\n```\n\n## 如何使用\n\n\n+ 假设用户有个名为 project 的项目\n    \n    ```\n    cd projectRoot\n    egf-pb init //初始化项目\n    ```\n    \n+ 将 protofile 文件放在 projectRoot/protobuf/protofile 文件夹中\n+ 配置protobuf/pbconfig.json文件\n```json\n{\n\t\"options\": {\n            \"no-create\": false,//不生成用于反射兼容性的create函数。\n            \"no-verify\": false,//不生成验证函数。\n            \"no-convert\": true,//不生成解码函数。\n            \"no-delimited\": true,//不生成带分隔符的编码/解码函数。\n            \"no-encode\":false,//没有生成像from/toObject这样的转换函数吗\n            \"no-decode\":false//不生成编码函数。\n\t},\n\t\n\t\"outputFileType\":0,//导出文件类型 0 全部（js和.min.js）1(js) 2(.min.js)\n\t\"dtsOutDir\":\"../\",//定义文件输出目录\n\t\"sourceRoot\": \"../priv\",//proto文件目录\n\t\"outFileName\":\"\",//输出文件名\n\t\"outputDir\":\"../assets/proto\"//输出文件夹\n}\n```\n+ 使用生成命令\n\n    egf-pb generate\n    或者\n    egf-pb g\n\n\n## 更新日志\n\n### 1.2.0\n\n封装protobufjs的命令行，不需要另外安装protobufjs命令行\n优化生成逻辑，更快了\n优化文件写入逻辑，避免文件夹不存在报错\n\n### 1.0.2\n修复和确认某些windows环境 生成报错的问题\n\n### 1.0.1\n命令行命令运行使用第三方库commander;\n使用方式修改\n\n    1. pb-egf g\u003c或者generate\u003e   //生成当前项目目录下的protojs\n    2. pb-egf a\u003c或者add\u003e  \u003cegret/空\u003e //拷贝proto .d.ts定义文件，以及protojs的解析库，还有pb-egf的配置文件  可以传参数，egret 就是egret项目，不传则是通用初始化\n\n\n### 1.0.0\n初始版本，基于pb-egret改造，更加自由，protobuf的库文件和proto文件合并，兼容cocosCreator的使用\n\n## 已知问题\n\nproto 文件中的每一个协议一定要从属于一个 package，否则.d.ts生成会出现错误导致 ts 文件无法正确的找到这些类\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Failhc%2Fegf-protobuf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Failhc%2Fegf-protobuf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Failhc%2Fegf-protobuf/lists"}