mirror of
https://github.com/protobufjs/protobuf.js.git
synced 2025-12-08 20:58:55 +00:00
25 lines
690 B
JavaScript
25 lines
690 B
JavaScript
var fs = require("fs"),
|
|
path = require("path"),
|
|
pbjs = require("../cli/pbjs");
|
|
|
|
[
|
|
"tests/data/package.proto",
|
|
"tests/data/rpc.proto",
|
|
"tests/data/mapbox/vector_tile.proto",
|
|
"tests/data/ambiguous-names.proto"
|
|
]
|
|
.forEach(function(file) {
|
|
var out = file.replace(/\.proto$/, ".js");
|
|
pbjs.main([
|
|
"--target", "static-module",
|
|
"--wrap", "commonjs",
|
|
"--root", "test_" + path.basename(out, ".js"),
|
|
"--out", out,
|
|
file
|
|
], function(err) {
|
|
if (err)
|
|
throw err;
|
|
fs.writeFileSync(out, fs.readFileSync(out).toString("utf8").replace(/\"protobufjs\/runtime\"/, "\"../../runtime\""), "utf8");
|
|
})
|
|
});
|