react-native-electron-platform 0.0.22 → 0.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +5 -1
- package/src/modules/autoUpdater.js +20 -1
- package/src/modules/windowManager.js +3 -4
- package/webpack.config.mjs +22 -2
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-electron-platform",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.24",
|
|
4
4
|
"description": "A boilerplate and utilities for running React Native applications in Electron",
|
|
5
5
|
"main": "index.mjs",
|
|
6
6
|
"scripts": {
|
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
"@babel/preset-env": "^7.0.0",
|
|
39
39
|
"@babel/preset-react": "^7.0.0",
|
|
40
40
|
"@babel/preset-typescript": "^7.0.0",
|
|
41
|
+
"@babel/plugin-transform-class-properties": "^7.0.0",
|
|
42
|
+
"@babel/plugin-transform-private-methods": "^7.0.0",
|
|
43
|
+
"@babel/plugin-transform-private-property-in-object": "^7.0.0",
|
|
44
|
+
"@babel/plugin-transform-runtime": "^7.0.0",
|
|
41
45
|
"babel-loader": "^9.0.0",
|
|
42
46
|
"react-refresh": "^0.14.0",
|
|
43
47
|
"file-loader": "^6.0.0"
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { app, dialog } from "electron";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import fs from "fs";
|
|
2
4
|
import electronUpdater from "electron-updater";
|
|
3
5
|
const { autoUpdater } = electronUpdater;
|
|
4
6
|
|
|
@@ -9,6 +11,14 @@ export function setupAutoUpdater(mainWindow) {
|
|
|
9
11
|
console.log("Auto-update disabled in development.");
|
|
10
12
|
return;
|
|
11
13
|
}
|
|
14
|
+
|
|
15
|
+
// Check if app-update.yml exists (required for auto-updates)
|
|
16
|
+
const appUpdatePath = path.join(process.resourcesPath, "app-update.yml");
|
|
17
|
+
if (!fs.existsSync(appUpdatePath)) {
|
|
18
|
+
console.log("⚠️ Auto-update disabled: app-update.yml not found.");
|
|
19
|
+
console.log(" This file is only created when publishing updates.");
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
12
22
|
|
|
13
23
|
autoUpdater.autoDownload = true;
|
|
14
24
|
autoUpdater.autoInstallOnAppQuit = true;
|
|
@@ -57,6 +67,9 @@ export function setupAutoUpdater(mainWindow) {
|
|
|
57
67
|
if (result.response === 0) {
|
|
58
68
|
autoUpdater.quitAndInstall();
|
|
59
69
|
}
|
|
70
|
+
})
|
|
71
|
+
.catch((err) => {
|
|
72
|
+
console.error("Error showing update dialog:", err);
|
|
60
73
|
});
|
|
61
74
|
});
|
|
62
75
|
|
|
@@ -67,6 +80,12 @@ export function setupAutoUpdater(mainWindow) {
|
|
|
67
80
|
|
|
68
81
|
// Check for updates after a short delay
|
|
69
82
|
setTimeout(() => {
|
|
70
|
-
|
|
83
|
+
try {
|
|
84
|
+
autoUpdater.checkForUpdates().catch((err) => {
|
|
85
|
+
console.error("Failed to check for updates:", err.message);
|
|
86
|
+
});
|
|
87
|
+
} catch (err) {
|
|
88
|
+
console.error("Auto-updater initialization error:", err);
|
|
89
|
+
}
|
|
71
90
|
}, 3000);
|
|
72
91
|
}
|
|
@@ -2,7 +2,6 @@ import { BrowserWindow, screen, session } from "electron";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import { app, dialog } from "electron";
|
|
5
|
-
import { ApiUrl } from "react-native-electron-platform/webpack.config.mjs";
|
|
6
5
|
|
|
7
6
|
export function createMainWindow(__dirname) {
|
|
8
7
|
const primaryDisplay = screen.getPrimaryDisplay();
|
|
@@ -24,7 +23,7 @@ export function createMainWindow(__dirname) {
|
|
|
24
23
|
nodeIntegration: false,
|
|
25
24
|
contextIsolation: true,
|
|
26
25
|
sandbox: false,
|
|
27
|
-
webSecurity:
|
|
26
|
+
webSecurity: false,
|
|
28
27
|
disableBlinkFeatures: "AutoLoadIconsForPage",
|
|
29
28
|
nativeWindowOpen: true,
|
|
30
29
|
spellcheck: true,
|
|
@@ -91,8 +90,8 @@ function loadAppContent(mainWindow, __dirname) {
|
|
|
91
90
|
const isDev = isDevMode();
|
|
92
91
|
|
|
93
92
|
if (isDev) {
|
|
94
|
-
mainWindow.loadURL(
|
|
95
|
-
console.log("DEV MODE:"
|
|
93
|
+
mainWindow.loadURL("http://localhost:5001");
|
|
94
|
+
console.log("DEV MODE: http://localhost:5001");
|
|
96
95
|
} else {
|
|
97
96
|
const possiblePaths = [
|
|
98
97
|
path.join(__dirname, "web-build/index.html"),
|
package/webpack.config.mjs
CHANGED
|
@@ -74,6 +74,7 @@ export default {
|
|
|
74
74
|
|
|
75
75
|
module: {
|
|
76
76
|
rules: [
|
|
77
|
+
// Your source files
|
|
77
78
|
// Your source files
|
|
78
79
|
{
|
|
79
80
|
test: /\.(js|jsx|ts|tsx)$/,
|
|
@@ -81,7 +82,17 @@ export default {
|
|
|
81
82
|
use: {
|
|
82
83
|
loader: 'babel-loader',
|
|
83
84
|
options: {
|
|
84
|
-
|
|
85
|
+
presets: [
|
|
86
|
+
'@babel/preset-env',
|
|
87
|
+
'@babel/preset-react',
|
|
88
|
+
'@babel/preset-typescript',
|
|
89
|
+
],
|
|
90
|
+
plugins: [
|
|
91
|
+
['@babel/plugin-transform-class-properties', { loose: true }],
|
|
92
|
+
['@babel/plugin-transform-private-methods', { loose: true }],
|
|
93
|
+
['@babel/plugin-transform-private-property-in-object', { loose: true }],
|
|
94
|
+
'@babel/plugin-transform-runtime',
|
|
95
|
+
],
|
|
85
96
|
},
|
|
86
97
|
},
|
|
87
98
|
},
|
|
@@ -93,7 +104,16 @@ export default {
|
|
|
93
104
|
use: {
|
|
94
105
|
loader: 'babel-loader',
|
|
95
106
|
options: {
|
|
96
|
-
|
|
107
|
+
presets: [
|
|
108
|
+
'@babel/preset-env',
|
|
109
|
+
'@babel/preset-react',
|
|
110
|
+
'@babel/preset-typescript',
|
|
111
|
+
],
|
|
112
|
+
plugins: [
|
|
113
|
+
['@babel/plugin-transform-class-properties', { loose: true }],
|
|
114
|
+
['@babel/plugin-transform-private-methods', { loose: true }],
|
|
115
|
+
['@babel/plugin-transform-private-property-in-object', { loose: true }],
|
|
116
|
+
],
|
|
97
117
|
},
|
|
98
118
|
},
|
|
99
119
|
},
|