diff --git a/package.json b/package.json index c038f27..8d424c9 100644 --- a/package.json +++ b/package.json @@ -12,12 +12,12 @@ "socket.io-client": "^3.1.1" }, "devDependencies": { - "@babel/core": "^7.12.17", - "@babel/eslint-parser": "^7.12.17", + "@babel/core": "^7.13.1", + "@babel/eslint-parser": "^7.13.4", "concurrently": "^6.0.0", "cross-env": "^7.0.3", "electron": "^11.3.0", - "electron-builder": "^22.9.1", + "electron-builder": "^22.8.1", "electron-devtools-installer": "^3.1.1", "electron-rebuild": "^2.3.5", "eslint": "^7.20.0", @@ -31,7 +31,7 @@ "wait-on": "^5.2.1" }, "scripts": { - "rebuild": "rebuild zeromq --runtime=electron --target=11.2.1", + "rebuild": "rebuild --runtime=electron --target=11.2.1", "react-start": "cross-env BROWSER=NONE react-scripts start", "electron-start": "cross-env DEV=1 electron .", "start": "concurrently 'npm run react-start' 'wait-on http://localhost:3000/ && npm run electron-start'", @@ -113,7 +113,6 @@ ], "directories": { "buildResources": "assets" - }, - "extends": "zeromq" + } } } diff --git a/public/electron.js b/public/electron.js index f047acf..30d54d3 100644 --- a/public/electron.js +++ b/public/electron.js @@ -6,7 +6,9 @@ const {app} = electron; const {BrowserWindow} = electron; const nativeImage = electron.nativeImage; -const PycatService = require('../public/pycatService'); +const PycatService = process.env.DEV ? + require('../public/pycatService') : + require(path.join(__dirname, '../build/pycatService')); // Launch python service. const pycatService = new PycatService('production'); // production or development @@ -21,10 +23,10 @@ if (process.env.DEV) { app.whenReady().then(() => { installExtension(REDUX_DEVTOOLS).then((name) => - console.log(`Added Extension: ${name}`), + console.info(`Added Extension: ${name}`), ); installExtension(REACT_DEVELOPER_TOOLS).then((name) => - console.log(`Added Extension: ${name}`), + console.info(`Added Extension: ${name}`), ); }); } @@ -39,11 +41,7 @@ let mainWindow; const createWindow = () => { const startUrl = process.env.DEV ? 'http://localhost:3000' : - url.format({ - pathname: path.join(__dirname, '/../build/index.html'), - protocol: 'file:', - slashes: true, - }); + url.pathToFileURL(path.join(__dirname, '/../build/index.html')).href; mainWindow = new BrowserWindow({ show: false, icon, @@ -64,7 +62,14 @@ const createWindow = () => { // mainWindow.maximize(); mainWindow.show(); - mainWindow.loadURL(startUrl); + mainWindow.loadURL(startUrl).then(() => { + console.info('pyCat '); + }); + console.log('LOOK here:'); + console.log(startUrl); + console.log(String(Object.assign(new URL('http://localhost:3000'), + {pathname: ''} + ))); process.env.DEV && mainWindow.webContents.openDevTools(); mainWindow.on('closed', function() { diff --git a/public/pycatService.js b/public/pycatService.js index 69e2e9a..e30de93 100644 --- a/public/pycatService.js +++ b/public/pycatService.js @@ -34,7 +34,7 @@ module.exports = class PycatService { shutdown() { if (this.mode === 'development') return; if (this.process) { - console.log('SHUTDOWN of pycatService'); + console.info('[SHUTDOWN of pycatService]'); this.process.kill(); this.process = null; } diff --git a/src/App.js b/src/App.js index 01ad0ee..b3c5ba6 100644 --- a/src/App.js +++ b/src/App.js @@ -50,12 +50,9 @@ const App = () => { }, setTask: (key, value) => { task[key] = value; - console.log(task); setTask(task); }, getFromTask: (key) => { - console.log('getFromTask:'); - console.log(task[key]); return task[key]; }, }}>