mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: complete protos implementation
This commit is contained in:
1 parent
359dfcd102
commit
f3c1825c57
1 file changed
+10
-43
@@ -31,47 +31,6 @@ if (!tsProtoExecutableLocation) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// for (const root of ROOTS) {
|
|
||||||
// const filesRaw = await readdir(`${root}`);
|
|
||||||
// const files: string[] = [];
|
|
||||||
|
|
||||||
// for (const file of filesRaw) {
|
|
||||||
// if (file.endsWith(".proto")) files.push(file);
|
|
||||||
// if (file.endsWith(".ts")) await rm(`${root}/${file}`);
|
|
||||||
// }
|
|
||||||
|
|
||||||
// while (files.length > 0) {
|
|
||||||
// let command = [
|
|
||||||
// "protoc",
|
|
||||||
// `--plugin=${tsProtoExecutableLocation}`,
|
|
||||||
// "--ts_proto_opt=esModuleInterop=true",
|
|
||||||
// "--ts_proto_opt=oneof=unions-value",
|
|
||||||
// // "--ts_proto_opt=removeEnumPrefix=true",
|
|
||||||
// "--ts_proto_opt=unrecognizedEnum=false",
|
|
||||||
// "--ts_proto_opt=snakeToCamel=false",
|
|
||||||
// `--ts_proto_out=${root}`,
|
|
||||||
// ...ROOTS.map((root) => `-I=${root}`),
|
|
||||||
// ].join(" ");
|
|
||||||
|
|
||||||
// while (true) {
|
|
||||||
// if (files.length === 0) break;
|
|
||||||
|
|
||||||
// const file = files.at(-1);
|
|
||||||
// const newLine = ` ${root}/${file}`;
|
|
||||||
|
|
||||||
// if (command.length + newLine.length < MAX_COMMAND_LENGTH) {
|
|
||||||
// const file = files.pop();
|
|
||||||
// command += newLine;
|
|
||||||
// // console.log(` ${file}`);
|
|
||||||
// } else {
|
|
||||||
// break;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
// await exec(command);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
await mkdir("temp", { recursive: true });
|
await mkdir("temp", { recursive: true });
|
||||||
|
|
||||||
for (const root of ROOTS) {
|
for (const root of ROOTS) {
|
||||||
@@ -92,10 +51,18 @@ for (const root of ROOTS) {
|
|||||||
const files: string[] = [];
|
const files: string[] = [];
|
||||||
|
|
||||||
for (const file of filesRaw) {
|
for (const file of filesRaw) {
|
||||||
if (file.endsWith(".proto")) files.push(file);
|
if (file.endsWith(".proto")) {
|
||||||
|
files.push(file);
|
||||||
|
args += `${root}/${file}\n`;
|
||||||
|
}
|
||||||
|
|
||||||
if (file.endsWith(".ts")) await rm(`${root}/${file}`);
|
if (file.endsWith(".ts")) await rm(`${root}/${file}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
await writeFile("temp/protoc.txt", args);
|
await writeFile("temp/protoc.txt", args);
|
||||||
execFile("protoc", ["@temp/protoc.txt"]);
|
execFile("protoc", ["@temp/protoc.txt"], (error, stdout, stderr) => {
|
||||||
|
if (error) return console.error(`error: ${error.message}`);
|
||||||
|
if (stderr) return console.error(`stderr: ${stderr}`);
|
||||||
|
console.log(`stdout: ${stdout}`);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user