protobuf
Protocol buffers for H5 game
Reference
Feature
- protobuf.js, protobuf.d.ts and pbconfig.json will be added to your project automatically after the package was installed
- support node >= 12
Install
Local
npm:
$ npm install --save @porky-prince/protobuf
yarn:
$ yarn add @porky-prince/protobuf
Global
npm:
$ npm install -g @porky-prince/protobuf
yarn:
$ yarn add global @porky-prince/protobuf
Usage
Using in code
const protobuf = require('@porky-prince/protobuf');
async function run() {
await protobuf.add(projectRoot, true);
await protobuf.generate(projectRoot);
}
Command line usage
First, you have to install the dependency package globally
$ porky-pb <command>
example:
$ porky-pb generate you-project-root
Command line options
add [options] <projectRoot> add protobuf.js, protobuf.d.ts and pbconfig.json to
your project
generate <projectRoot> generate bundle.js and bundle.d.ts to your project
by proto files
help [command] display help for command