Skip to content

Build your personal knowledge base with Trilium Notes

chore(desktop): check the locale list only per Electron major

Elian Doran7ea11b2ea224
diff --git a/apps/desktop/electron-forge/trim-locales.spec.ts b/apps/desktop/electron-forge/trim-locales.spec.ts
index cefd4b0fed..57e4b88cba 100644
--- a/apps/desktop/electron-forge/trim-locales.spec.ts
+++ b/apps/desktop/electron-forge/trim-locales.spec.ts
@@ -31,11 +31,13 @@ afterEach(() => {
});
describe("trimElectronLocales", () => {
- it("runs against the locale files of the pinned Electron version", () => {
+ it("runs against the locale files of the pinned Electron major version", () => {
+ // Chromium changes its locale files only with a major version, which Electron
+ // adopts only in its own majors.
expect(
- electronLocales.electronVersion,
+ majorVersion(electronLocales.electronVersion),
"electron-locales.json is out of date; run `pnpm chore:update-electron-locales`"
- ).toBe(packageJson.devDependencies.electron);
+ ).toBe(majorVersion(packageJson.devDependencies.electron));
});
it.each([
@@ -77,3 +79,7 @@ describe("trimElectronLocales", () => {
expect(() => trimElectronLocales([ incomplete ], false)).toThrow(/was not found/);
});
});
+
+function majorVersion(version: string) {
+ return version.split(".")[0];
+}
diff --git a/scripts/update-electron-locales.ts b/scripts/update-electron-locales.ts
index 11c4c5113c..4b460e5d6b 100644
--- a/scripts/update-electron-locales.ts
+++ b/scripts/update-electron-locales.ts
@@ -7,8 +7,8 @@
* its spec runs against the file names a real Electron build carries rather than
* a hand-kept list. The desktop unit tests never download Electron, so this
* script reads the names once per Electron version and commits them as
- * `electron-locales.json`; the spec fails when that file names a version other
- * than the one `apps/desktop/package.json` pins.
+ * `electron-locales.json`; the spec fails when that file names a major version
+ * other than the one `apps/desktop/package.json` pins.
*
* Only the central directory at the end of each release zip is fetched, through
* HTTP range requests, so a run transfers a few hundred kilobytes instead of