A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
desktop: convert all files to use es imports
Abdullah Atta5d94db7b6c50
diff --git a/apps/web/desktop/autoupdate.js b/apps/web/desktop/autoupdate.jsindex de6eabd34..e377e1b8a 100644--- a/apps/web/desktop/autoupdate.js+++ b/apps/web/desktop/autoupdate.js@@ -17,9 +17,9 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { autoUpdater } = require("electron-updater");-const { EVENTS } = require("./events");-const { sendMessageToRenderer } = require("./ipc/utils");+import { autoUpdater } from "electron-updater";+import { EVENTS } from "./events";+import { sendMessageToRenderer } from "./ipc/utils";async function configureAutoUpdater() {autoUpdater.setFeedURL({@@ -49,4 +49,4 @@ async function configureAutoUpdater() {});}-module.exports = { configureAutoUpdater };+export { configureAutoUpdater };diff --git a/apps/web/desktop/config/theme.js b/apps/web/desktop/config/theme.jsindex 2ac37dc3c..cc6ff113f 100644--- a/apps/web/desktop/config/theme.js+++ b/apps/web/desktop/config/theme.js@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const JSONStorage = require("../jsonstorage");-const { nativeTheme } = require("electron");+import { JSONStorage } from "../jsonstorage";+import { nativeTheme } from "electron";function getTheme() {return JSONStorage.get("theme") || "light";@@ -34,4 +34,4 @@ function getBackgroundColor() {return nativeTheme.shouldUseDarkColors ? "#0f0f0f" : "#ffffff";}-module.exports = { getTheme, setTheme, getBackgroundColor };+export { getTheme, setTheme, getBackgroundColor };diff --git a/apps/web/desktop/config/windowstate.js b/apps/web/desktop/config/windowstate.jsindex 3668980de..6c9bc62e5 100644--- a/apps/web/desktop/config/windowstate.js+++ b/apps/web/desktop/config/windowstate.js@@ -17,9 +17,9 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const JSONStorage = require("../jsonstorage");-const electron = require("electron");-const screen = electron.screen || electron.remote.screen;+import { JSONStorage } from "../jsonstorage";+import { screen as _screen, remote } from "electron";+const screen = _screen || remote.screen;class WindowState {constructor(options) {@@ -217,4 +217,4 @@ class WindowState {}}-module.exports = WindowState;+export { WindowState };diff --git a/apps/web/desktop/config/zoomfactor.js b/apps/web/desktop/config/zoomfactor.jsindex 95d27b385..c2f671141 100644--- a/apps/web/desktop/config/zoomfactor.js+++ b/apps/web/desktop/config/zoomfactor.js@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const JSONStorage = require("../jsonstorage");+import { JSONStorage } from "../jsonstorage";function getZoomFactor() {let factor = parseFloat(JSONStorage.get("zoomFactor"));@@ -28,4 +28,4 @@ function setZoomFactor(factor) {return JSONStorage.set("zoomFactor", factor.toString());}-module.exports = { setZoomFactor, getZoomFactor };+export { setZoomFactor, getZoomFactor };diff --git a/apps/web/desktop/electron.js b/apps/web/desktop/electron.jsindex 41b0f058e..e2afbbe11 100644--- a/apps/web/desktop/electron.js+++ b/apps/web/desktop/electron.js@@ -16,28 +16,26 @@ GNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-/* global MAC_APP_STORE */--require("isomorphic-fetch");-const { app, BrowserWindow, nativeTheme, shell } = require("electron");-const path = require("path");-const os = require("os");-const { isDevelopment } = require("./utils");-const { registerProtocol, URL } = require("./protocol");-const { configureAutoUpdater } = require("./autoupdate");-const { getBackgroundColor, getTheme, setTheme } = require("./config/theme");-const getZoomFactor = require("./ipc/calls/getZoomFactor");-const { logger } = require("./logger");-const { setupMenu } = require("./menu");-const WindowState = require("./config/windowstate");-const { sendMessageToRenderer } = require("./ipc/utils");-const { EVENTS } = require("./events");--require("./ipc/index.js");-try {+/* global MAC_APP_STORE, RELEASE */++import "isomorphic-fetch";+import { app, BrowserWindow, nativeTheme, shell } from "electron";+import { join } from "path";+import { platform } from "os";+import { isDevelopment } from "./utils";+import { registerProtocol, PROTOCOL_URL } from "./protocol";+import { configureAutoUpdater } from "./autoupdate";+import { getBackgroundColor, getTheme, setTheme } from "./config/theme";+import getZoomFactor from "./ipc/calls/getZoomFactor";+import { logger } from "./logger";+import { setupMenu } from "./menu";+import { WindowState } from "./config/windowstate";+import { sendMessageToRenderer } from "./ipc/utils";+import { EVENTS } from "./events";+import "./ipc/index.js";++if (!RELEASE) {require("electron-reloader")(module);-} catch (_) {- // ignore}// only run a single instance@@ -61,9 +59,9 @@ async function createWindow() {height: mainWindowState.height,backgroundColor: getBackgroundColor(),autoHideMenuBar: true,- icon: path.join(+ icon: join(__dirname,- os.platform() === "win32" ? "app.ico" : "favicon-72x72.png"+ platform() === "win32" ? "app.ico" : "favicon-72x72.png"),webPreferences: {zoomFactor: getZoomFactor(),@@ -84,7 +82,9 @@ async function createWindow() {mainWindow.webContents.openDevTools({ mode: "right", activate: true });try {- await mainWindow.loadURL(isDevelopment() ? "http://localhost:3000" : URL);+ await mainWindow.loadURL(+ isDevelopment() ? "http://localhost:3000" : PROTOCOL_URL+ );} catch (e) {logger.error(e);}diff --git a/apps/web/desktop/events.js b/apps/web/desktop/events.jsindex 32e64bd0e..0670fccf4 100644--- a/apps/web/desktop/events.js+++ b/apps/web/desktop/events.js@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-module.exports.EVENTS = {+export const EVENTS = {checkingForUpdate: "checkingForUpdate",updateAvailable: "updateAvailable",updateDownloadProgress: "updateDownloadProgress",diff --git a/apps/web/desktop/ipc/actions/changeAppTheme.js b/apps/web/desktop/ipc/actions/changeAppTheme.jsindex 9492d182e..a56a897ff 100644--- a/apps/web/desktop/ipc/actions/changeAppTheme.js+++ b/apps/web/desktop/ipc/actions/changeAppTheme.js@@ -17,9 +17,9 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { setTheme } = require("../../config/theme");+import { setTheme } from "../../config/theme";-module.exports = (args) => {+export default (args) => {if (!global.win) return;const { theme } = args;setTheme(theme);diff --git a/apps/web/desktop/ipc/actions/checkForUpdate.js b/apps/web/desktop/ipc/actions/checkForUpdate.jsindex 1d05c3b69..073cbf080 100644--- a/apps/web/desktop/ipc/actions/checkForUpdate.js+++ b/apps/web/desktop/ipc/actions/checkForUpdate.js@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { autoUpdater } = require("electron-updater");+import { autoUpdater } from "electron-updater";-module.exports = () => {+export default () => {autoUpdater.checkForUpdates();};diff --git a/apps/web/desktop/ipc/actions/downloadUpdate.js b/apps/web/desktop/ipc/actions/downloadUpdate.jsindex 80be11b57..23bb19a54 100644--- a/apps/web/desktop/ipc/actions/downloadUpdate.js+++ b/apps/web/desktop/ipc/actions/downloadUpdate.js@@ -17,12 +17,12 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { CancellationToken } = require("builder-util-runtime");-const { autoUpdater } = require("electron-updater");-const { EVENTS } = require("../../events");-const { sendMessageToRenderer } = require("../utils");+import { CancellationToken } from "builder-util-runtime";+import { autoUpdater } from "electron-updater";+import { EVENTS } from "../../events";+import { sendMessageToRenderer } from "../utils";-module.exports = () => {+export default () => {sendMessageToRenderer(EVENTS.updateDownloadProgress, { progress: 0 });autoUpdater.cancellationToken = new CancellationToken();autoUpdater.downloadUpdate(autoUpdater.cancellationToken);diff --git a/apps/web/desktop/ipc/actions/index.js b/apps/web/desktop/ipc/actions/index.jsindex df18a8f4b..361d6cde8 100644--- a/apps/web/desktop/ipc/actions/index.js+++ b/apps/web/desktop/ipc/actions/index.js@@ -17,13 +17,13 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const changeAppTheme = require("./changeAppTheme");-const checkForUpdate = require("./checkForUpdate");-const downloadUpdate = require("./downloadUpdate");-const installUpdate = require("./installUpdate");-const open = require("./open");-const saveFile = require("./saveFile");-const setZoomFactor = require("./setZoomFactor");+import changeAppTheme from "./changeAppTheme";+import checkForUpdate from "./checkForUpdate";+import downloadUpdate from "./downloadUpdate";+import installUpdate from "./installUpdate";+import open from "./open";+import saveFile from "./saveFile";+import setZoomFactor from "./setZoomFactor";const actions = {changeAppTheme,@@ -35,11 +35,11 @@ const actions = {setZoomFactor};-module.exports.getAction = function getAction(actionName) {+export function getAction(actionName) {try {if (!actions[actionName]) throw new Error("Invalid action name.");} catch (e) {console.error(e);}return actions[actionName];-};+}diff --git a/apps/web/desktop/ipc/actions/installUpdate.js b/apps/web/desktop/ipc/actions/installUpdate.jsindex efea114c2..244ec916c 100644--- a/apps/web/desktop/ipc/actions/installUpdate.js+++ b/apps/web/desktop/ipc/actions/installUpdate.js@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { autoUpdater } = require("electron-updater");+import { autoUpdater } from "electron-updater";-module.exports = () => {+export default () => {autoUpdater.quitAndInstall();};diff --git a/apps/web/desktop/ipc/actions/open.js b/apps/web/desktop/ipc/actions/open.jsindex e8f994a3d..987fd38b3 100644--- a/apps/web/desktop/ipc/actions/open.js+++ b/apps/web/desktop/ipc/actions/open.js@@ -17,9 +17,10 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { shell } = require("electron");-const { resolvePath } = require("../utils");-module.exports = (args) => {+import { shell } from "electron";+import { resolvePath } from "../utils";++export default (args) => {const { link, linkType } = args;if (linkType === "path") return shell.openPath(resolvePath(link));};diff --git a/apps/web/desktop/ipc/actions/saveFile.js b/apps/web/desktop/ipc/actions/saveFile.jsindex fbd9c9fdc..6a4ce4d85 100644--- a/apps/web/desktop/ipc/actions/saveFile.js+++ b/apps/web/desktop/ipc/actions/saveFile.js@@ -17,12 +17,12 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const fs = require("fs");-const path = require("path");-const { logger } = require("../../logger");-const { resolvePath } = require("../utils");+import { mkdirSync, writeFileSync } from "fs";+import { dirname } from "path";+import { logger } from "../../logger";+import { resolvePath } from "../utils";-module.exports = (args) => {+export default (args) => {try {const { data, filePath } = args;if (!data || !filePath) return;@@ -31,8 +31,8 @@ module.exports = (args) => {logger.info("Saving file to", resolvedPath);- fs.mkdirSync(path.dirname(resolvedPath), { recursive: true });- fs.writeFileSync(resolvedPath, data);+ mkdirSync(dirname(resolvedPath), { recursive: true });+ writeFileSync(resolvedPath, data);logger.info("File saved to", resolvedPath);} catch (e) {diff --git a/apps/web/desktop/ipc/actions/setZoomFactor.js b/apps/web/desktop/ipc/actions/setZoomFactor.jsindex 460c6f3c7..44962171c 100644--- a/apps/web/desktop/ipc/actions/setZoomFactor.js+++ b/apps/web/desktop/ipc/actions/setZoomFactor.js@@ -17,9 +17,9 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { setZoomFactor } = require("../../config/zoomfactor");+import { setZoomFactor } from "../../config/zoomfactor";-module.exports = (args) => {+export default (args) => {if (!global.win) return;const { zoomFactor } = args;global.win.webContents.setZoomFactor(zoomFactor);diff --git a/apps/web/desktop/ipc/calls/getZoomFactor.js b/apps/web/desktop/ipc/calls/getZoomFactor.jsindex d376574e2..f866ad363 100644--- a/apps/web/desktop/ipc/calls/getZoomFactor.js+++ b/apps/web/desktop/ipc/calls/getZoomFactor.js@@ -17,8 +17,8 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { getZoomFactor } = require("../../config/zoomfactor");+import { getZoomFactor } from "../../config/zoomfactor";-module.exports = function () {+export default function () {return getZoomFactor();-};+}diff --git a/apps/web/desktop/ipc/calls/index.js b/apps/web/desktop/ipc/calls/index.jsindex cd11b10c4..4dc408377 100644--- a/apps/web/desktop/ipc/calls/index.js+++ b/apps/web/desktop/ipc/calls/index.js@@ -17,15 +17,15 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const getZoomFactor = require("./getZoomFactor");-const selectDirectory = require("./selectDirectory");+import getZoomFactor from "./getZoomFactor";+import selectDirectory from "./selectDirectory";const calls = {getZoomFactor,selectDirectory};-module.exports.getCall = function getAction(callName) {+export const getCall = function getAction(callName) {try {if (!calls[callName]) throw new Error("Invalid call name.");} catch (e) {diff --git a/apps/web/desktop/ipc/calls/selectDirectory.js b/apps/web/desktop/ipc/calls/selectDirectory.jsindex 17bd67851..cae1e4b0c 100644--- a/apps/web/desktop/ipc/calls/selectDirectory.js+++ b/apps/web/desktop/ipc/calls/selectDirectory.js@@ -17,10 +17,10 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { dialog } = require("electron");-const { resolvePath } = require("../utils");+import { dialog } from "electron";+import { resolvePath } from "../utils";-module.exports = async function (args, win) {+export default async function (args, win) {const { title, buttonLabel, defaultPath } = args;const result = await dialog.showOpenDialog(win, {@@ -32,4 +32,4 @@ module.exports = async function (args, win) {if (result.canceled) return;return result.filePaths[0];-};+}diff --git a/apps/web/desktop/ipc/index.js b/apps/web/desktop/ipc/index.jsindex 3f92a8795..4f96ccf5f 100644--- a/apps/web/desktop/ipc/index.js+++ b/apps/web/desktop/ipc/index.js@@ -17,10 +17,10 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { ipcMain } = require("electron");-const { logger } = require("../logger");-const { getAction } = require("./actions");-const { getCall } = require("./calls");+import { ipcMain } from "electron";+import { logger } from "../logger";+import { getAction } from "./actions";+import { getCall } from "./calls";ipcMain.on("fromRenderer", async (event, args) => {logger.info("Action requested by renderer", args);diff --git a/apps/web/desktop/ipc/utils.js b/apps/web/desktop/ipc/utils.jsindex 10570bbb7..6c2743eca 100644--- a/apps/web/desktop/ipc/utils.js+++ b/apps/web/desktop/ipc/utils.js@@ -17,9 +17,9 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { logger } = require("../logger");-const { app } = require("electron");-const path = require("path");+import { logger } from "../logger";+import { app } from "electron";+import { isAbsolute, join } from "path";function sendMessageToRenderer(type, payload = {}) {const message = { type, ...payload };@@ -28,9 +28,9 @@ function sendMessageToRenderer(type, payload = {}) {}function resolvePath(_path) {- if (path.isAbsolute(_path)) return _path;+ if (isAbsolute(_path)) return _path;- return path.join(+ return join(..._path.split("/").map((segment) => {let resolved = segment;try {@@ -43,4 +43,4 @@ function resolvePath(_path) {);}-module.exports = { resolvePath, sendMessageToRenderer };+export { resolvePath, sendMessageToRenderer };diff --git a/apps/web/desktop/jsonstorage/index.js b/apps/web/desktop/jsonstorage/index.jsindex 6a46e6ace..33629117f 100644--- a/apps/web/desktop/jsonstorage/index.js+++ b/apps/web/desktop/jsonstorage/index.js@@ -17,13 +17,13 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const fs = require("fs");-const { app } = require("electron");-const path = require("path");+import { readFileSync, writeFileSync } from "fs";+import { app } from "electron";+import { join } from "path";const directory = app.getPath("userData");const filename = "config.json";-const filePath = path.join(directory, filename);+const filePath = join(directory, filename);class JSONStorage {static get(key, def) {const json = this.readJson();@@ -45,7 +45,7 @@ class JSONStorage {*/static readJson() {try {- const json = fs.readFileSync(filePath, "utf-8");+ const json = readFileSync(filePath, "utf-8");return JSON.parse(json);} catch (e) {console.error(e);@@ -58,10 +58,10 @@ class JSONStorage {*/static writeJson(json) {try {- fs.writeFileSync(filePath, JSON.stringify(json));+ writeFileSync(filePath, JSON.stringify(json));} catch (e) {console.error(e);}}}-module.exports = JSONStorage;+export { JSONStorage };diff --git a/apps/web/desktop/logger.js b/apps/web/desktop/logger.jsindex 7a195f387..26494f0d2 100644--- a/apps/web/desktop/logger.js+++ b/apps/web/desktop/logger.js@@ -17,16 +17,16 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { app } = require("electron");-const { diary, enable, default_reporter } = require("diary");-const fs = require("fs");-const path = require("path");-const { isDevelopment } = require("./utils");+import { app } from "electron";+import { diary, enable, default_reporter } from "diary";+import { createWriteStream } from "fs";+import { join } from "path";+import { isDevelopment } from "./utils";enable("native");-const LOG_FILE_PATH = path.join(app.getPath("logs"), "notesnook.log");-const logFileStream = fs.createWriteStream(LOG_FILE_PATH, {+const LOG_FILE_PATH = join(app.getPath("logs"), "notesnook.log");+const logFileStream = createWriteStream(LOG_FILE_PATH, {autoClose: true,flags: "a"});@@ -51,4 +51,4 @@ function logFileReporter(e) {logFileStream.write(str);}-module.exports.logger = native;+export const logger = native;diff --git a/apps/web/desktop/menu.js b/apps/web/desktop/menu.jsindex 3f201da1c..ab5715296 100644--- a/apps/web/desktop/menu.js+++ b/apps/web/desktop/menu.js@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { Menu, MenuItem, clipboard } = require("electron");+import { Menu, MenuItem, clipboard } from "electron";/***@@ -106,4 +106,4 @@ function setupMenu(mainWindow) {menu.popup();});}-module.exports = { setupMenu };+export { setupMenu };diff --git a/apps/web/desktop/paths.js b/apps/web/desktop/paths.jsindex c3a496dbd..658fcacf3 100644--- a/apps/web/desktop/paths.js+++ b/apps/web/desktop/paths.js@@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-module.exports.PATHS = {+export const PATHS = {backupsDirectory: "documents/Notesnook/backups",logsDirectory: "logs/"};diff --git a/apps/web/desktop/preload.js b/apps/web/desktop/preload.jsindex 04bcaecc1..78cc0ccb5 100644--- a/apps/web/desktop/preload.js+++ b/apps/web/desktop/preload.js@@ -18,7 +18,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.*//* global MAC_APP_STORE */-const { contextBridge, ipcRenderer } = require("electron");+import { contextBridge, ipcRenderer } from "electron";contextBridge.exposeInMainWorld("os", MAC_APP_STORE ? "mas" : process.platform);diff --git a/apps/web/desktop/protocol.js b/apps/web/desktop/protocol.jsindex 37122642c..38d7a1798 100644--- a/apps/web/desktop/protocol.js+++ b/apps/web/desktop/protocol.js@@ -17,12 +17,13 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { protocol } = require("electron");-const { isDevelopment, getPath } = require("./utils");-const fs = require("fs");-const path = require("path");-const { logger } = require("./logger");-const { Blob } = require("buffer");+import { protocol } from "electron";+import { isDevelopment, getPath } from "./utils";+import { createReadStream } from "fs";+import { extname, normalize } from "path";+import { logger } from "./logger";+import { Blob } from "buffer";+import { URL } from "url";const FILE_NOT_FOUND = -6;const BASE_PATH = isDevelopment() ? "../public" : "";@@ -45,8 +46,8 @@ function registerProtocol() {if (shouldInterceptRequest(url)) {logger.info("Intercepting request:", request);- const loadIndex = !path.extname(url.pathname);- const absoluteFilePath = path.normalize(+ const loadIndex = !extname(url.pathname);+ const absoluteFilePath = normalize(`${__dirname}${loadIndex? `${BASE_PATH}/index.html`@@ -59,9 +60,9 @@ function registerProtocol() {callback({ error: FILE_NOT_FOUND });return;}- const fileExtension = path.extname(filePath).replace(".", "");+ const fileExtension = extname(filePath).replace(".", "");- const data = fs.createReadStream(filePath);+ const data = createReadStream(filePath);callback({data,mimeType: extensionToMimeType[fileExtension]@@ -132,4 +133,5 @@ async function getBody(request) {return await blob.arrayBuffer();}-module.exports = { registerProtocol, URL: `${PROTOCOL}://${HOSTNAME}/` };+const PROTOCOL_URL = `${PROTOCOL}://${HOSTNAME}/`;+export { registerProtocol, PROTOCOL_URL };diff --git a/apps/web/desktop/utils.js b/apps/web/desktop/utils.jsindex e30be33dd..746ed204f 100644--- a/apps/web/desktop/utils.js+++ b/apps/web/desktop/utils.js@@ -17,9 +17,9 @@ You should have received a copy of the GNU General Public Licensealong with this program. If not, see <http://www.gnu.org/licenses/>.*/-const { app } = require("electron");-const path = require("path");-const fs = require("fs");+import { app } from "electron";+import { join } from "path";+import { statSync } from "fs";function isDevelopment() {if (typeof electron === "string") {@@ -33,18 +33,18 @@ function isDevelopment() {function getPath(filePath) {try {- const result = fs.statSync(filePath);+ const result = statSync(filePath);if (result.isFile()) {return filePath;}if (result.isDirectory()) {- return getPath(path.join(filePath, "index.html"));+ return getPath(join(filePath, "index.html"));}} catch (_) {// ignore}}-module.exports = { getPath, isDevelopment };+export { getPath, isDevelopment };