chore(forge): make the removed locales list more compact

This commit is contained in:
Elian Doran 2025-06-15 11:20:18 +03:00
parent 77497dbc28
commit 9a2264c7f6
No known key found for this signature in database

View File

@ -148,6 +148,7 @@ module.exports = {
.filter(locale => !locale.contentOnly)
.map(locale => locale.electronLocale.replace("_", "-"));
const keptLocales = new Set();
const removedLocales = [];
for (const outputPath of packageResult.outputPaths) {
const localesDir = path.join(outputPath, 'locales');
@ -166,12 +167,14 @@ module.exports = {
continue;
}
console.log(`Removing unused locale file: ${file}`);
const filePath = path.join(localesDir, file);
fs.unlinkSync(filePath);
removedLocales.push(file);
}
}
console.log(`Removed unused locale files: ${removedLocales.join(", ")}`);
// Ensure all locales that should be kept are actually present.
for (const locale of localesToKeep) {
if (!keptLocales.has(locale)) {