mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
chore(forge): make the removed locales list more compact
This commit is contained in:
@@ -148,6 +148,7 @@ module.exports = {
|
|||||||
.filter(locale => !locale.contentOnly)
|
.filter(locale => !locale.contentOnly)
|
||||||
.map(locale => locale.electronLocale.replace("_", "-"));
|
.map(locale => locale.electronLocale.replace("_", "-"));
|
||||||
const keptLocales = new Set();
|
const keptLocales = new Set();
|
||||||
|
const removedLocales = [];
|
||||||
|
|
||||||
for (const outputPath of packageResult.outputPaths) {
|
for (const outputPath of packageResult.outputPaths) {
|
||||||
const localesDir = path.join(outputPath, 'locales');
|
const localesDir = path.join(outputPath, 'locales');
|
||||||
@@ -166,12 +167,14 @@ module.exports = {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log(`Removing unused locale file: ${file}`);
|
|
||||||
const filePath = path.join(localesDir, file);
|
const filePath = path.join(localesDir, file);
|
||||||
fs.unlinkSync(filePath);
|
fs.unlinkSync(filePath);
|
||||||
|
removedLocales.push(file);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`Removed unused locale files: ${removedLocales.join(", ")}`);
|
||||||
|
|
||||||
// Ensure all locales that should be kept are actually present.
|
// Ensure all locales that should be kept are actually present.
|
||||||
for (const locale of localesToKeep) {
|
for (const locale of localesToKeep) {
|
||||||
if (!keptLocales.has(locale)) {
|
if (!keptLocales.has(locale)) {
|
||||||
|
|||||||
Reference in New Issue
Block a user