WebReflection / benja

Bootable Electron Node JS Application
https://archibold.io/benja/
194 stars 32 forks source link

Ability to run packaged application #17

Closed footniko closed 7 years ago

footniko commented 7 years ago

Actually it's not an issue, I'm just trying to find the way to run packaged electron application with BENJA. By default BENJA starts the app by invoking npm start. How can I change it just to start packaged application?

WebReflection commented 7 years ago

What do you mean?

WebReflection commented 7 years ago

I mean ...you know you can just change the start script inside package.json, right?

footniko commented 7 years ago

Sure :) I'm using a lot of libraries and use ES6 on my project. In order to not to use node compilers like babel, gulp, webpack etc., I'm using https://github.com/electron/electron-compile to compile my code on the fly. But I can't do this on production, so for production I use https://github.com/electron-userland/electron-packager Electron-packager just package whole application to one executable file (let's say app) which I can run just by invoking ./app

WebReflection commented 7 years ago

and what has any of this to do with benja?

this is the package.json https://github.com/WebReflection/benja/blob/gh-pages/os/app/package.json

nothing you mentioned is needed or even installed, or better, electron is just there for you.

What you do with your own app it's your business, and all you have to do is to change this line https://github.com/WebReflection/benja/blob/gh-pages/os/app/package.json#L7

into this one:

"scripts": {
    "start": "./your-app"
  },

am I missing something?

WebReflection commented 7 years ago

Remember if you want differentiate between your PC (dev) and the Pi you can:

"start": "if [ \"$(uname -m)\" = 'x86_64' ]; then electron index.js; else ./your-app; fi"

this, of course, if you are on Linux/OSX ... otherwise I'm sure there's some similar trick for Windows

WebReflection commented 7 years ago

watch out, I've edited the check