It is an Electron integration that allows you to build a desktop client. It features:
full offline support
HCP built-in integration (works the same way like in Cordova, stores version on disk, has a faulty version recovery etc)
modular architecture
plugins support
Meteor.isDesktop feature
Squirrel auto update support
packaging and building installers
and much more… check out the readme on the project’s GitHub.
Oh, that sounded like a TV commercial
Basically, a few months ago I got a requirement to build an app with both native and desktop clients. I started to wonder if I could achieve this in one project with meteor. A quick search has lead me to meteor-electron and Electrometeor but they were not what I needed as I did not need to bake full meteor server into an app nor build an Electron wrapper that just displays my app’s url. I needed a desktop client that I can develop the same way we are now developing Cordova apps.
Why an npm package?
My first idea was to make a meteor fork as this would probably be the easiest path and make a PR later but I knew if this was accepted by Meteor team, they would take the responsibility for supporting and bug fixing it and that is always a tough decision in open source projects. So I decided I’ll take the harder path and do everything from the outside.
I am now publishing it as a beta version looking forward to any comments. Any bug reports, feature requests, and PRs are highly welcomed So i you have few spare minutes, go give it a try on your project. I would like to release a 1.0 stable version in a few months if there will be any interest in this. As a father of two little daughters I do not have much free time but I decided that all of it will be dedicated to this project for the next months.
If you have any questions you can reach me here or through github issues.
–
If there is anyone from Meteor team reading this - I have used the meteor logo a lot in the default assets - I hope that is not violating any licenses
You can create an Windows exe with npm run desktop -- package (you do not have to have meteor running for that command, you can use -b and it will be built automatically).
You can also create an Window installer with npm run desktop -- build-installer.
Not sure what do you mean with auto syncing files - app produced by this integration will work offline the same way apps produced for Cordova are working. So once the app regains the connection to server you can do whatever syncing you want. You can just do a Tracker.autorun on Meteor.status() to hook to it.
Have not tried that yet but I should not be problematic at all.
In theory you can run npm run desktop -- package and run electron-windows-store over the contents of .desktop-package (output dir from package process). Hmm first Meteor app in Windows Store that would be something
I have a built-in support for this planned for 0.5.0.
Once this https://github.com/electron-userland/electron-builder/issues/782 is finished it should work in meteor-desktop automatically. But if there will be no progress in that task, I will integrate it myself directly in meteor-desktop.
This looks great. I want to host an app on a windows network drive, would this allow me to access files from the network drive? I heard you can access files if you are within a browserWindow (see my question here: https://discuss.atom.io/t/hosting-app-on-a-windows-network-drive/34816/10) but i’m not sure how to do that…
WOW! I admit I was more than a bit intimidated by the docs in the repo.
Tried a default Meteor project which worked followed by a moderately complex app that’s in production.
It works! A Mac OS desktop from my web app by adding a single package!
If packaging works (as it should) … I’m a convert and will actually read the docs…
Normally you would not have any problems with accessing local files with the standard file protocol like file:///C:/SomeDir/somefile.txt but unfortunately, this will not work, as in meteor-desktop meteor app is served from the local server through normal HTTP protocol, therefore Chrome will disallow that.
I see three solutions to that problem:
There is Chrome’s --allow-file-access-from-files but I am not sure if this will work in Electron- will check that.
You can expose such access yourself with sth like this:
desktop.on('getFile', (event, fetchId, path) => {
desktop.respond('getFile', fetchId, fs.readFileSync(path)); // of course it will be better to use fs.readFile
});
Just have to say I’m so excited to see this!!! Looking forward to trying it out with my Meteor app, and I’ll be happy to contribute feedback, PRs, etc. as I am able. Thank you @omega for putting this together!
Ah that’s a shame. Do you know if the other meteor electron packages are built the same way? I have tried meteor-electron and electrify and I think I ran into the same problem.
I’m not sure how I would implement chrome’s --allow-file-access-from-file feature in electron so I you could check that I would be very grateful. Do you think that’s a valid option or a bit hacky?
I am currently loading images with node’s fs module but it is significantly slower than the standard file protocol, and requires a lot more overhead in terms of writing the code. I’m also going to be working with video so that could get more complex.
I’m creating an app for a vfx pipeline so I would need to display a lot of (potentially high resolution) images and video so performance is key.
I’m not sure how your third option would work since I’ve never used Cordova. How would that compare to the file protocol and fs speed wise?