refactor(main): create src/main/{store,index}.js glue layer; new entrypoint at src/main/index.js

This commit is contained in:
2026-06-06 14:08:13 +05:30
parent 6651dccfdf
commit 054ce2351a
4 changed files with 3436 additions and 3423 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
"name": "markdown-converter", "name": "markdown-converter",
"version": "4.4.2", "version": "4.4.2",
"description": "Professional Markdown editor and universal file converter with PDF editing, batch processing, and syntax highlighting", "description": "Professional Markdown editor and universal file converter with PDF editing, batch processing, and syntax highlighting",
"main": "src/main.js", "main": "src/main/index.js",
"scripts": { "scripts": {
"start": "electron .", "start": "electron .",
"test": "jest", "test": "jest",
+3 -3422
View File
File diff suppressed because it is too large Load Diff
+3401
View File
File diff suppressed because it is too large Load Diff
+31
View File
@@ -0,0 +1,31 @@
// src/main/store.js
// Simple JSON-file preferences store (replaces electron-store)
const { app } = require('electron');
const path = require('path');
const fs = require('fs');
const settingsPath = path.join(app.getPath('userData'), 'settings.json');
const store = {
get(key, defaultValue) {
try {
const data = fs.readFileSync(settingsPath, 'utf-8');
const settings = JSON.parse(data);
return settings[key] !== undefined ? settings[key] : defaultValue;
} catch {
return defaultValue;
}
},
set(key, value) {
let settings = {};
try {
const data = fs.readFileSync(settingsPath, 'utf-8');
settings = JSON.parse(data);
} catch {}
settings[key] = value;
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
}
};
module.exports = store;