Added electron builder and auto update scripts. Scripts not tested.
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -28,6 +28,7 @@ client/.env
|
||||
.env.test.local
|
||||
.env.production.local
|
||||
/out
|
||||
/dist
|
||||
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
|
||||
@@ -3,8 +3,14 @@ const { app, BrowserWindow, Tray, Menu, ipcMain } = require("electron");
|
||||
const isDev = require("electron-is-dev");
|
||||
const { default: ipcTypes } = require("../src/ipc.types");
|
||||
const { store } = require("./electron-store");
|
||||
const { autoUpdater } = require("electron-updater");
|
||||
const log = require("electron-log");
|
||||
require("./ipc-main-handler");
|
||||
|
||||
autoUpdater.logger = log;
|
||||
autoUpdater.logger.transports.file.level = "info";
|
||||
log.info("App starting...");
|
||||
|
||||
// Conditionally include the dev tools installer to load React Dev Tools
|
||||
let installExtension, REACT_DEVELOPER_TOOLS;
|
||||
if (isDev) {
|
||||
@@ -29,6 +35,7 @@ function createWindow() {
|
||||
webPreferences: {
|
||||
nodeIntegration: false,
|
||||
enableRemoteModule: false,
|
||||
webSecurity: false,
|
||||
worldSafeExecuteJavaScript: true,
|
||||
contextIsolation: true,
|
||||
preload: path.join(__dirname, "preload.js"), // use a preload script
|
||||
@@ -39,7 +46,7 @@ function createWindow() {
|
||||
mainWindow.loadURL(
|
||||
isDev
|
||||
? "http://localhost:3000"
|
||||
: `file://${path.join(__dirname, "../build/index.html")}`
|
||||
: `file://${path.join(__dirname, "/../build/index.html")}`
|
||||
);
|
||||
|
||||
// mainWindow.on("close", function (event) {
|
||||
@@ -67,6 +74,7 @@ function createWindow() {
|
||||
}
|
||||
|
||||
mainWindow.maximize();
|
||||
autoUpdater.checkForUpdatesAndNotify();
|
||||
}
|
||||
|
||||
exports.mainWindow = mainWindow;
|
||||
@@ -90,6 +98,7 @@ app.whenReady().then(() => {
|
||||
});
|
||||
|
||||
if (isDev) app.setAppUserModelId(process.execPath);
|
||||
else app.setAppUserModelId("com.imex.rps");
|
||||
// Quit when all windows are closed, except on macOS. There, it's common
|
||||
// for applications and their menu bar to stay active until the user quits
|
||||
// explicitly with Cmd + Q.
|
||||
@@ -147,3 +156,30 @@ function createTray() {
|
||||
appIcon.setContextMenu(contextMenu);
|
||||
return appIcon;
|
||||
}
|
||||
|
||||
autoUpdater.on("checking-for-update", () => {
|
||||
console.log("Checking for update...");
|
||||
});
|
||||
autoUpdater.on("update-available", (ev, info) => {
|
||||
console.log("Update available.");
|
||||
});
|
||||
autoUpdater.on("update-not-available", (ev, info) => {
|
||||
console.log("Update not available.");
|
||||
});
|
||||
autoUpdater.on("error", (ev, err) => {
|
||||
console.log("Error in auto-updater.");
|
||||
});
|
||||
autoUpdater.on("download-progress", (ev, progressObj) => {
|
||||
console.log("Download progress...");
|
||||
});
|
||||
autoUpdater.on("update-downloaded", (ev, info) => {
|
||||
console.log("Update downloaded; will install in 5 seconds");
|
||||
});
|
||||
autoUpdater.on("update-downloaded", (ev, info) => {
|
||||
// Wait 5 seconds, then quit and install
|
||||
// In your application, you don't need to wait 5 seconds.
|
||||
// You could call autoUpdater.quitAndInstall(); immediately
|
||||
setTimeout(function () {
|
||||
autoUpdater.quitAndInstall();
|
||||
}, 5000);
|
||||
});
|
||||
|
||||
@@ -3,6 +3,7 @@ const path = require("path");
|
||||
|
||||
function NewNotification(config) {
|
||||
return Notification({
|
||||
|
||||
icon: path.join(__dirname, "../../src/assets/logo512.png"),
|
||||
...config,
|
||||
});
|
||||
|
||||
999
package-lock.json
generated
999
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
63
package.json
63
package.json
@@ -1,10 +1,11 @@
|
||||
{
|
||||
"name": "imexrps",
|
||||
"productName": "ImEX RPS",
|
||||
"author": "Patrick Fic <patrick@thinkimex.com>",
|
||||
"author": "ImEX Systems Inc. <support@thinkimex.com>",
|
||||
"description": "ImEX RPS",
|
||||
"version": "0.0.1",
|
||||
"version": "1.0.0",
|
||||
"main": "electron/main.js",
|
||||
"homepage": "./",
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.2.4",
|
||||
"@fingerprintjs/fingerprintjs": "^2.1.4",
|
||||
@@ -15,7 +16,9 @@
|
||||
"dinero.js": "^1.8.1",
|
||||
"dotenv": "^8.2.0",
|
||||
"electron-is-dev": "^1.2.0",
|
||||
"electron-log": "^4.2.4",
|
||||
"electron-store": "^6.0.1",
|
||||
"electron-updater": "^4.3.5",
|
||||
"firebase": "^7.23.0",
|
||||
"graphql": "^15.3.0",
|
||||
"lodash": "^4.17.20",
|
||||
@@ -41,7 +44,9 @@
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject",
|
||||
"dev": "concurrently -k \"npm start\" \"npm:electron\"",
|
||||
"electron": "wait-on tcp:3000 && electron ."
|
||||
"pack": "electron-builder --dir",
|
||||
"dist": "electron-builder",
|
||||
"postinstall": "electron-builder install-app-deps"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": "react-app"
|
||||
@@ -61,35 +66,51 @@
|
||||
"devDependencies": {
|
||||
"concurrently": "^5.3.0",
|
||||
"electron": "^10.1.3",
|
||||
"electron-builder": "^22.9.1",
|
||||
"electron-devtools-installer": "^3.1.1",
|
||||
"enzyme": "^3.11.0",
|
||||
"enzyme-adapter-react-16": "^1.15.5",
|
||||
"redux-logger": "^3.0.6",
|
||||
"wait-on": "^5.2.0"
|
||||
},
|
||||
"config": {
|
||||
"forge": {
|
||||
"packagerConfig": {},
|
||||
"makers": [
|
||||
"build": {
|
||||
"extends": null,
|
||||
"appId": "com.imex.rps",
|
||||
"files": [
|
||||
"build/**",
|
||||
"electron/**",
|
||||
"src/ipc.types.js",
|
||||
"src/assets/**"
|
||||
],
|
||||
"publish": [
|
||||
{
|
||||
"provider": "generic",
|
||||
"url": "https://update.rps.bodyshop.app"
|
||||
}
|
||||
],
|
||||
"win": {
|
||||
"target": "nsis",
|
||||
"icon": "src/icons/win/icon.ico"
|
||||
},
|
||||
"dmg": {
|
||||
"contents": [
|
||||
{
|
||||
"name": "@electron-forge/maker-squirrel",
|
||||
"config": {}
|
||||
"x": 110,
|
||||
"y": 150
|
||||
},
|
||||
{
|
||||
"name": "@electron-forge/maker-zip",
|
||||
"platforms": [
|
||||
"darwin"
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "@electron-forge/maker-deb",
|
||||
"config": {}
|
||||
},
|
||||
{
|
||||
"name": "@electron-forge/maker-rpm",
|
||||
"config": {}
|
||||
"x": 240,
|
||||
"y": 150,
|
||||
"type": "link",
|
||||
"path": "/Applications"
|
||||
}
|
||||
]
|
||||
},
|
||||
"linux": {
|
||||
"target": [
|
||||
"AppImage",
|
||||
"deb"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ export function RoutesPage() {
|
||||
<Layout style={{ background: "#fff" }}>
|
||||
<Layout.Content style={{ margin: "1rem", height: "100%" }}>
|
||||
<Switch>
|
||||
<Route exact path="/" component={Jobs} />
|
||||
<Route exact path="/settings" component={SettingsPage} />
|
||||
<Route path="/" component={Jobs} />
|
||||
</Switch>
|
||||
</Layout.Content>
|
||||
</Layout>
|
||||
|
||||
Reference in New Issue
Block a user