Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Apple M1 chips. #10

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
A wrapper in Node for the compiled protoc from https://github.com/protocolbuffers/protobuf.

## Version
It's currently using Protocol Buffers `v3.20.3`.
It's currently using Protocol Buffers `v21.9`.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work. See #7 (comment), why.


## Platforms
Google only provides binary files for Windows, Linux and OSX in x86_64 and x86_32.
Google only provides binary files for Windows, Linux and macOS in aarch64, x86_64 and x86_32.

## Examples
There's currently no documentation. Hopefully this example will help.
Expand Down
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ exports.closure = function(files, options, callback) {
* Converts .proto files to .js files that can be used in Google Closure
* Compiler.
* The generated .js files require the files in
* https://github.com/protocolbuffers/protobuf/tree/v3.20.3/js.
* https://github.com/protocolbuffers/protobuf-javascript.
* @param {?Array<string>} files the proto files.
* @param {?function(?Error, ?Array<Vinyl>)} callback the callback method.
*/
Expand Down
12 changes: 9 additions & 3 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@ const unzip = require("unzipper");
const mkdirp = require("mkdirp");
const protoc = require("../protoc.js");

const protoVersion = "3.20.3";
const protoVersion = "21.9";

const releases = {
"win32_x86_32": `https://github.com/protocolbuffers/protobuf/releases/download/v${protoVersion}/protoc-${protoVersion}-win32.zip`,
"win32_x86_64": `https://github.com/protocolbuffers/protobuf/releases/download/v${protoVersion}/protoc-${protoVersion}-win32.zip`,
"linux_x86_32": `https://github.com/protocolbuffers/protobuf/releases/download/v${protoVersion}/protoc-${protoVersion}-linux-x86_32.zip`,
"linux_x86_64": `https://github.com/protocolbuffers/protobuf/releases/download/v${protoVersion}/protoc-${protoVersion}-linux-x86_64.zip`,
"darwin_x86_64": `https://github.com/protocolbuffers/protobuf/releases/download/v${protoVersion}/protoc-${protoVersion}-osx-x86_64.zip`
"darwin_x86_64": `https://github.com/protocolbuffers/protobuf/releases/download/v${protoVersion}/protoc-${protoVersion}-osx-x86_64.zip`,
"darwin_arm64": `https://github.com/protocolbuffers/protobuf/releases/download/v${protoVersion}/protoc-${protoVersion}-osx-aarch_64.zip`
};

const platform = process.platform;
const arch = process.arch === "x64" ? "x86_64" : "x86_32";
const arch =
process.arch === "arm64"
? "arm64"
: process.arch === "x64"
? "x86_64"
: "x86_32";
const release = platform + "_" + arch;
const protocDirectory = path.join(__dirname, "..", "protoc");

Expand Down