wojtkowiak / meteor-desktop

Build a Meteor's desktop client with hot code push.
MIT License
448 stars 84 forks source link

Where goes the log in desktop.js ? #105

Open fabien-h opened 7 years ago

fabien-h commented 7 years ago

In desktop.js :

desktop.on( 'testLog', e => return console.log( 'test' ) );

Desktop.send('desktop', 'maximize' ); // => undefined

Desktop.send('desktop', 'closeApp' ); works.

Btw, the goal is to implement something like remote.BrowserWindow.getFocusedWindow().minimize()

wojtkowiak commented 7 years ago

Hey,

you should see the log in the console where you have started your desktop app with npm run desktop. It is better to use log that you receive in the desktop.js constructor as this saves the log to a file called run.log in the app data dir which is: %APPDATA% on Windows $XDG_CONFIG_HOME or ~/.config on Linux ~/Library/Application Support on macOS

If you will have in desktop.js

        desktop.on('minimize', () => BrowserWindow.getFocusedWindow().minimize());

In meteor calling it with Desktop.send('desktop', 'minimze'); should work without any problems.

Desktop.send('desktop', 'maximize' ); // => undefined

You mean that Desktop is undefined? Is this code used in meteor project or in the code in .desktop?

fabien-h commented 7 years ago

Hi, thank you for your answer. I misunderstood the way the whole thing works.

Desktop.send('desktop', 'maximize' ); // => undefined

I got that in the live console of the application. (devtron right ?).

But the logs from the desktop.js appear in the terminal where you npm run desktop. The reason why I did not see them is that when I update desktop.js, the process in the terminal is stopped. Which is atcually super weird because the app keeps existing and being refreshed when I update desktop.js again.

The process is not terminated when I update code in the client or in the squeleton app.

Do you think there is a way to keep the node process runing after a desktop.js update ? It is still workable because we can edit / restart the process / call the event / see the log ... and again. But that would be more user friendly.

Btw, the process stops after that :

verbose: [autoupdate] checking for updates on http://127.0.0.1:3000/
info: [autoupdate] [AssetBundleManager] trying to query http://127.0.0.1:3000/__cordova/manifest.json
debug: [autoupdate] [AssetManifest] 119 entries. (Version: cc2079f5381cf293779b9e19646468729acb064e)
debug: [autoupdate] [AssetBundleManager] downloaded asset manifest for version: cc2079f5381cf293779b9e19646468729acb064e
debug: [autoupdate] got desktop version information: a76dc5babf6e66c18ec5460969e4e3bc2f9d1a90 (compatibility: f8299bd3f3a96979c1cfe449a8feb225)
info: [autoupdate] [AssetBundleManager] created download dir.
debug: [autoupdate] [AssetBundleManager] manifest copied to new Download dir
verbose: [autoupdate] [AssetBundle] making bundle object for /Users/fabien/Library/Application Support/faber/versions/Downloading
debug: [autoupdate] [AssetBundleDownloader] downloader created for /Users/fabien/Library/Application Support/faber/versions/Downloading
verbose: [autoupdate] [AssetBundleDownloader] started downloading assets from bundle with version: cc2079f5381cf293779b9e19646468729acb064e
verbose: [autoupdate] [AssetBundleDownloader] saving /
verbose: [autoupdate] [AssetBundleDownloader] saving /packages/omega_meteor-desktop-bundler.js
verbose: [autoupdate] [AssetBundleDownloader] saving /version.desktop.json
verbose: [autoupdate] [AssetBundleDownloader] saving /desktop.asar
verbose: [autoupdate] [AssetBundleDownloader] finished downloading new asset bundle version:cc2079f5381cf293779b9e19646468729acb064e
debug: [autoupdate] [AssetBundleManager] skipping copying desktop.asar because the version is already downloaded
verbose: [autoupdate] setting last downloaded and pending version as cc2079f5381cf293779b9e19646468729acb064e
debug: [main] received newVersionReady (desktop update present)
debug: [main] will-navigate event to http://127.0.0.1:8049/, assuming that this is HCP refresh
verbose: [main] entering update to new HCP version procedure
info: [main] relaunching to use different version of desktop.asar

About minimize

BrowserWindow.getFocusedWindow().minimize()

Does not work because getFocusedWindow() is undefined. Maybe this has to do with devtron ? I got it to work that way :

BrowserWindow.getAllWindows()[ 0 ].minimize()

But I don’t feel super confident about it (the app is supposed to have only one window so...)


And I did not say it earlier, but great package ! The global experience is really good. 👍

wojtkowiak commented 7 years ago

Sorry for the delay.

But the logs from the desktop.js appear in the terminal where you npm run desktop. The reason why I did not see them is that when I update desktop.js, the process in the terminal is stopped. Which is atcually super weird because the app keeps existing and being refreshed when I update desktop.js again.

The process is not terminated when I update code in the client or in the squeleton app.

Do you think there is a way to keep the node process runing after a desktop.js update ? It is still workable because we can edit / restart the process / call the event / see the log ... and again. But that would be more user friendly.

This is a well know problem to me. That is number one problem reported to me by the teams that are building projects in my company. The problem is that the restart is being handled by Electron itself and you loose the pointer to stdout. Currently, the plan is to have an addition Chrome devtools plugin that will display those logs in an another window so you will not have to look at them in the console. But unfortunately, this will be done after 1.0 so currently I would bet on 3-4 months from now unless somebody would be interested in helping with that.

BrowserWindow.getFocusedWindow().minimize()

This is weird - I will check it out on Monday.

And I did not say it earlier, but great package ! The global experience is really good.

Thanks a lot!