mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: import google
This commit is contained in:
1 parent
c8b5c216e3
commit
9a1c09490f
2 files changed
+29
-34
No files matched your search
+1
-1
Submodule packages/closed updated: 976589c702...362db82d56.
@@ -6,10 +6,7 @@ const TS_PROTO_EXECUTABLE_LOCATIONS = [
|
|||||||
"./node_modules/.bin/protoc-gen-ts_proto",
|
"./node_modules/.bin/protoc-gen-ts_proto",
|
||||||
"../../node_modules/.bin/protoc-gen-ts_proto",
|
"../../node_modules/.bin/protoc-gen-ts_proto",
|
||||||
];
|
];
|
||||||
const ROOTS = [
|
const ROOT = "../../packages/closed/protos";
|
||||||
"../../packages/closed/protos",
|
|
||||||
"../../packages/website-ue/src/protos",
|
|
||||||
];
|
|
||||||
|
|
||||||
let tsProtoExecutableLocation: string | undefined = undefined;
|
let tsProtoExecutableLocation: string | undefined = undefined;
|
||||||
|
|
||||||
@@ -33,36 +30,34 @@ if (!tsProtoExecutableLocation) {
|
|||||||
|
|
||||||
await mkdir("temp", { recursive: true });
|
await mkdir("temp", { recursive: true });
|
||||||
|
|
||||||
for (const root of ROOTS) {
|
let args = "";
|
||||||
let args = "";
|
|
||||||
|
|
||||||
for (const include of ROOTS) {
|
args += `-I=${ROOT}\n`;
|
||||||
args += `-I=${include}\n`;
|
args += `--plugin=${tsProtoExecutableLocation}\n`;
|
||||||
|
args += "--ts_proto_opt=esModuleInterop=true\n";
|
||||||
|
args += "--ts_proto_opt=oneof=unions-value\n";
|
||||||
|
args += "--ts_proto_opt=unrecognizedEnum=false\n";
|
||||||
|
args += "--ts_proto_opt=snakeToCamel=false\n";
|
||||||
|
args += `--ts_proto_out=${ROOT}\n`;
|
||||||
|
|
||||||
|
const filesRaw = await readdir(`${ROOT}`, { recursive: true });
|
||||||
|
const files: string[] = [];
|
||||||
|
|
||||||
|
for (const file of filesRaw) {
|
||||||
|
if (file.endsWith(".proto")) {
|
||||||
|
files.push(file);
|
||||||
|
args += `${ROOT}/${file}\n`;
|
||||||
}
|
}
|
||||||
|
|
||||||
args += `--plugin=${tsProtoExecutableLocation}\n`;
|
if (file.endsWith(".ts")) await rm(`${ROOT}/${file}`);
|
||||||
args += "--ts_proto_opt=esModuleInterop=true\n";
|
|
||||||
args += "--ts_proto_opt=oneof=unions-value\n";
|
|
||||||
args += "--ts_proto_opt=unrecognizedEnum=false\n";
|
|
||||||
args += "--ts_proto_opt=snakeToCamel=false\n";
|
|
||||||
args += `--ts_proto_out=${root}\n`;
|
|
||||||
|
|
||||||
const filesRaw = await readdir(`${root}`);
|
|
||||||
const files: string[] = [];
|
|
||||||
|
|
||||||
for (const file of filesRaw) {
|
|
||||||
if (file.endsWith(".proto")) {
|
|
||||||
files.push(file);
|
|
||||||
args += `${root}/${file}\n`;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (file.endsWith(".ts")) await rm(`${root}/${file}`);
|
|
||||||
}
|
|
||||||
|
|
||||||
await writeFile("temp/protoc.txt", args);
|
|
||||||
execFile("protoc", ["@temp/protoc.txt"], (error, stdout, stderr) => {
|
|
||||||
if (error) throw new Error(error.message);
|
|
||||||
if (stderr) console.error(stderr);
|
|
||||||
if (stdout) console.log(stdout);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await writeFile("temp/protoc.txt", args);
|
||||||
|
|
||||||
|
// throw "";
|
||||||
|
|
||||||
|
execFile("protoc", ["@temp/protoc.txt"], (error, stdout, stderr) => {
|
||||||
|
if (error) throw new Error(error.message);
|
||||||
|
if (stderr) console.error(stderr);
|
||||||
|
if (stdout) console.log(stdout);
|
||||||
|
});
|
||||||
Reference in new issue
Block a user