Skip to content

Store settings with electron-store 12 - #379

Merged
jtklein-agents merged 2 commits into
spec/370-electron-build-and-runtime-packages-currentfrom
374-store-settings-with-electron-store-12
Nov 25, 2026
Merged

jtklein-agents merged 2 commits into
spec/370-electron-build-and-runtime-packages-currentfrom
374-store-settings-with-electron-store-12

Conversation

@jtklein-agents

Copy link
Copy Markdown
Owner

Closes #374

Summary

The main process uses electron-store 12. It and conf are ESM-only, so the CommonJS main build bundles them instead of calling require().

 // package.json
-"electron-store": "^8.1.0",
+"electron-store": "^12.0.0",

 // electron.vite.config.js
 main: {
   define: { __static },
   plugins: sourceMapUpload( command ),
+  build: {
+    externalizeDeps: { exclude: ['electron-store', 'conf'] },
+  },
 },

src/test/electron.ts loses its sendSync stub. Its comment said electron-store called it, but only the preload calls sendSync and no Vitest test imports the preload. CODING_STANDARDS.md › Test doubles drops a double with no caller.

Evidence

  • Before: out/main/index.js has require("electron-store"). electron-store 12 can't load that way, so the upgrade alone breaks main.
    After: yarn build gives a CommonJS out/main/index.js with no require("electron-store") or require("conf").
  • Before: a 2.0.19 config.json is { "darkMode": true }.
    After: I launched the built app once by hand with Playwright, pointing --user-data-dir at that file. The check is not committed.
    getDarkMode()        -> true
    setDarkMode(false)   -> config.json is { "darkMode": false }
    
  • yarn test passed 474/474, along with lint and the typecheck. App e2e passed 4/4 on macOS. Ubuntu and Windows are left to CI.

Merge Danger

Door: two-way

electron-store 12 reads and writes the same userData/config.json with the same key, so rolling back to 8 keeps the user's settings.

Blast Radius: settings

Only the dark-mode setting is stored. The built out/main/index.js contains require("ajv/…") text from ajv's code generator. Nothing runs it unless ajv standalone code is turned on; if it is, the require would hit the top-level ajv 6 instead of the ajv 8 that conf uses.

🤖 Generated with Claude Code

jtklein-agents and others added 2 commits November 25, 2026 23:18
electron-store 12 and conf are ESM-only, so the CommonJS main bundles
them through externalizeDeps.exclude. A 2.0.19 config.json still loads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…tore-settings-with-electron-store-12

Keeps electron-log 5 (#375) and electron-store 12, and regenerates yarn.lock.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jtklein-agents
jtklein-agents merged commit cd234a6 into spec/370-electron-build-and-runtime-packages-current Nov 25, 2026
9 checks passed
@jtklein-agents
jtklein-agents deleted the 374-store-settings-with-electron-store-12 branch November 25, 2026 23:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant