Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

gulp-protobuf

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

gulp-protobuf

Gulp task for the protobufjs pbjs and pbts tools

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Gulp Protobuf

Yet another gulp task for protobufs!

Circle CI npm Licence MIT

This gulp task wraps the protobufjs pbjs and pbts tools to allow generation of JavaScript code and TypeScript definitions without the need for the protoc binary.

Prerequisites

Node.js > v6.12.0, which includes npm.

Installation

$ npm install gulp-protobuf

Usage

Two tasks are exposed from this package, pbjs and pbts.

pbjs is used to translate between file formats and generate static code.

pbts is used to generate TypeScript definitions from annotated JavaScript files output from pbjs.

First, import this package into your gulpfile:

let protobuf = require("gulp-protobuf");

Then you can use either task in your gulp tasks individually:

gulp.task("protobuf-gen", () => {
    return gulp.src(protoFiles)
    .pipe(protobuf.pbjs({
        target: "static-module",
        wrap: "commonjs"
    }))
    .pipe(gulp.dest(distDir));
});
gulp.task("protobuf-types", ["protobuf-gen"], () => {
    return gulp.src(jsFiles)
    .pipe(protobuf.pbts())
    .pipe(gulp.dest(typesDir));
});

Alternatively, pipe both together to output just TypeScript definitions:

gulp.task("protobuf", () => {
    return gulp.src(protoFiles)
    .pipe(protobuf.pbjs({
        target: "static-module",
        wrap: "commonjs"
    }))
    .pipe(protobuf.pbts())
    .pipe(gulp.dest(typesDir));
});

Refer to the protobufjs documentation to see the options available for each command:

pbjs options pbts options

Keywords

FAQs

Package last updated on 06 May 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc