migrate to Protobuf ES

This commit is contained in:
seavor 2026-04-13 15:03:57 -05:00
parent 68e22d22bf
commit fd55f4fb7f
133 changed files with 1745 additions and 1621 deletions

View file

@ -6,13 +6,10 @@ const exec = util.promisify(require('child_process').exec);
const ROOT_DIR = './src';
const PUBLIC_DIR = './public';
const protoFilesDir = `${PUBLIC_DIR}/pb`;
const i18nDefaultFile = `${ROOT_DIR}/i18n-default.json`;
const serverPropsFile = `${ROOT_DIR}/server-props.json`;
const masterProtoFile = `${ROOT_DIR}/proto-files.json`;
const sharedFiles = [
['../libcockatrice_protocol/libcockatrice/protocol/pb', protoFilesDir],
['../cockatrice/resources/countries', `${ROOT_DIR}/images/countries`],
];
@ -26,10 +23,8 @@ const i18nOnly = process.argv.indexOf('-i18nOnly') > -1;
return;
}
// make sure these files finish copying before master file is created
await copySharedFiles();
await createMasterProtoFile();
await createServerProps();
await createI18NDefault();
})();
@ -43,19 +38,6 @@ async function copySharedFiles() {
}
}
async function createMasterProtoFile() {
try {
fse.readdir(protoFilesDir, (err, files) => {
if (err) throw err;
fse.outputFile(masterProtoFile, JSON.stringify(files.filter(file => /\.proto$/.test(file))));
});
} catch (e) {
console.error(e);
process.exitCode = 1;
}
}
async function createServerProps() {
try {
fse.outputFile(serverPropsFile, JSON.stringify({