Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build native apps for Windows, Mac, Linux and upload the app files to the v1.0.0 release #58

Open
gr2m opened this issue Sep 19, 2016 · 8 comments

Comments

@gr2m
Copy link
Contributor

gr2m commented Sep 19, 2016

We can upload files to the v1.0.0 release at https://github.com/Rookies-RGSOC2016/hoodie-electron-app/releases/edit/v1.0.0

@flyjwayur
Copy link
Contributor

flyjwayur commented Sep 20, 2016

@gr2m @titay2 @omidfi @orfjackal
Hey :) To make an executable and installable native application, I used 'electron-packager'. I used 'electron-packager . --all' command line to make a cross-platform app. But it seems it only created the native app for Linux.
For creating a native app for Window and Mac, do I need to use Window and Mac OS?

If it's working, I wanted to replace the desktop icon with Hoodie icon, but I was not able to find where is the default desktop icon is. I followed this Packaging and Distributing Electron Desktop Apps tutorial which is made by Kyle Robinson Young. This is current scripts in package.json. For replacing the default icon image, we can do '&& cp In the tutorial, the directory looks like Myapp.app/Contents/Resources/atom.icns and in the official Electron application distribution website, electron desktop seems to have this format '.app/Contents/'. But in my current code, it does not have these directories.

Currently, those features are working with scripts.
-The native app for Linux seems ready(When we click the app icon, we can open the desktop app)
-It has app.asar so that it won't expose the source code.
-It ignores node_module which can take the space.

"scripts": {
    "start": "electron .",
    "package": "asar pack Hoodie-linux-x64/resources/app Hoodie-linux-x64/resources/app.asar",
    "build": "electron-packager . Hoodie --ignore=node_module/electron_"
  }

And it seems we can also make a native app with electron-builder :)

@albacoretuna
Copy link

Good job!

I checked the electron boilerplate project and saw:
"You can create Windows installer only when running on Windows, the same is true for Linux and OSX. So to generate all three installers you need all three operating systems."

@gr2m
Copy link
Contributor Author

gr2m commented Sep 20, 2016

@zeke can you point us to some places to learn how other projects do this? For context: the hoodie-electron-app project is our project we are working on with Hoodie’s Rails Girls Summer of Code Team, your help would be much appreciated!

@zeke
Copy link

zeke commented Sep 20, 2016

You can create Windows installer only when running on Windows, the same is true for Linux and OSX.

☝️ This is incorrect. If you're on MacOS, you can package apps for all three platforms. You cannot, however, code sign MacOS apps from any other platform.

https://github.com/electron-userland/electron-packager#readme
https://github.com/electron-userland/electron-builder#readme (more 🔔 and 🎺)

See also https://github.com/electron/electron/blob/master/docs/api/auto-updater.md, which highlights some popular tools for distributing updates to your users.

@gr2m
Copy link
Contributor Author

gr2m commented Sep 20, 2016

Thanks a ton @zeke for your help <3

electron-builder looks great! And I think this is a great example we could learn from: https://github.com/develar/onshape-desktop-shell/blob/master/package.json

@flyjwayur
Copy link
Contributor

@omidfi @zeke @gr2m Thank you so much for the kind helps and helpful links :D We'll read carefully and try to test/use electron-packager & electron-builder and auto-updater tools in our project with MacOS ;D

@flyjwayur
Copy link
Contributor

flyjwayur commented Sep 22, 2016

@gr2m @zeke :D If it's ok, could I ask two questions regarding electron-builder? I tried to install electron-builder by 'npm i electron-builder --save -dev' in Mac and Linux several times. But I got this error and 'electron-builder' is not in the devDependencies. I googled to solve this problem but I wasn't find the solution. How could we save the memory?:)

<--- JS stacktrace --->

==== JS stack trace =========================================

Security context: 0x.... <JS Object>
    1: indexOf(aka indexOf) ....
    2: formatProperty(aka formatProperty)....

FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
Aborted (core dumped)

I tried to run the script by 'npm run dist' and 'npm run pack' after writing below 'package.json'.
But it shows this error. This error might come from failing to have electron-builder in the devDependencies or more like something else? I'm trying to find the next small step but I wasnt able to find it by myself so far.
Sorry for the simple questions and thank you for reading my questions. :D

<This is the error that I got in terminal>
ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! [email protected] pack: `build --dir`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the [email protected] pack script 'build --dir'.
npm ERR! This is most likely a problem with the Hoodie package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     build --dir
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs Hoodie
...
<This is a part of package.json>
{
  "name": "Hoodie",
  "version": "1.0.0",
  "description": "A hoodie dekstop application based on GUI",
  "main": "main.js",
  "scripts": {
    "start": "electron .",
    "pack": "build --dir",
    "dist": "build"
  },
  "build": {
    "asar": false,
    "appId": "hoodie.desktop.app",
    "category": "public.app-category.hoodie-desktop-app",
    "dmg": {
      "contents": [
        {
          "x": 410,
          "y": 150,
          "type": "link",
          "path": "/Applications"
        },
        {
          "x": 130,
          "y": 150,
          "type": "file"
        }
      ]
    }
  }

@zeke
Copy link

zeke commented Sep 22, 2016

--save -dev should be --save-dev with no spaces. That might be the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants