npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@accility/protoc-tools

v0.15.0

Published

Utility for Google's protobuf compiler protoc

Downloads

46

Readme

Protocol Buffer Tools

:warning: This package is still in early days and the interfaces might change back and forth. When stable enough it will be released as v1.0.

protoc-tools is a wrapper package for Google's .proto compiler protoc executable. The package manages installing and calling protoc both from the command line and programmatically from node.

What problems do we solve?

  • No need to pre-install the protoc executable file globally on your machine.
  • On a build server, the correct architecture for the executable is automatically used.
  • Simplify calling protoc. You do not need to know the location of the exectuable or the core proto-files. You only need to reference your own protobuffer files.
  • Better conformance to the "npm-way" of doing things.

Installing

npm install -D @accility/protoc-tools

Alternatively Install globally

npm install -g @accility/protoc-tools

Usage

Calling protoc on the command line

(Assuming you are located where the node_modules package can be reached.)

protoc --version

Calling protoc programmatically

const tools = require('@accility/protoc-tools');
const path = require('path');

// Generate client code for all supported languages
tools.protoc({
    includeDirs: [
        path.resolve('./test/protos')
    ],
    files: ['simple.proto'],
    outDir: path.resolve(__dirname, 'generated'),
    outOptions: [
        tools.generators.cpp({ outPath: path.resolve(__dirname, 'generated/cpp') }), // Override output folder for the C++ files
        tools.generators.csharp({ outOptions: 'file_extension=.g.cs' }), // Use generator specific options
        tools.generators.java(),
        tools.generators.js(),
        tools.generators.kotlin(),
        tools.generators.objc(),
        tools.generators.php(),
        tools.generators.python(),
        tools.generators.ruby()
    ]
});

:information_source: The directory include/google/protobuf includes all core .proto-files, and is automatically added to the include directories.

For more API examples, see the test suite.

Code Generators

protoc can output C++, C#, Java, Javascript, Kotlin, Objective-C, PHP, Python and Ruby serialization code by default.

:information_source: See Generator Options for information about available options for each of the built-in generators.

With the help of plugins we can generate code for additional situations. See also:

@accility/protoc-swagger-plugin