feat: lenient strings

This commit is contained in:
TrèsAbhi committed 2025-12-13 13:16:42 -06:00
1 parent 3b757562d2
commit 32b5593d07
2 files changed
+29 -22

No files matched your search

+2 -2
View File
@@ -11,7 +11,7 @@ const TS_PROTO_EXECUTABLE_LOCATIONS = [
const roots = [
// "../../packages/core/src/protos",
// "../../packages/closed/protos",
"../../packages/closed/protos",
"../../packages/website-ue/src/protos",
];
@@ -67,7 +67,7 @@ for (const root of roots) {
if (command.length + newLine.length < MAX_COMMAND_LENGTH) {
command += newLine;
files.pop();
console.log(` ${files.pop()}`);
} else {
break;
}
+27 -20
View File
@@ -53,30 +53,37 @@ export class ServerAPI extends AbstractAPI {
throw new Error("No suitable production remote storage found");
}
const config = await fetch(
`${remoteStorage.url}/${remoteStorage.relative_path}/config.yaml`
)
.then((response) => response.text())
.then((text) => parse(text) as LocalizationConfig);
const strings: Record<string, string> = {};
const configPath = `${remoteStorage.url}/${remoteStorage.relative_path}/config.yaml`;
for (const namespace of config.namespaces) {
Object.assign(
strings,
await fetch(
`${remoteStorage.url}/${remoteStorage.relative_path}/${namespace}/${locale}.yaml`
)
.then((response) => response.text())
.then((text) => {
const strings: Record<string, string> = {};
const parsed = parse(text) as Record<string, string>;
try {
const config = await fetch(configPath)
.then((response) => response.text())
.then((text) => parse(text) as LocalizationConfig);
for (const key in parsed) {
strings[key] = parsed[key].replaceAll('\\"', '"');
}
for (const namespace of config.namespaces) {
Object.assign(
strings,
await fetch(
`${remoteStorage.url}/${remoteStorage.relative_path}/${namespace}/${locale}.yaml`
)
.then((response) => response.text())
.then((text) => {
const strings: Record<string, string> = {};
const parsed = parse(text) as Record<string, string>;
return strings;
})
for (const key in parsed) {
strings[key] = parsed[key].replaceAll('\\"', '"');
}
return strings;
})
);
}
} catch (error) {
console.warn(
`Failed to fetch config from ${configPath}. Returning empty strings. This will throw an error in production. Error:`,
error
);
}