Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
Misotheism committed Feb 23, 2021
1 parent eec7440 commit 278c0a6
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 19 deletions.
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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'",
Expand Down Expand Up @@ -113,7 +113,6 @@
],
"directories": {
"buildResources": "assets"
},
"extends": "zeromq"
}
}
}
23 changes: 14 additions & 9 deletions public/electron.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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}`),
);
});
}
Expand All @@ -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,
Expand All @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion public/pycatService.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 0 additions & 3 deletions src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -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];
},
}}>
Expand Down

0 comments on commit 278c0a6

Please sign in to comment.