mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-26 03:59:53 +01:00
Compare commits
5
Commits
f8029bdf67
...
68edf520c5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
68edf520c5 | ||
|
|
f7933a1295 | ||
|
|
9a1c09490f | ||
|
|
c8b5c216e3 | ||
|
|
344954513a |
No files matched your search
Vendored
+1
-1
@@ -263,5 +263,5 @@
|
||||
"youtubers",
|
||||
"zoomable"
|
||||
],
|
||||
"typescript.tsdk": "node_modules\\typescript\\lib"
|
||||
"protobuf.includes": ["${workspaceFolder}/path/to/protos"]
|
||||
}
|
||||
+1
-1
Submodule packages/closed updated: 55bbd00fe3...636cf9aeb2.
@@ -1,6 +1,6 @@
|
||||
import { readdir, readFile, writeFile } from "fs/promises";
|
||||
|
||||
const SOURCES = "../../packages/closed/protos";
|
||||
const SOURCES = "../../packages/closed/protos/game/proto/legacy";
|
||||
const TARGET = "../../packages/closed/src/unreal/catalogItemAccessor.ts";
|
||||
|
||||
const componentPattern = /^message (\w+)Component {/gm;
|
||||
@@ -8,15 +8,15 @@ const componentPattern = /^message (\w+)Component {/gm;
|
||||
const files = await readdir(SOURCES).then((files) =>
|
||||
files.filter(
|
||||
(file) =>
|
||||
file.startsWith("blitz_static_") && file.endsWith("_component.proto")
|
||||
)
|
||||
file.startsWith("blitz_static_") && file.endsWith("_component.proto"),
|
||||
),
|
||||
);
|
||||
|
||||
const imports: { name: string; file: string }[] = [];
|
||||
|
||||
for (const file of files) {
|
||||
const content = await readFile(`${SOURCES}/${file}`).then((buffer) =>
|
||||
buffer.toString()
|
||||
buffer.toString(),
|
||||
);
|
||||
const components = content.matchAll(componentPattern);
|
||||
|
||||
@@ -26,7 +26,7 @@ for (const file of files) {
|
||||
|
||||
if (duplicate) {
|
||||
console.warn(
|
||||
`Duplicate component ${name} across ${duplicate.file}.proto and ${file}`
|
||||
`Duplicate component ${name} across ${duplicate.file}.proto and ${file}`,
|
||||
);
|
||||
continue;
|
||||
}
|
||||
@@ -40,7 +40,7 @@ for (const file of files) {
|
||||
let content = "";
|
||||
|
||||
for (const _import of imports) {
|
||||
content += `import { ${_import.name}Component } from "@protos/${_import.file}";\n`;
|
||||
content += `import { ${_import.name}Component } from "@protos/game/proto/legacy/${_import.file}";\n`;
|
||||
}
|
||||
|
||||
content +=
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import { readFile, writeFile } from "fs/promises";
|
||||
|
||||
const IMPORT = "@protos/auto_legacy_proxy_client";
|
||||
const SOURCE = "../../packages/closed/protos/auto_legacy_proxy_client.proto";
|
||||
const IMPORT = "@protos/game/proto/legacy/auto_legacy_proxy_client";
|
||||
const SOURCE =
|
||||
"../../packages/closed/protos/game/proto/legacy/auto_legacy_proxy_client.proto";
|
||||
const TARGET = "../../packages/closed/src/unreal/methodPopulatedProxyClient.ts";
|
||||
|
||||
const requestPattern = /^message (\w+)Request {/gm;
|
||||
|
||||
@@ -6,10 +6,7 @@ const TS_PROTO_EXECUTABLE_LOCATIONS = [
|
||||
"./node_modules/.bin/protoc-gen-ts_proto",
|
||||
"../../node_modules/.bin/protoc-gen-ts_proto",
|
||||
];
|
||||
const ROOTS = [
|
||||
"../../packages/closed/protos",
|
||||
"../../packages/website-ue/src/protos",
|
||||
];
|
||||
const ROOT = "../../packages/closed/protos";
|
||||
|
||||
let tsProtoExecutableLocation: string | undefined = undefined;
|
||||
|
||||
@@ -33,36 +30,34 @@ if (!tsProtoExecutableLocation) {
|
||||
|
||||
await mkdir("temp", { recursive: true });
|
||||
|
||||
for (const root of ROOTS) {
|
||||
let args = "";
|
||||
let args = "";
|
||||
|
||||
for (const include of ROOTS) {
|
||||
args += `-I=${include}\n`;
|
||||
args += `-I=${ROOT}\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`;
|
||||
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);
|
||||
});
|
||||
if (file.endsWith(".ts")) await rm(`${ROOT}/${file}`);
|
||||
}
|
||||
|
||||
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);
|
||||
});
|
||||
@@ -1,14 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "blitz_static_profile_avatar_component.proto";
|
||||
import "blitz_static_sellable_component.proto";
|
||||
import "blitz_static_stuff_ui_component.proto";
|
||||
|
||||
message Avatar {
|
||||
string name = 1;
|
||||
blitz_static_stuff_ui_component.StuffUIComponent stuff_ui = 2;
|
||||
blitz_static_profile_avatar_component.ProfileAvatarComponent profile_avatar = 3;
|
||||
optional blitz_static_sellable_component.SellableComponent sellable = 4;
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
message AvatarList {
|
||||
repeated string list = 1;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "avatar.proto";
|
||||
|
||||
message Avatars {
|
||||
repeated Avatar avatars = 1;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "blitz_static_profile_background_component.proto";
|
||||
import "blitz_static_sellable_component.proto";
|
||||
import "blitz_static_stuff_ui_component.proto";
|
||||
|
||||
message Background {
|
||||
string name = 1;
|
||||
blitz_static_stuff_ui_component.StuffUIComponent stuff_ui = 2;
|
||||
blitz_static_profile_background_component.ProfileBackgroundComponent profile_background = 3;
|
||||
optional blitz_static_sellable_component.SellableComponent sellable = 4;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "background.proto";
|
||||
|
||||
message Backgrounds {
|
||||
repeated Background backgrounds = 1;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
message PopularTanks {
|
||||
repeated PopularTank tanks = 1;
|
||||
}
|
||||
|
||||
message PopularTank {
|
||||
string id = 1;
|
||||
int32 views = 2;
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "blitz_static_compensation_component.proto";
|
||||
import "blitz_static_tank_component.proto";
|
||||
|
||||
message Tank {
|
||||
string id = 1;
|
||||
string slug = 2;
|
||||
|
||||
blitz_static_tank_component.TankCatalogComponent tank = 3;
|
||||
blitz_static_compensation_component.CompensationComponent compensation = 4;
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
message TankList {
|
||||
repeated TankListEntry list = 1;
|
||||
}
|
||||
|
||||
message TankListEntry {
|
||||
string id = 1;
|
||||
string slug = 2;
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
syntax = "proto3";
|
||||
|
||||
package blitzkit;
|
||||
|
||||
import "tank.proto";
|
||||
|
||||
message Tanks {
|
||||
map<string, Tank> tanks = 1;
|
||||
}
|
||||
Reference in new issue
Block a user